forked from qt-creator/qt-creator
debugger: disable parts of L&W context menu when no item is selected
This commit is contained in:
@@ -213,27 +213,34 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
int individualFormat =
|
int individualFormat =
|
||||||
model()->data(mi0, IndividualFormatRole).toInt();
|
model()->data(mi0, IndividualFormatRole).toInt();
|
||||||
|
|
||||||
QMenu typeFormatMenu(tr("Change format for type '%1'").arg(type));
|
QMenu typeFormatMenu;
|
||||||
QMenu individualFormatMenu(tr("Change format for expression '%1'").arg(exp));
|
QMenu individualFormatMenu;
|
||||||
QList<QAction *> typeFormatActions;
|
QList<QAction *> typeFormatActions;
|
||||||
QList<QAction *> individualFormatActions;
|
QList<QAction *> individualFormatActions;
|
||||||
for (int i = 0; i != alternativeFormats.size(); ++i) {
|
if (idx.isValid()) {
|
||||||
const QString format = alternativeFormats.at(i);
|
typeFormatMenu.setTitle(tr("Change format for type '%1'").arg(type));
|
||||||
QAction *act = new QAction(format, &typeFormatMenu);
|
individualFormatMenu.setTitle(tr("Change format for expression '%1'").arg(exp));
|
||||||
act->setCheckable(true);
|
for (int i = 0; i != alternativeFormats.size(); ++i) {
|
||||||
if (i == typeFormat)
|
const QString format = alternativeFormats.at(i);
|
||||||
act->setChecked(true);
|
QAction *act = new QAction(format, &typeFormatMenu);
|
||||||
typeFormatMenu.addAction(act);
|
act->setCheckable(true);
|
||||||
typeFormatActions.append(act);
|
if (i == typeFormat)
|
||||||
act = new QAction(format, &individualFormatMenu);
|
act->setChecked(true);
|
||||||
act->setCheckable(true);
|
typeFormatMenu.addAction(act);
|
||||||
if (i == individualFormat)
|
typeFormatActions.append(act);
|
||||||
act->setChecked(true);
|
act = new QAction(format, &individualFormatMenu);
|
||||||
individualFormatMenu.addAction(act);
|
act->setCheckable(true);
|
||||||
individualFormatActions.append(act);
|
if (i == individualFormat)
|
||||||
|
act->setChecked(true);
|
||||||
|
individualFormatMenu.addAction(act);
|
||||||
|
individualFormatActions.append(act);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
typeFormatMenu.setTitle(tr("Change format for type"));
|
||||||
|
typeFormatMenu.setEnabled(false);
|
||||||
|
individualFormatMenu.setTitle(tr("Change format for expression"));
|
||||||
|
individualFormatMenu.setEnabled(false);
|
||||||
}
|
}
|
||||||
//typeFormatMenu.setActive(!alternativeFormats.isEmpty());
|
|
||||||
//individualFormatMenu.setActive(!alternativeFormats.isEmpty());
|
|
||||||
|
|
||||||
QMenu menu;
|
QMenu menu;
|
||||||
QAction *act1 = new QAction(tr("Adjust column widths to contents"), &menu);
|
QAction *act1 = new QAction(tr("Adjust column widths to contents"), &menu);
|
||||||
|
|||||||
Reference in New Issue
Block a user