Core: Add ICore::dialogParent() specific for use as dialog parent

Change-Id: I72dca0f95b418a32ac3859f086053f91b9e9ec67
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
hjk
2014-01-06 10:36:40 +01:00
parent 54340fd13b
commit 178bf93d15
2 changed files with 15 additions and 1 deletions

View File

@@ -33,6 +33,7 @@
#include <extensionsystem/pluginmanager.h>
#include <QSysInfo>
#include <QApplication>
/*!
\namespace Core
@@ -170,9 +171,15 @@
Returns the main application window.
For use as dialog parent, and so on.
For dialog parents use \c dialogParent().
*/
/*!
\fn QWidget *ICore::dialogParent()
Returns a widget pointer suitable to use as parent for QDialogs.
*/
/*!
\fn IContext *ICore::currentContextObject()
@@ -451,6 +458,12 @@ QWidget *ICore::mainWindow()
return m_mainwindow;
}
QWidget *ICore::dialogParent()
{
QWidget *active = QApplication::activeModalWidget();
return active ? active : m_mainwindow;
}
QStatusBar *ICore::statusBar()
{
return m_mainwindow->statusBar();