diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index f10e8fc5ed3dbab0ef47b6e58b30e8532b137ec7..3be39eea5ace1fb5a874e016dfb3a780ca78bfdf 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1385,7 +1385,10 @@ QString WatchHandler::watcherEditPlaceHolder() void WatchHandler::setFormat(const QString &type, int format) { - m_typeFormats[type] = format; + if (format == -1) + m_typeFormats.remove(type); + else + m_typeFormats[type] = format; saveTypeFormats(); m_return->emitDataChanged(1); m_locals->emitDataChanged(1); diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index b762610b199ed1ac6fd51b19f03edf06105f3632..209944278a0021ea21e96c506f49676258b76686 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -217,7 +217,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) const QStringList alternativeFormats = model()->data(mi0, TypeFormatListRole).toStringList(); const int typeFormat = - qMax(int(DecimalFormat), model()->data(mi0, TypeFormatRole).toInt()); + model()->data(mi0, TypeFormatRole).toInt(); const int individualFormat = model()->data(mi0, IndividualFormatRole).toInt(); const int effectiveIndividualFormat = @@ -225,12 +225,18 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) QMenu typeFormatMenu; QList<QAction *> typeFormatActions; + QAction *clearTypeFormatAction = 0; if (idx.isValid()) { typeFormatMenu.setTitle( tr("Change Format for Type \"%1\"").arg(type)); if (alternativeFormats.isEmpty()) { typeFormatMenu.setEnabled(false); } else { + clearTypeFormatAction = typeFormatMenu.addAction(tr("Clear")); + clearTypeFormatAction->setEnabled(typeFormat != -1); + clearTypeFormatAction->setCheckable(true); + clearTypeFormatAction->setChecked(typeFormat == -1); + typeFormatMenu.addSeparator(); for (int i = 0; i != alternativeFormats.size(); ++i) { const QString format = alternativeFormats.at(i); QAction *act = new QAction(format, &typeFormatMenu); @@ -257,6 +263,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) } else { clearIndividualFormatAction = individualFormatMenu.addAction(tr("Clear")); clearIndividualFormatAction->setEnabled(individualFormat != -1); + clearIndividualFormatAction->setCheckable(true); + clearIndividualFormatAction->setChecked(individualFormat == -1); individualFormatMenu.addSeparator(); for (int i = 0; i != alternativeFormats.size(); ++i) { const QString format = alternativeFormats.at(i); @@ -379,6 +387,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) m_grabbing = true; } else if (act == actClearCodeModelSnapshot) { m_manager->clearCppCodeModelSnapshot(); + } else if (clearTypeFormatAction && act == clearTypeFormatAction) { + model()->setData(mi1, -1, TypeFormatRole); } else if (clearIndividualFormatAction && act == clearIndividualFormatAction) { model()->setData(mi1, -1, IndividualFormatRole); } else {