forked from qt-creator/qt-creator
debugger: fix resetting type formats in Locals and Watchers
This commit is contained in:
@@ -1385,6 +1385,9 @@ QString WatchHandler::watcherEditPlaceHolder()
|
|||||||
|
|
||||||
void WatchHandler::setFormat(const QString &type, int format)
|
void WatchHandler::setFormat(const QString &type, int format)
|
||||||
{
|
{
|
||||||
|
if (format == -1)
|
||||||
|
m_typeFormats.remove(type);
|
||||||
|
else
|
||||||
m_typeFormats[type] = format;
|
m_typeFormats[type] = format;
|
||||||
saveTypeFormats();
|
saveTypeFormats();
|
||||||
m_return->emitDataChanged(1);
|
m_return->emitDataChanged(1);
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
const QStringList alternativeFormats =
|
const QStringList alternativeFormats =
|
||||||
model()->data(mi0, TypeFormatListRole).toStringList();
|
model()->data(mi0, TypeFormatListRole).toStringList();
|
||||||
const int typeFormat =
|
const int typeFormat =
|
||||||
qMax(int(DecimalFormat), model()->data(mi0, TypeFormatRole).toInt());
|
model()->data(mi0, TypeFormatRole).toInt();
|
||||||
const int individualFormat =
|
const int individualFormat =
|
||||||
model()->data(mi0, IndividualFormatRole).toInt();
|
model()->data(mi0, IndividualFormatRole).toInt();
|
||||||
const int effectiveIndividualFormat =
|
const int effectiveIndividualFormat =
|
||||||
@@ -225,12 +225,18 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
|
|
||||||
QMenu typeFormatMenu;
|
QMenu typeFormatMenu;
|
||||||
QList<QAction *> typeFormatActions;
|
QList<QAction *> typeFormatActions;
|
||||||
|
QAction *clearTypeFormatAction = 0;
|
||||||
if (idx.isValid()) {
|
if (idx.isValid()) {
|
||||||
typeFormatMenu.setTitle(
|
typeFormatMenu.setTitle(
|
||||||
tr("Change Format for Type \"%1\"").arg(type));
|
tr("Change Format for Type \"%1\"").arg(type));
|
||||||
if (alternativeFormats.isEmpty()) {
|
if (alternativeFormats.isEmpty()) {
|
||||||
typeFormatMenu.setEnabled(false);
|
typeFormatMenu.setEnabled(false);
|
||||||
} else {
|
} 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) {
|
for (int i = 0; i != alternativeFormats.size(); ++i) {
|
||||||
const QString format = alternativeFormats.at(i);
|
const QString format = alternativeFormats.at(i);
|
||||||
QAction *act = new QAction(format, &typeFormatMenu);
|
QAction *act = new QAction(format, &typeFormatMenu);
|
||||||
@@ -257,6 +263,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
} else {
|
} else {
|
||||||
clearIndividualFormatAction = individualFormatMenu.addAction(tr("Clear"));
|
clearIndividualFormatAction = individualFormatMenu.addAction(tr("Clear"));
|
||||||
clearIndividualFormatAction->setEnabled(individualFormat != -1);
|
clearIndividualFormatAction->setEnabled(individualFormat != -1);
|
||||||
|
clearIndividualFormatAction->setCheckable(true);
|
||||||
|
clearIndividualFormatAction->setChecked(individualFormat == -1);
|
||||||
individualFormatMenu.addSeparator();
|
individualFormatMenu.addSeparator();
|
||||||
for (int i = 0; i != alternativeFormats.size(); ++i) {
|
for (int i = 0; i != alternativeFormats.size(); ++i) {
|
||||||
const QString format = alternativeFormats.at(i);
|
const QString format = alternativeFormats.at(i);
|
||||||
@@ -379,6 +387,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|||||||
m_grabbing = true;
|
m_grabbing = true;
|
||||||
} else if (act == actClearCodeModelSnapshot) {
|
} else if (act == actClearCodeModelSnapshot) {
|
||||||
m_manager->clearCppCodeModelSnapshot();
|
m_manager->clearCppCodeModelSnapshot();
|
||||||
|
} else if (clearTypeFormatAction && act == clearTypeFormatAction) {
|
||||||
|
model()->setData(mi1, -1, TypeFormatRole);
|
||||||
} else if (clearIndividualFormatAction && act == clearIndividualFormatAction) {
|
} else if (clearIndividualFormatAction && act == clearIndividualFormatAction) {
|
||||||
model()->setData(mi1, -1, IndividualFormatRole);
|
model()->setData(mi1, -1, IndividualFormatRole);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user