summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMarkku Heikkila <markku.heikkila@digia.com>2012-05-29 06:42:03 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-06-25 07:40:44 (GMT)
commit053baa018fa6ffe663c646246b8ba2253327cbd6 (patch)
tree45b1ab66e2e92e66ba78ebdb39fcf2bb8571cf72 /tools
parent929b4443d53fcf3a7ad1cb9f3af5569e41ef56f1 (diff)
downloadQt-053baa018fa6ffe663c646246b8ba2253327cbd6.zip
Qt-053baa018fa6ffe663c646246b8ba2253327cbd6.tar.gz
Qt-053baa018fa6ffe663c646246b8ba2253327cbd6.tar.bz2
Fix Assistant crash when closing last tab.
Disable 'Close Tab' action from 'File' menu for last tab to avoid crash. Context menu 'close' actions in "open pages" widget, are already disabled under same conditions. Manually cherry-picked from Qt5: Change I7f285f45: Fix Assistant crash when closing last tab Task-number: QTBUG-23986 Change-Id: I0176451c80f0d25e82c7cd4fb2076c23c9d50128 Reviewed-by: Janne Anttila <janne.anttila@digia.com> Reviewed-by: Karsten Heimrich <karsten.heimrich@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/assistant/tools/assistant/mainwindow.cpp10
-rw-r--r--tools/assistant/tools/assistant/mainwindow.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp
index d054855..c10a481 100644
--- a/tools/assistant/tools/assistant/mainwindow.cpp
+++ b/tools/assistant/tools/assistant/mainwindow.cpp
@@ -440,6 +440,7 @@ void MainWindow::setupActions()
#endif
QMenu *menu = menuBar()->addMenu(tr("&File"));
+ connect(menu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowFileMenu()));
OpenPagesManager * const openPages = OpenPagesManager::instance();
m_newTabAction
@@ -1096,4 +1097,13 @@ void MainWindow::registerDocumentation(const QString &component,
}
}
+void MainWindow::aboutToShowFileMenu()
+{
+ OpenPagesManager * const openPages = OpenPagesManager::instance();
+ if (openPages->pageCount() > 1)
+ m_closeTabAction->setEnabled(true);
+ else
+ m_closeTabAction->setEnabled(false);
+}
+
QT_END_NAMESPACE
diff --git a/tools/assistant/tools/assistant/mainwindow.h b/tools/assistant/tools/assistant/mainwindow.h
index 68b9c2a..bb40d92 100644
--- a/tools/assistant/tools/assistant/mainwindow.h
+++ b/tools/assistant/tools/assistant/mainwindow.h
@@ -136,6 +136,7 @@ private:
private slots:
void showBookmarksDockWidget();
void hideBookmarksDockWidget();
+ void aboutToShowFileMenu();
private:
QWidget *m_bookmarkWidget;