diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 5e7f8059267576ebde3f4a18901648ca355f4638..4158b313d949dfb193b88b6a64eafe2f5f415d94 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -57,6 +57,7 @@ #include <QDockWidget> #include <QVBoxLayout> +#include <QToolButton> using namespace Core; using namespace ProjectExplorer; @@ -113,6 +114,7 @@ public: DebuggerLanguages m_supportedLanguages; QWidget *m_debugToolBar; + QToolButton *m_viewButton; QHBoxLayout *m_debugToolBarLayout; QHash<DebuggerLanguage, Context> m_contextsForLanguage; @@ -500,6 +502,12 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) documentAndRightPane->setStretchFactor(0, 1); documentAndRightPane->setStretchFactor(1, 0); + d->m_viewButton = new QToolButton(); + // FIXME: Use real thing after string freeze. + QString hackyName = QCoreApplication::translate("Core::Internal::MainWindow", "&Views"); + hackyName.replace(QLatin1Char('&'), QString()); + d->m_viewButton->setText(hackyName); + Utils::StyledBar *debugToolBar = new Utils::StyledBar; debugToolBar->setProperty("topBorder", true); QHBoxLayout *debugToolBarLayout = new QHBoxLayout(debugToolBar); @@ -507,6 +515,9 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode) debugToolBarLayout->setSpacing(0); debugToolBarLayout->addWidget(d->m_debugToolBar); debugToolBarLayout->addWidget(new Utils::StyledSeparator); + debugToolBarLayout->addWidget(d->m_viewButton); + + connect(d->m_viewButton, SIGNAL(clicked()), this, SLOT(showViewsMenu())); QDockWidget *dock = new QDockWidget(DebuggerMainWindowPrivate::tr("Debugger Toolbar")); dock->setObjectName(QLatin1String("Debugger Toolbar")); @@ -569,6 +580,13 @@ void DebuggerMainWindow::writeSettings() const settings->endGroup(); } +void DebuggerMainWindow::showViewsMenu() +{ + QMenu *menu = createPopupMenu(); + menu->exec(d->m_viewButton->mapToGlobal(QPoint())); + delete menu; +} + void DebuggerMainWindow::readSettings() { QSettings *settings = ICore::settings(); diff --git a/src/plugins/debugger/debuggermainwindow.h b/src/plugins/debugger/debuggermainwindow.h index 39aaff810d6e0f9bbcbba14803795f6eee76901a..75bad457e95458945c8de810729802bf5a8cd555 100644 --- a/src/plugins/debugger/debuggermainwindow.h +++ b/src/plugins/debugger/debuggermainwindow.h @@ -95,6 +95,9 @@ public: void readSettings(); void writeSettings() const; +private slots: + void showViewsMenu(); + private: friend class Internal::DebuggerMainWindowPrivate; Internal::DebuggerMainWindowPrivate *d; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 4fa1a67cd75e4ddce0768863434aeb254c29a71a..a0a269fcaf35c8ec3a2c869e9bc426dfe0e8342e 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1253,6 +1253,7 @@ public: QIcon m_locationMarkIcon; StatusLabel *m_statusLabel; + QMenu *m_viewMenu; QComboBox *m_threadBox; BaseWindow *m_breakWindow;