From 589cc43ab190b653974700c917f6cf99428f32a4 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Tue, 18 Aug 2009 16:46:33 +0200 Subject: [PATCH] debugger: make context menus of views look more similar --- src/plugins/debugger/breakwindow.cpp | 5 +++-- src/plugins/debugger/moduleswindow.cpp | 12 +++++++---- src/plugins/debugger/registerwindow.cpp | 13 ++++++------ src/plugins/debugger/stackwindow.cpp | 20 ++++++++---------- src/plugins/debugger/threadswindow.cpp | 10 +++++---- src/plugins/debugger/watchwindow.cpp | 28 +++++++++++-------------- 6 files changed, 45 insertions(+), 43 deletions(-) diff --git a/src/plugins/debugger/breakwindow.cpp b/src/plugins/debugger/breakwindow.cpp index 362ba6bc5b2..d26e6ed01f9 100644 --- a/src/plugins/debugger/breakwindow.cpp +++ b/src/plugins/debugger/breakwindow.cpp @@ -196,13 +196,14 @@ void BreakWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(deleteAllAction); menu.addAction(deleteByFileAction); menu.addSeparator(); - menu.addAction(adjustColumnAction); - menu.addAction(alwaysAdjustAction); menu.addAction(synchronizeAction); menu.addSeparator(); menu.addAction(breakAtFunctionAction); menu.addAction(breakAtMainAction); menu.addSeparator(); + menu.addAction(adjustColumnAction); + menu.addAction(alwaysAdjustAction); + menu.addSeparator(); menu.addAction(theDebuggerAction(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); diff --git a/src/plugins/debugger/moduleswindow.cpp b/src/plugins/debugger/moduleswindow.cpp index 927698421d0..330634beea5 100644 --- a/src/plugins/debugger/moduleswindow.cpp +++ b/src/plugins/debugger/moduleswindow.cpp @@ -136,16 +136,20 @@ void ModulesWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addAction(act6); menu.addAction(act7); menu.addSeparator(); - menu.addAction(act1); - menu.addAction(act2); + QAction *actAdjustColumnWidths = + menu.addAction(tr("Adjust column widths to contents")); + QAction *actAlwaysAdjustColumnWidth = + menu.addAction(tr("Always adjust column widths to contents")); + menu.addSeparator(); + menu.addAction(theDebuggerAction(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); if (act == act0) emit reloadModulesRequested(); - else if (act == act1) + else if (act == actAdjustColumnWidths) resizeColumnsToContents(); - else if (act == act2) + else if (act == actAlwaysAdjustColumnWidth) setAlwaysResizeColumnsToContents(!m_alwaysResizeColumnsToContents); else if (act == act3) emit displaySourceRequested(name); diff --git a/src/plugins/debugger/registerwindow.cpp b/src/plugins/debugger/registerwindow.cpp index baf9ff0802c..356556a48fb 100644 --- a/src/plugins/debugger/registerwindow.cpp +++ b/src/plugins/debugger/registerwindow.cpp @@ -161,12 +161,6 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev) { QMenu menu; - QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents")); - QAction *actAlwaysAdjust = - menu.addAction(tr("Always adjust column widths to contents")); - actAlwaysAdjust->setCheckable(true); - actAlwaysAdjust->setChecked(m_alwaysResizeColumnsToContents); - QAction *actReload = menu.addAction(tr("Reload register listing")); QAction *actAlwaysReload = menu.addAction(tr("Always reload register listing")); actAlwaysReload->setCheckable(true); @@ -199,6 +193,13 @@ void RegisterWindow::contextMenuEvent(QContextMenuEvent *ev) act2->setChecked(base == 2); menu.addSeparator(); + QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents")); + QAction *actAlwaysAdjust = + menu.addAction(tr("Always adjust column widths to contents")); + actAlwaysAdjust->setCheckable(true); + actAlwaysAdjust->setChecked(m_alwaysResizeColumnsToContents); + menu.addSeparator(); + menu.addAction(theDebuggerAction(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); diff --git a/src/plugins/debugger/stackwindow.cpp b/src/plugins/debugger/stackwindow.cpp index 1f397b5114f..5450e20f5d7 100644 --- a/src/plugins/debugger/stackwindow.cpp +++ b/src/plugins/debugger/stackwindow.cpp @@ -99,19 +99,8 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev) StackFrame frame = model()->data(idx, Qt::UserRole).value<StackFrame>(); QString address = frame.address; - qDebug() << "RECV: " << frame.toToolTip(); - QMenu menu; - QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents")); - - QAction *actAlwaysAdjust = - menu.addAction(tr("Always adjust column widths to contents")); - actAlwaysAdjust->setCheckable(true); - actAlwaysAdjust->setChecked(m_alwaysResizeColumnsToContents); - - menu.addSeparator(); - menu.addAction(theDebuggerAction(ExpandStack)); QAction *actCopyContents = menu.addAction(tr("Copy contents to clipboard")); @@ -135,6 +124,15 @@ void StackWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addSeparator(); + QAction *actAdjust = menu.addAction(tr("Adjust column widths to contents")); + + QAction *actAlwaysAdjust = + menu.addAction(tr("Always adjust column widths to contents")); + actAlwaysAdjust->setCheckable(true); + actAlwaysAdjust->setChecked(m_alwaysResizeColumnsToContents); + + menu.addSeparator(); + menu.addAction(theDebuggerAction(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); diff --git a/src/plugins/debugger/threadswindow.cpp b/src/plugins/debugger/threadswindow.cpp index fe8f93bad1f..5e199668953 100644 --- a/src/plugins/debugger/threadswindow.cpp +++ b/src/plugins/debugger/threadswindow.cpp @@ -82,12 +82,14 @@ void ThreadsWindow::rowActivated(const QModelIndex &index) void ThreadsWindow::contextMenuEvent(QContextMenuEvent *ev) { QMenu menu; - QAction *act1 = new QAction(tr("Adjust column widths to contents"), &menu); - QAction *act2 = new QAction(tr("Always adjust column widths to contents"), &menu); + QAction *act1 = menu.addAction(tr("Adjust column widths to contents")); + QAction *act2 = menu.addAction(tr("Always adjust column widths to contents")); act2->setCheckable(true); act2->setChecked(m_alwaysResizeColumnsToContents); - menu.addAction(act1); - menu.addAction(act2); + + menu.addSeparator(); + + menu.addAction(theDebuggerAction(SettingsDialog)); QAction *act = menu.exec(ev->globalPos()); diff --git a/src/plugins/debugger/watchwindow.cpp b/src/plugins/debugger/watchwindow.cpp index a41c6721a9a..010308b9864 100644 --- a/src/plugins/debugger/watchwindow.cpp +++ b/src/plugins/debugger/watchwindow.cpp @@ -242,23 +242,12 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) } QMenu menu; - QAction *actAdjustColumnWidths = - new QAction(tr("Adjust column widths to contents"), &menu); - - QAction *actAlwaysAdjustColumnWidth = - new QAction(tr("Always adjust column widths to contents"), &menu); - actAlwaysAdjustColumnWidth->setCheckable(true); - actAlwaysAdjustColumnWidth->setChecked(m_alwaysResizeColumnsToContents); - //QAction *actWatchExpressionInWindow // = theDebuggerAction(WatchExpressionInWindow); //menu.addAction(actWatchExpressionInWindow); - QAction *actInsertNewWatchItem = - new QAction(tr("Insert new watch item"), &menu); - - QAction *actSelectWidgetToWatch = - new QAction(tr("Select widget to watch"), &menu); + QAction *actInsertNewWatchItem = menu.addAction(tr("Insert new watch item")); + QAction *actSelectWidgetToWatch = menu.addAction(tr("Select widget to watch")); QString address = model()->data(mi0, AddressRole).toString(); QAction *actWatchKnownMemory = 0; @@ -268,10 +257,8 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) else actWatchKnownMemory = new QAction(tr("Open memory editor at %1").arg(address), &menu); - - menu.addAction(actAdjustColumnWidths); - menu.addAction(actAlwaysAdjustColumnWidth); menu.addSeparator(); + int atype = (m_type == LocalsType) ? WatchExpression : RemoveWatchExpression; menu.addAction(theDebuggerAction(atype)->updatedAction(exp)); @@ -284,6 +271,15 @@ void WatchWindow::contextMenuEvent(QContextMenuEvent *ev) menu.addSeparator(); menu.addAction(theDebuggerAction(RecheckDebuggingHelpers)); menu.addAction(theDebuggerAction(UseDebuggingHelpers)); + + menu.addSeparator(); + QAction *actAdjustColumnWidths = + menu.addAction(tr("Adjust column widths to contents")); + QAction *actAlwaysAdjustColumnWidth = + menu.addAction(tr("Always adjust column widths to contents")); + actAlwaysAdjustColumnWidth->setCheckable(true); + actAlwaysAdjustColumnWidth->setChecked(m_alwaysResizeColumnsToContents); + menu.addSeparator(); menu.addAction(theDebuggerAction(SettingsDialog)); -- GitLab