Commit f2fe84b7 authored by hjk's avatar hjk
Browse files

debugger: change layout of the "Change Display Format..." context submenu

parent 7100d29f
......@@ -302,32 +302,31 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
QAction *showUnprintableOctal = 0;
QAction *showUnprintableHexadecimal = 0;
formatMenu.setTitle(tr("Change Display Format..."));
if (true /*idx.isValid() && !alternativeFormats.isEmpty() */) {
showUnprintableUnicode =
formatMenu.addAction(tr("Treat All Characters as Printable"));
showUnprintableUnicode->setCheckable(true);
showUnprintableUnicode->setChecked(unprintableBase == 0);
showUnprintableOctal =
formatMenu.addAction(tr("Show Unprintable Characters as Octal"));
showUnprintableOctal->setCheckable(true);
showUnprintableOctal->setChecked(unprintableBase == 8);
showUnprintableHexadecimal =
formatMenu.addAction(tr("Show Unprintable Characters as Hexadecimal"));
showUnprintableHexadecimal->setCheckable(true);
showUnprintableHexadecimal->setChecked(unprintableBase == 16);
showUnprintableUnicode =
formatMenu.addAction(tr("Treat All Characters as Printable"));
showUnprintableUnicode->setCheckable(true);
showUnprintableUnicode->setChecked(unprintableBase == 0);
showUnprintableOctal =
formatMenu.addAction(tr("Show Unprintable Characters as Octal"));
showUnprintableOctal->setCheckable(true);
showUnprintableOctal->setChecked(unprintableBase == 8);
showUnprintableHexadecimal =
formatMenu.addAction(tr("Show Unprintable Characters as Hexadecimal"));
showUnprintableHexadecimal->setCheckable(true);
showUnprintableHexadecimal->setChecked(unprintableBase == 16);
if (idx.isValid() /*&& !alternativeFormats.isEmpty() */) {
const QString spacer = QLatin1String(" ");
formatMenu.addSeparator();
QAction *dummy = formatMenu.addAction(
tr("Change Display for Type \"%1\"").arg(type));
tr("Change Display for Type \"%1\":").arg(type));
dummy->setEnabled(false);
formatMenu.addSeparator();
clearTypeFormatAction = formatMenu.addAction(tr("Automatic"));
clearTypeFormatAction = formatMenu.addAction(spacer + tr("Automatic"));
//clearTypeFormatAction->setEnabled(typeFormat != -1);
//clearTypeFormatAction->setEnabled(individualFormat != -1);
clearTypeFormatAction->setCheckable(true);
clearTypeFormatAction->setChecked(typeFormat == -1);
formatMenu.addSeparator();
for (int i = 0; i != alternativeFormats.size(); ++i) {
const QString format = alternativeFormats.at(i);
const QString format = spacer + alternativeFormats.at(i);
QAction *act = new QAction(format, &formatMenu);
act->setCheckable(true);
//act->setEnabled(individualFormat != -1);
......@@ -338,17 +337,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
}
formatMenu.addSeparator();
dummy = formatMenu.addAction(
tr("Change Display for Object Named \"%1\"").arg(mi0.data().toString()));
tr("Change Display for Object Named \"%1\":").arg(mi0.data().toString()));
dummy->setEnabled(false);
formatMenu.addSeparator();
clearIndividualFormatAction
= formatMenu.addAction(tr("Use Display Format Based on Type"));
= formatMenu.addAction(spacer + tr("Use Display Format Based on Type"));
//clearIndividualFormatAction->setEnabled(individualFormat != -1);
clearIndividualFormatAction->setCheckable(true);
clearIndividualFormatAction->setChecked(effectiveIndividualFormat == -1);
formatMenu.addSeparator();
for (int i = 0; i != alternativeFormats.size(); ++i) {
const QString format = alternativeFormats.at(i);
const QString format = spacer + alternativeFormats.at(i);
QAction *act = new QAction(format, &formatMenu);
act->setCheckable(true);
if (i == effectiveIndividualFormat)
......@@ -357,7 +354,9 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
individualFormatActions.append(act);
}
} else {
formatMenu.setEnabled(false);
QAction *dummy = formatMenu.addAction(
tr("Change Display for Type or Item..."));
dummy->setEnabled(false);
}
const bool actionsEnabled = engine->debuggerActionsEnabled();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment