forked from qt-creator/qt-creator
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user