QWindow: add windowModality as a Q_PROPERTY()

This also adds the QWindow::windowModalityChanged() signal.

Change-Id: I6e3bc3155d72811d173857c39d36dcb264928334
Reviewed-by: Alan Alpert <alan.alpert@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
Bradley T. Hughes 2012-03-28 11:36:10 +02:00 committed by Qt by Nokia
parent 95d411578d
commit 772d748b95
2 changed files with 23 additions and 8 deletions

View File

@ -363,6 +363,8 @@ bool QWindow::isTopLevel() const
Returns whether the window is modal.
A modal window prevents other windows from getting any input.
\sa QWindow::windowModality
*/
bool QWindow::isModal() const
{
@ -370,26 +372,37 @@ bool QWindow::isModal() const
return d->modality != Qt::NonModal;
}
/*!
Returns the window's modality.
/*! \property QWindow::windowModality
\brief the modality of the window
\sa setWindowModality()
A modal window prevents other windows from receiving input events. Qt
supports two types of modality: Qt::WindowModal and Qt::ApplicationModal.
By default, this property is Qt::NonModal
\sa Qt::WindowModality
*/
Qt::WindowModality QWindow::windowModality() const
{
Q_D(const QWindow);
return d->modality;
}
/*!
Sets the window's modality to \a windowModality.
*/
void QWindow::setWindowModality(Qt::WindowModality windowModality)
void QWindow::setWindowModality(Qt::WindowModality modality)
{
Q_D(QWindow);
d->modality = windowModality;
if (d->modality == modality)
return;
d->modality = modality;
emit windowModalityChanged(modality);
}
/*! \fn void QWindow::windowModalityChanged(Qt::WindowModality windowModality)
This signal is emitted when the Qwindow::windowModality property changes to \a windowModality.
*/
/*!
Sets the window's surface \a format.

View File

@ -85,6 +85,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_DECLARE_PRIVATE(QWindow)
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality NOTIFY windowModalityChanged)
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
@ -255,6 +256,7 @@ public Q_SLOTS:
Q_SIGNALS:
void backBufferReady();
void screenChanged(QScreen *screen);
void windowModalityChanged(Qt::WindowModality windowModality);
void xChanged(int arg);
void yChanged(int arg);