Rename all QWindow properties that have "window" in them
windowTitle, windowModality, windowIcon and so on are named that way to be similar to the ones in QWidget. However QQuickWindow inherits all of the declared properties, and we would like to have shorter property names in QML. If you are working with a Window then it's obvious the title property is the window title. Unfortunately, there must be patches in many other modules which depend on this one. In order to avoid the need to merge them all at the same time, there is also patch https://codereview.qt-project.org/#change,39001 which temporarily adds backwards-compatible accessors, which can be removed after the other modules are able to build without them. We should not rename windowState to state, because in QML, state usually drives the state machine for animation transitions etc. (although QWindow is not an Item, a user might get confused about it). Related patches are https://codereview.qt-project.org/#change,39001 https://codereview.qt-project.org/#change,37764 https://codereview.qt-project.org/#change,37765 https://codereview.qt-project.org/#change,37766 https://codereview.qt-project.org/#change,37762 Change-Id: Ie4424ec15fbdef6b29b137f90a2ae33f173edd21 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
parent
a454ccb89e
commit
cd34da5426
@ -61,7 +61,7 @@ private:
|
|||||||
//! [6]
|
//! [6]
|
||||||
AnalogClockWindow::AnalogClockWindow()
|
AnalogClockWindow::AnalogClockWindow()
|
||||||
{
|
{
|
||||||
setWindowTitle("Analog Clock");
|
setTitle("Analog Clock");
|
||||||
resize(200, 200);
|
resize(200, 200);
|
||||||
|
|
||||||
m_timerId = startTimer(1000);
|
m_timerId = startTimer(1000);
|
||||||
|
@ -63,7 +63,7 @@ HelloWindow::HelloWindow(const QSharedPointer<Renderer> &renderer)
|
|||||||
: m_colorIndex(0), m_renderer(renderer), m_timer(0)
|
: m_colorIndex(0), m_renderer(renderer), m_timer(0)
|
||||||
{
|
{
|
||||||
setSurfaceType(QWindow::OpenGLSurface);
|
setSurfaceType(QWindow::OpenGLSurface);
|
||||||
setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
setFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||||
|
|
||||||
setGeometry(QRect(10, 10, 640, 480));
|
setGeometry(QRect(10, 10, 640, 480));
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
HelloWindow *windowA = new HelloWindow(rendererA);
|
HelloWindow *windowA = new HelloWindow(rendererA);
|
||||||
windowA->setGeometry(QRect(center, windowSize).translated(-windowSize.width() - delta / 2, 0));
|
windowA->setGeometry(QRect(center, windowSize).translated(-windowSize.width() - delta / 2, 0));
|
||||||
windowA->setWindowTitle(QLatin1String("Thread A - Context A"));
|
windowA->setTitle(QLatin1String("Thread A - Context A"));
|
||||||
windowA->setVisible(true);
|
windowA->setVisible(true);
|
||||||
windows.prepend(windowA);
|
windows.prepend(windowA);
|
||||||
|
|
||||||
@ -85,13 +85,13 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
HelloWindow *windowB = new HelloWindow(rendererA);
|
HelloWindow *windowB = new HelloWindow(rendererA);
|
||||||
windowB->setGeometry(QRect(center, windowSize).translated(delta / 2, 0));
|
windowB->setGeometry(QRect(center, windowSize).translated(delta / 2, 0));
|
||||||
windowB->setWindowTitle(QLatin1String("Thread A - Context A"));
|
windowB->setTitle(QLatin1String("Thread A - Context A"));
|
||||||
windowB->setVisible(true);
|
windowB->setVisible(true);
|
||||||
windows.prepend(windowB);
|
windows.prepend(windowB);
|
||||||
|
|
||||||
HelloWindow *windowC = new HelloWindow(rendererB);
|
HelloWindow *windowC = new HelloWindow(rendererB);
|
||||||
windowC->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, windowSize.height() + delta));
|
windowC->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, windowSize.height() + delta));
|
||||||
windowC->setWindowTitle(QLatin1String("Thread B - Context B"));
|
windowC->setTitle(QLatin1String("Thread B - Context B"));
|
||||||
windowC->setVisible(true);
|
windowC->setVisible(true);
|
||||||
windows.prepend(windowC);
|
windows.prepend(windowC);
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ int main(int argc, char **argv)
|
|||||||
window->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, -windowSize.height() / 2));
|
window->setGeometry(QRect(center, windowSize).translated(-windowSize.width() / 2, -windowSize.height() / 2));
|
||||||
|
|
||||||
QChar id = QChar('B' + i);
|
QChar id = QChar('B' + i);
|
||||||
window->setWindowTitle(QLatin1String("Thread ") + id + QLatin1String(" - Context ") + id);
|
window->setTitle(QLatin1String("Thread ") + id + QLatin1String(" - Context ") + id);
|
||||||
window->setVisible(true);
|
window->setVisible(true);
|
||||||
windows.prepend(window);
|
windows.prepend(window);
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ PaintedWindow::PaintedWindow()
|
|||||||
format.setSamples(4);
|
format.setSamples(4);
|
||||||
|
|
||||||
setSurfaceType(QWindow::OpenGLSurface);
|
setSurfaceType(QWindow::OpenGLSurface);
|
||||||
setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
setFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||||
setFormat(format);
|
setFormat(format);
|
||||||
|
|
||||||
create();
|
create();
|
||||||
@ -70,12 +70,12 @@ PaintedWindow::PaintedWindow()
|
|||||||
m_animation->setEndValue(qreal(1));
|
m_animation->setEndValue(qreal(1));
|
||||||
m_animation->setDuration(500);
|
m_animation->setDuration(500);
|
||||||
|
|
||||||
requestWindowOrientation(Qt::PortraitOrientation);
|
requestOrientation(Qt::PortraitOrientation);
|
||||||
|
|
||||||
QRect screenGeometry = screen()->availableGeometry();
|
QRect screenGeometry = screen()->availableGeometry();
|
||||||
|
|
||||||
QPoint center = screenGeometry.center();
|
QPoint center = screenGeometry.center();
|
||||||
QRect windowRect = screen()->isLandscape(windowOrientation()) ? QRect(0, 0, 640, 480) : QRect(0, 0, 480, 640);
|
QRect windowRect = screen()->isLandscape(orientation()) ? QRect(0, 0, 640, 480) : QRect(0, 0, 480, 640);
|
||||||
setGeometry(QRect(center - windowRect.center(), windowRect.size()));
|
setGeometry(QRect(center - windowRect.center(), windowRect.size()));
|
||||||
|
|
||||||
m_rotation = 0;
|
m_rotation = 0;
|
||||||
@ -142,13 +142,13 @@ void PaintedWindow::orientationChanged(Qt::ScreenOrientation newOrientation)
|
|||||||
|
|
||||||
QPainter p;
|
QPainter p;
|
||||||
p.begin(&m_prevImage);
|
p.begin(&m_prevImage);
|
||||||
p.setTransform(screen()->transformBetween(contentOrientation(), windowOrientation(), rect));
|
p.setTransform(screen()->transformBetween(contentOrientation(), orientation(), rect));
|
||||||
paint(&p, screen()->mapBetween(contentOrientation(), windowOrientation(), rect));
|
paint(&p, screen()->mapBetween(contentOrientation(), orientation(), rect));
|
||||||
p.end();
|
p.end();
|
||||||
|
|
||||||
p.begin(&m_nextImage);
|
p.begin(&m_nextImage);
|
||||||
p.setTransform(screen()->transformBetween(newOrientation, windowOrientation(), rect));
|
p.setTransform(screen()->transformBetween(newOrientation, orientation(), rect));
|
||||||
paint(&p, screen()->mapBetween(newOrientation, windowOrientation(), rect));
|
paint(&p, screen()->mapBetween(newOrientation, orientation(), rect));
|
||||||
p.end();
|
p.end();
|
||||||
|
|
||||||
m_deltaRotation = screen()->angleBetween(newOrientation, contentOrientation());
|
m_deltaRotation = screen()->angleBetween(newOrientation, contentOrientation());
|
||||||
@ -207,9 +207,9 @@ void PaintedWindow::paint()
|
|||||||
painter.setOpacity(m_rotation);
|
painter.setOpacity(m_rotation);
|
||||||
painter.drawImage(0, 0, m_nextImage);
|
painter.drawImage(0, 0, m_nextImage);
|
||||||
} else {
|
} else {
|
||||||
QRect mapped = screen()->mapBetween(contentOrientation(), windowOrientation(), rect);
|
QRect mapped = screen()->mapBetween(contentOrientation(), orientation(), rect);
|
||||||
|
|
||||||
painter.setTransform(screen()->transformBetween(contentOrientation(), windowOrientation(), rect));
|
painter.setTransform(screen()->transformBetween(contentOrientation(), orientation(), rect));
|
||||||
paint(&painter, mapped);
|
paint(&painter, mapped);
|
||||||
painter.end();
|
painter.end();
|
||||||
}
|
}
|
||||||
|
@ -53,14 +53,14 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
Window a;
|
Window a;
|
||||||
a.setFramePos(QPoint(10, 10));
|
a.setFramePos(QPoint(10, 10));
|
||||||
a.setWindowTitle(QStringLiteral("Window A"));
|
a.setTitle(QStringLiteral("Window A"));
|
||||||
a.setObjectName(a.windowTitle());
|
a.setObjectName(a.title());
|
||||||
a.setVisible(true);
|
a.setVisible(true);
|
||||||
|
|
||||||
Window b;
|
Window b;
|
||||||
b.setFramePos(QPoint(100, 100));
|
b.setFramePos(QPoint(100, 100));
|
||||||
b.setWindowTitle(QStringLiteral("Window B"));
|
b.setTitle(QStringLiteral("Window B"));
|
||||||
b.setObjectName(b.windowTitle());
|
b.setObjectName(b.title());
|
||||||
b.setVisible(true);
|
b.setVisible(true);
|
||||||
|
|
||||||
Window child(&b);
|
Window child(&b);
|
||||||
@ -79,8 +79,8 @@ int main(int argc, char **argv)
|
|||||||
geometry.moveCenter(screen->availableGeometry().center());
|
geometry.moveCenter(screen->availableGeometry().center());
|
||||||
window->setGeometry(geometry);
|
window->setGeometry(geometry);
|
||||||
window->setVisible(true);
|
window->setVisible(true);
|
||||||
window->setWindowTitle(screen->name());
|
window->setTitle(screen->name());
|
||||||
window->setObjectName(window->windowTitle());
|
window->setObjectName(window->title());
|
||||||
windows.push_back(window);
|
windows.push_back(window);
|
||||||
}
|
}
|
||||||
return app.exec();
|
return app.exec();
|
||||||
|
@ -73,7 +73,7 @@ void Window::initialize()
|
|||||||
if (parent())
|
if (parent())
|
||||||
setGeometry(QRect(160, 120, 320, 240));
|
setGeometry(QRect(160, 120, 320, 240));
|
||||||
else {
|
else {
|
||||||
setWindowFlags(windowFlags() | Qt::WindowTitleHint | Qt::WindowSystemMenuHint
|
setFlags(flags() | Qt::WindowTitleHint | Qt::WindowSystemMenuHint
|
||||||
| Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
| Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||||
const QSize baseSize = QSize(640, 480);
|
const QSize baseSize = QSize(640, 480);
|
||||||
setGeometry(QRect(geometry().topLeft(), baseSize));
|
setGeometry(QRect(geometry().topLeft(), baseSize));
|
||||||
|
@ -201,7 +201,7 @@ static QObjectList topLevelObjects()
|
|||||||
const QWindowList tlw(QGuiApplication::topLevelWindows());
|
const QWindowList tlw(QGuiApplication::topLevelWindows());
|
||||||
for (int i = 0; i < tlw.count(); ++i) {
|
for (int i = 0; i < tlw.count(); ++i) {
|
||||||
QWindow *w = tlw.at(i);
|
QWindow *w = tlw.at(i);
|
||||||
if (w->windowType() != Qt::Popup && w->windowType() != Qt::Desktop) {
|
if (w->type() != Qt::Popup && w->type() != Qt::Desktop) {
|
||||||
if (QAccessibleInterface *root = w->accessibleRoot()) {
|
if (QAccessibleInterface *root = w->accessibleRoot()) {
|
||||||
if (root->object())
|
if (root->object())
|
||||||
list.append(root->object());
|
list.append(root->object());
|
||||||
|
@ -422,14 +422,14 @@ QString QGuiApplication::applicationDisplayName()
|
|||||||
visible, this function returns zero.
|
visible, this function returns zero.
|
||||||
|
|
||||||
A modal window is a window which has its
|
A modal window is a window which has its
|
||||||
\l{QWindow::windowModality}{windowModality} property set to Qt::WindowModal
|
\l{QWindow::modality}{modality} property set to Qt::WindowModal
|
||||||
or Qt::ApplicationModal. A modal window must be closed before the user can
|
or Qt::ApplicationModal. A modal window must be closed before the user can
|
||||||
continue with other parts of the program.
|
continue with other parts of the program.
|
||||||
|
|
||||||
Modal window are organized in a stack. This function returns the modal
|
Modal window are organized in a stack. This function returns the modal
|
||||||
window at the top of the stack.
|
window at the top of the stack.
|
||||||
|
|
||||||
\sa Qt::WindowModality, QWindow::setWindowModality()
|
\sa Qt::WindowModality, QWindow::setModality()
|
||||||
*/
|
*/
|
||||||
QWindow *QGuiApplication::modalWindow()
|
QWindow *QGuiApplication::modalWindow()
|
||||||
{
|
{
|
||||||
@ -441,7 +441,7 @@ QWindow *QGuiApplication::modalWindow()
|
|||||||
void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window)
|
void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window)
|
||||||
{
|
{
|
||||||
bool shouldBeBlocked = false;
|
bool shouldBeBlocked = false;
|
||||||
if ((window->windowType() & Qt::Popup) != Qt::Popup && !self->modalWindowList.isEmpty())
|
if ((window->type() & Qt::Popup) != Qt::Popup && !self->modalWindowList.isEmpty())
|
||||||
shouldBeBlocked = self->isWindowBlocked(window);
|
shouldBeBlocked = self->isWindowBlocked(window);
|
||||||
|
|
||||||
if (shouldBeBlocked != window->d_func()->blockedByModalWindow) {
|
if (shouldBeBlocked != window->d_func()->blockedByModalWindow) {
|
||||||
@ -457,7 +457,7 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
|
|||||||
self->modalWindowList.prepend(modal);
|
self->modalWindowList.prepend(modal);
|
||||||
|
|
||||||
// Send leave for currently entered window if it should be blocked
|
// Send leave for currently entered window if it should be blocked
|
||||||
if (currentMouseWindow && (currentMouseWindow->windowType() & Qt::Popup) != Qt::Popup) {
|
if (currentMouseWindow && (currentMouseWindow->type() & Qt::Popup) != Qt::Popup) {
|
||||||
bool shouldBeBlocked = self->isWindowBlocked(currentMouseWindow);
|
bool shouldBeBlocked = self->isWindowBlocked(currentMouseWindow);
|
||||||
if (shouldBeBlocked) {
|
if (shouldBeBlocked) {
|
||||||
// Remove the new window from modalWindowList temporarily so leave can go through
|
// Remove the new window from modalWindowList temporarily so leave can go through
|
||||||
@ -525,7 +525,7 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::WindowModality windowModality = modalWindow->windowModality();
|
Qt::WindowModality windowModality = modalWindow->modality();
|
||||||
switch (windowModality) {
|
switch (windowModality) {
|
||||||
case Qt::ApplicationModal:
|
case Qt::ApplicationModal:
|
||||||
{
|
{
|
||||||
@ -2359,7 +2359,7 @@ static inline void applyCursor(const QList<QWindow *> &l, const QCursor &c)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < l.size(); ++i) {
|
for (int i = 0; i < l.size(); ++i) {
|
||||||
QWindow *w = l.at(i);
|
QWindow *w = l.at(i);
|
||||||
if (w->handle() && w->windowType() != Qt::Desktop)
|
if (w->handle() && w->type() != Qt::Desktop)
|
||||||
applyCursor(w, c);
|
applyCursor(w, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2368,7 +2368,7 @@ static inline void applyWindowCursor(const QList<QWindow *> &l)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < l.size(); ++i) {
|
for (int i = 0; i < l.size(); ++i) {
|
||||||
QWindow *w = l.at(i);
|
QWindow *w = l.at(i);
|
||||||
if (w->handle() && w->windowType() != Qt::Desktop)
|
if (w->handle() && w->type() != Qt::Desktop)
|
||||||
applyCursor(w, w->cursor());
|
applyCursor(w, w->cursor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -411,7 +411,7 @@ bool QWindow::isTopLevel() const
|
|||||||
|
|
||||||
A modal window prevents other windows from getting any input.
|
A modal window prevents other windows from getting any input.
|
||||||
|
|
||||||
\sa QWindow::windowModality
|
\sa QWindow::modality
|
||||||
*/
|
*/
|
||||||
bool QWindow::isModal() const
|
bool QWindow::isModal() const
|
||||||
{
|
{
|
||||||
@ -419,7 +419,7 @@ bool QWindow::isModal() const
|
|||||||
return d->modality != Qt::NonModal;
|
return d->modality != Qt::NonModal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \property QWindow::windowModality
|
/*! \property QWindow::modality
|
||||||
\brief the modality of the window
|
\brief the modality of the window
|
||||||
|
|
||||||
A modal window prevents other windows from receiving input events. Qt
|
A modal window prevents other windows from receiving input events. Qt
|
||||||
@ -430,24 +430,24 @@ bool QWindow::isModal() const
|
|||||||
\sa Qt::WindowModality
|
\sa Qt::WindowModality
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Qt::WindowModality QWindow::windowModality() const
|
Qt::WindowModality QWindow::modality() const
|
||||||
{
|
{
|
||||||
Q_D(const QWindow);
|
Q_D(const QWindow);
|
||||||
return d->modality;
|
return d->modality;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWindow::setWindowModality(Qt::WindowModality modality)
|
void QWindow::setModality(Qt::WindowModality modality)
|
||||||
{
|
{
|
||||||
Q_D(QWindow);
|
Q_D(QWindow);
|
||||||
if (d->modality == modality)
|
if (d->modality == modality)
|
||||||
return;
|
return;
|
||||||
d->modality = modality;
|
d->modality = modality;
|
||||||
emit windowModalityChanged(modality);
|
emit modalityChanged(modality);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \fn void QWindow::windowModalityChanged(Qt::WindowModality windowModality)
|
/*! \fn void QWindow::modalityChanged(Qt::WindowModality modality)
|
||||||
|
|
||||||
This signal is emitted when the Qwindow::windowModality property changes to \a windowModality.
|
This signal is emitted when the Qwindow::modality property changes to \a modality.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -510,15 +510,17 @@ QSurfaceFormat QWindow::format() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the window flags of the window to \a flags.
|
\property QWindow::flags
|
||||||
|
\brief the window flags of the window
|
||||||
|
|
||||||
The window flags control the window's appearance in the windowing system,
|
The window flags control the window's appearance in the windowing system,
|
||||||
whether it's a dialog, popup, or a regular window, and whether it should
|
whether it's a dialog, popup, or a regular window, and whether it should
|
||||||
have a title bar, etc.
|
have a title bar, etc.
|
||||||
|
|
||||||
\sa windowFlags()
|
The actual window flags might differ from the flags set with setFlags()
|
||||||
|
if the requested flags could not be fulfilled.
|
||||||
*/
|
*/
|
||||||
void QWindow::setWindowFlags(Qt::WindowFlags flags)
|
void QWindow::setFlags(Qt::WindowFlags flags)
|
||||||
{
|
{
|
||||||
Q_D(QWindow);
|
Q_D(QWindow);
|
||||||
if (d->platformWindow)
|
if (d->platformWindow)
|
||||||
@ -526,15 +528,7 @@ void QWindow::setWindowFlags(Qt::WindowFlags flags)
|
|||||||
d->windowFlags = flags;
|
d->windowFlags = flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
Qt::WindowFlags QWindow::flags() const
|
||||||
Returns the window flags of the window.
|
|
||||||
|
|
||||||
This might differ from the flags set with setWindowFlags() if the
|
|
||||||
requested flags could not be fulfilled.
|
|
||||||
|
|
||||||
\sa setWindowFlags()
|
|
||||||
*/
|
|
||||||
Qt::WindowFlags QWindow::windowFlags() const
|
|
||||||
{
|
{
|
||||||
Q_D(const QWindow);
|
Q_D(const QWindow);
|
||||||
return d->windowFlags;
|
return d->windowFlags;
|
||||||
@ -546,16 +540,16 @@ Qt::WindowFlags QWindow::windowFlags() const
|
|||||||
This returns the part of the window flags that represents
|
This returns the part of the window flags that represents
|
||||||
whether the window is a dialog, tooltip, popup, regular window, etc.
|
whether the window is a dialog, tooltip, popup, regular window, etc.
|
||||||
|
|
||||||
\sa windowFlags(), setWindowFlags()
|
\sa flags(), setFlags()
|
||||||
*/
|
*/
|
||||||
Qt::WindowType QWindow::windowType() const
|
Qt::WindowType QWindow::type() const
|
||||||
{
|
{
|
||||||
Q_D(const QWindow);
|
Q_D(const QWindow);
|
||||||
return static_cast<Qt::WindowType>(int(d->windowFlags & Qt::WindowType_Mask));
|
return static_cast<Qt::WindowType>(int(d->windowFlags & Qt::WindowType_Mask));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\property QWindow::windowTitle
|
\property QWindow::title
|
||||||
\brief the window's title in the windowing system
|
\brief the window's title in the windowing system
|
||||||
|
|
||||||
The window title might appear in the title area of the window decorations,
|
The window title might appear in the title area of the window decorations,
|
||||||
@ -563,9 +557,9 @@ Qt::WindowType QWindow::windowType() const
|
|||||||
be used by the windowing system to identify the window in other contexts,
|
be used by the windowing system to identify the window in other contexts,
|
||||||
such as in the task switcher.
|
such as in the task switcher.
|
||||||
|
|
||||||
\sa windowFlags()
|
\sa flags()
|
||||||
*/
|
*/
|
||||||
void QWindow::setWindowTitle(const QString &title)
|
void QWindow::setTitle(const QString &title)
|
||||||
{
|
{
|
||||||
Q_D(QWindow);
|
Q_D(QWindow);
|
||||||
d->windowTitle = title;
|
d->windowTitle = title;
|
||||||
@ -573,20 +567,20 @@ void QWindow::setWindowTitle(const QString &title)
|
|||||||
d->platformWindow->setWindowTitle(title);
|
d->platformWindow->setWindowTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QWindow::windowTitle() const
|
QString QWindow::title() const
|
||||||
{
|
{
|
||||||
Q_D(const QWindow);
|
Q_D(const QWindow);
|
||||||
return d->windowTitle;
|
return d->windowTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\property QWindow::windowFilePath
|
\brief set the file name this window is representing.
|
||||||
\brief the file name this window is representing.
|
|
||||||
|
|
||||||
This property might be used by the windowing system to display the file
|
The windowing system might use \a filePath to display the
|
||||||
path of the document this window is representing in the tile bar.
|
path of the document this window is representing in the tile bar.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
void QWindow::setWindowFilePath(const QString &filePath)
|
void QWindow::setFilePath(const QString &filePath)
|
||||||
{
|
{
|
||||||
Q_D(QWindow);
|
Q_D(QWindow);
|
||||||
d->windowFilePath = filePath;
|
d->windowFilePath = filePath;
|
||||||
@ -594,20 +588,24 @@ void QWindow::setWindowFilePath(const QString &filePath)
|
|||||||
d->platformWindow->setWindowFilePath(filePath);
|
d->platformWindow->setWindowFilePath(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QWindow::windowFilePath() const
|
/*!
|
||||||
|
\brief the file name this window is representing.
|
||||||
|
|
||||||
|
\sa setFilePath()
|
||||||
|
*/
|
||||||
|
QString QWindow::filePath() const
|
||||||
{
|
{
|
||||||
Q_D(const QWindow);
|
Q_D(const QWindow);
|
||||||
return d->windowFilePath;
|
return d->windowFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\property QWindow::windowIcon
|
\brief set the window's \a icon in the windowing system
|
||||||
\brief the window's icon in the windowing system
|
|
||||||
|
|
||||||
The window icon might be used by the windowing system for example to
|
The window icon might be used by the windowing system for example to
|
||||||
decorate the window, and/or in the task switcher.
|
decorate the window, and/or in the task switcher.
|
||||||
*/
|
*/
|
||||||
void QWindow::setWindowIcon(const QIcon &icon)
|
void QWindow::setIcon(const QIcon &icon)
|
||||||
{
|
{
|
||||||
Q_D(QWindow);
|
Q_D(QWindow);
|
||||||
d->windowIcon = icon;
|
d->windowIcon = icon;
|
||||||
@ -615,7 +613,12 @@ void QWindow::setWindowIcon(const QIcon &icon)
|
|||||||
d->platformWindow->setWindowIcon(icon);
|
d->platformWindow->setWindowIcon(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
QIcon QWindow::windowIcon() const
|
/*!
|
||||||
|
\brief set the window's icon in the windowing system
|
||||||
|
|
||||||
|
\sa setIcon()
|
||||||
|
*/
|
||||||
|
QIcon QWindow::icon() const
|
||||||
{
|
{
|
||||||
Q_D(const QWindow);
|
Q_D(const QWindow);
|
||||||
return d->windowIcon;
|
return d->windowIcon;
|
||||||
@ -668,7 +671,7 @@ void QWindow::setOpacity(qreal level)
|
|||||||
|
|
||||||
\sa isActive(), QGuiApplication::focusWindow()
|
\sa isActive(), QGuiApplication::focusWindow()
|
||||||
*/
|
*/
|
||||||
void QWindow::requestActivateWindow()
|
void QWindow::requestActivate()
|
||||||
{
|
{
|
||||||
Q_D(QWindow);
|
Q_D(QWindow);
|
||||||
if (d->platformWindow)
|
if (d->platformWindow)
|
||||||
@ -741,7 +744,7 @@ bool QWindow::isActive() const
|
|||||||
|
|
||||||
The default value is Qt::PrimaryOrientation
|
The default value is Qt::PrimaryOrientation
|
||||||
|
|
||||||
\sa requestWindowOrientation(), QScreen::orientation()
|
\sa requestOrientation(), QScreen::orientation()
|
||||||
*/
|
*/
|
||||||
void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation)
|
void QWindow::reportContentOrientationChange(Qt::ScreenOrientation orientation)
|
||||||
{
|
{
|
||||||
@ -774,12 +777,12 @@ Qt::ScreenOrientation QWindow::contentOrientation() const
|
|||||||
on a device that only handles landscape buffers, typically a desktop
|
on a device that only handles landscape buffers, typically a desktop
|
||||||
system).
|
system).
|
||||||
|
|
||||||
If the return value is false, call windowOrientation() to get the actual
|
If the return value is false, call \l orientation() to get the actual
|
||||||
supported orientation.
|
supported orientation.
|
||||||
|
|
||||||
\sa windowOrientation(), reportContentOrientationChange(), QScreen::orientation()
|
\sa orientation(), reportContentOrientationChange(), QScreen::orientation()
|
||||||
*/
|
*/
|
||||||
bool QWindow::requestWindowOrientation(Qt::ScreenOrientation orientation)
|
bool QWindow::requestOrientation(Qt::ScreenOrientation orientation)
|
||||||
{
|
{
|
||||||
Q_D(QWindow);
|
Q_D(QWindow);
|
||||||
if (!d->platformWindow)
|
if (!d->platformWindow)
|
||||||
@ -794,34 +797,23 @@ bool QWindow::requestWindowOrientation(Qt::ScreenOrientation orientation)
|
|||||||
|
|
||||||
The default value is Qt::PrimaryOrientation.
|
The default value is Qt::PrimaryOrientation.
|
||||||
|
|
||||||
\sa requestWindowOrientation()
|
\sa requestOrientation()
|
||||||
*/
|
*/
|
||||||
Qt::ScreenOrientation QWindow::windowOrientation() const
|
Qt::ScreenOrientation QWindow::orientation() const
|
||||||
{
|
{
|
||||||
Q_D(const QWindow);
|
Q_D(const QWindow);
|
||||||
return d->windowOrientation;
|
return d->windowOrientation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the window state.
|
\brief set the screen-occupation state of the window
|
||||||
|
|
||||||
\sa setWindowState()
|
The window \a state represents whether the window appears in the
|
||||||
*/
|
|
||||||
Qt::WindowState QWindow::windowState() const
|
|
||||||
{
|
|
||||||
Q_D(const QWindow);
|
|
||||||
return d->windowState;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the desired window \a state.
|
|
||||||
|
|
||||||
The window state represents whether the window appears in the
|
|
||||||
windowing system as maximized, minimized, fullscreen, or normal.
|
windowing system as maximized, minimized, fullscreen, or normal.
|
||||||
|
|
||||||
The enum value Qt::WindowActive is not an accepted parameter.
|
The enum value Qt::WindowActive is not an accepted parameter.
|
||||||
|
|
||||||
\sa windowState(), showNormal(), showFullScreen(), showMinimized(), showMaximized()
|
\sa showNormal(), showFullScreen(), showMinimized(), showMaximized()
|
||||||
*/
|
*/
|
||||||
void QWindow::setWindowState(Qt::WindowState state)
|
void QWindow::setWindowState(Qt::WindowState state)
|
||||||
{
|
{
|
||||||
@ -834,8 +826,28 @@ void QWindow::setWindowState(Qt::WindowState state)
|
|||||||
if (d->platformWindow)
|
if (d->platformWindow)
|
||||||
d->platformWindow->setWindowState(state);
|
d->platformWindow->setWindowState(state);
|
||||||
d->windowState = state;
|
d->windowState = state;
|
||||||
|
emit windowStateChanged(d->windowState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief the screen-occupation state of the window
|
||||||
|
|
||||||
|
\sa setWindowState()
|
||||||
|
*/
|
||||||
|
Qt::WindowState QWindow::windowState() const
|
||||||
|
{
|
||||||
|
Q_D(const QWindow);
|
||||||
|
return d->windowState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\fn QWindow::windowStateChanged(Qt::WindowState windowState)
|
||||||
|
|
||||||
|
This signal is emitted when the \a windowState changes, either
|
||||||
|
by being set explicitly with setWindowState(), or automatically when
|
||||||
|
the user clicks one of the titlebar buttons or by other means.
|
||||||
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets the transient \a parent
|
Sets the transient \a parent
|
||||||
|
|
||||||
@ -1463,7 +1475,7 @@ void QWindow::showFullScreen()
|
|||||||
{
|
{
|
||||||
setWindowState(Qt::WindowFullScreen);
|
setWindowState(Qt::WindowFullScreen);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
requestActivateWindow();
|
requestActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1671,6 +1683,11 @@ bool QWindow::event(QEvent *ev)
|
|||||||
hideEvent(static_cast<QHideEvent *>(ev));
|
hideEvent(static_cast<QHideEvent *>(ev));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case QEvent::WindowStateChange: {
|
||||||
|
Q_D(QWindow);
|
||||||
|
emit windowStateChanged(d->windowState);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_TABLETEVENT
|
#ifndef QT_NO_TABLETEVENT
|
||||||
case QEvent::TabletPress:
|
case QEvent::TabletPress:
|
||||||
case QEvent::TabletMove:
|
case QEvent::TabletMove:
|
||||||
@ -1882,17 +1899,16 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef QT_NO_CURSOR
|
||||||
/*!
|
/*!
|
||||||
\property QWindow::cursor
|
\brief set the cursor shape for this window
|
||||||
\brief the cursor shape for this window
|
|
||||||
|
|
||||||
The mouse cursor will assume this shape when it is over this
|
The mouse \a cursor will assume this shape when it is over this
|
||||||
window, unless an override cursor is set.
|
window, unless an override cursor is set.
|
||||||
See the \l{Qt::CursorShape}{list of predefined cursor objects} for a
|
See the \l{Qt::CursorShape}{list of predefined cursor objects} for a
|
||||||
range of useful shapes.
|
range of useful shapes.
|
||||||
|
|
||||||
By default, this property contains a cursor with the Qt::ArrowCursor
|
By default, the cursor has the Qt::ArrowCursor shape.
|
||||||
shape.
|
|
||||||
|
|
||||||
Some underlying window implementations will reset the cursor if it
|
Some underlying window implementations will reset the cursor if it
|
||||||
leaves a window even if the mouse is grabbed. If you want to have
|
leaves a window even if the mouse is grabbed. If you want to have
|
||||||
@ -1901,14 +1917,6 @@ void QWindowPrivate::maybeQuitOnLastWindowClosed()
|
|||||||
|
|
||||||
\sa QGuiApplication::setOverrideCursor()
|
\sa QGuiApplication::setOverrideCursor()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
QCursor QWindow::cursor() const
|
|
||||||
{
|
|
||||||
Q_D(const QWindow);
|
|
||||||
return d->cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
void QWindow::setCursor(const QCursor &cursor)
|
void QWindow::setCursor(const QCursor &cursor)
|
||||||
{
|
{
|
||||||
Q_D(QWindow);
|
Q_D(QWindow);
|
||||||
@ -1929,6 +1937,17 @@ void QWindow::unsetCursor()
|
|||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief the cursor shape for this window
|
||||||
|
|
||||||
|
\sa setCursor(), unsetCursor()
|
||||||
|
*/
|
||||||
|
QCursor QWindow::cursor() const
|
||||||
|
{
|
||||||
|
Q_D(const QWindow);
|
||||||
|
return d->cursor;
|
||||||
|
}
|
||||||
|
|
||||||
void QWindowPrivate::applyCursor()
|
void QWindowPrivate::applyCursor()
|
||||||
{
|
{
|
||||||
Q_Q(QWindow);
|
Q_Q(QWindow);
|
||||||
@ -1940,6 +1959,6 @@ void QWindowPrivate::applyCursor()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif // QT_NO_CURSOR
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -93,10 +93,15 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_DECLARE_PRIVATE(QWindow)
|
Q_DECLARE_PRIVATE(QWindow)
|
||||||
|
|
||||||
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
|
// All properties which are declared here are inherited by QQuickWindow and therefore available in QML.
|
||||||
Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath)
|
// So please think carefully about what it does to the QML namespace if you add any new ones,
|
||||||
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon)
|
// particularly the possible meanings these names might have in any specializations of Window.
|
||||||
Q_PROPERTY(Qt::WindowModality windowModality READ windowModality WRITE setWindowModality NOTIFY windowModalityChanged)
|
// For example "state" (meaning windowState) is not a good property to declare, because it has
|
||||||
|
// a different meaning in QQuickItem, and users will tend to assume it is the same for Window.
|
||||||
|
|
||||||
|
Q_PROPERTY(QString title READ title WRITE setTitle)
|
||||||
|
Q_PROPERTY(Qt::WindowModality modality READ modality WRITE setModality NOTIFY modalityChanged)
|
||||||
|
Q_PROPERTY(Qt::WindowFlags flags READ flags WRITE setFlags)
|
||||||
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
|
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
|
||||||
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
|
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
|
||||||
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
|
Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged)
|
||||||
@ -110,9 +115,6 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
|
|||||||
Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged)
|
Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged)
|
||||||
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
|
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
|
||||||
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
|
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
|
||||||
#ifndef QT_NO_CURSOR
|
|
||||||
Q_PROPERTY(QCursor cursor READ cursor WRITE setCursor RESET unsetCursor)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -135,29 +137,29 @@ public:
|
|||||||
bool isTopLevel() const;
|
bool isTopLevel() const;
|
||||||
|
|
||||||
bool isModal() const;
|
bool isModal() const;
|
||||||
Qt::WindowModality windowModality() const;
|
Qt::WindowModality modality() const;
|
||||||
void setWindowModality(Qt::WindowModality windowModality);
|
void setModality(Qt::WindowModality modality);
|
||||||
|
|
||||||
void setFormat(const QSurfaceFormat &format);
|
void setFormat(const QSurfaceFormat &format);
|
||||||
QSurfaceFormat format() const;
|
QSurfaceFormat format() const;
|
||||||
QSurfaceFormat requestedFormat() const;
|
QSurfaceFormat requestedFormat() const;
|
||||||
|
|
||||||
void setWindowFlags(Qt::WindowFlags flags);
|
void setFlags(Qt::WindowFlags flags);
|
||||||
Qt::WindowFlags windowFlags() const;
|
Qt::WindowFlags flags() const;
|
||||||
Qt::WindowType windowType() const;
|
Qt::WindowType type() const;
|
||||||
|
|
||||||
QString windowTitle() const;
|
QString title() const;
|
||||||
|
|
||||||
void setOpacity(qreal level);
|
void setOpacity(qreal level);
|
||||||
void requestActivateWindow();
|
void requestActivate();
|
||||||
|
|
||||||
bool isActive() const;
|
bool isActive() const;
|
||||||
|
|
||||||
void reportContentOrientationChange(Qt::ScreenOrientation orientation);
|
void reportContentOrientationChange(Qt::ScreenOrientation orientation);
|
||||||
Qt::ScreenOrientation contentOrientation() const;
|
Qt::ScreenOrientation contentOrientation() const;
|
||||||
|
|
||||||
bool requestWindowOrientation(Qt::ScreenOrientation orientation);
|
bool requestOrientation(Qt::ScreenOrientation orientation);
|
||||||
Qt::ScreenOrientation windowOrientation() const;
|
Qt::ScreenOrientation orientation() const;
|
||||||
|
|
||||||
Qt::WindowState windowState() const;
|
Qt::WindowState windowState() const;
|
||||||
void setWindowState(Qt::WindowState state);
|
void setWindowState(Qt::WindowState state);
|
||||||
@ -213,11 +215,11 @@ public:
|
|||||||
void resize(const QSize &newSize);
|
void resize(const QSize &newSize);
|
||||||
inline void resize(int w, int h) { resize(QSize(w, h)); }
|
inline void resize(int w, int h) { resize(QSize(w, h)); }
|
||||||
|
|
||||||
void setWindowFilePath(const QString &filePath);
|
void setFilePath(const QString &filePath);
|
||||||
QString windowFilePath() const;
|
QString filePath() const;
|
||||||
|
|
||||||
void setWindowIcon(const QIcon &icon);
|
void setIcon(const QIcon &icon);
|
||||||
QIcon windowIcon() const;
|
QIcon icon() const;
|
||||||
|
|
||||||
void destroy();
|
void destroy();
|
||||||
|
|
||||||
@ -256,7 +258,7 @@ public Q_SLOTS:
|
|||||||
void raise();
|
void raise();
|
||||||
void lower();
|
void lower();
|
||||||
|
|
||||||
void setWindowTitle(const QString &);
|
void setTitle(const QString &);
|
||||||
|
|
||||||
void setX(int arg)
|
void setX(int arg)
|
||||||
{
|
{
|
||||||
@ -289,7 +291,8 @@ public Q_SLOTS:
|
|||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void screenChanged(QScreen *screen);
|
void screenChanged(QScreen *screen);
|
||||||
void windowModalityChanged(Qt::WindowModality windowModality);
|
void modalityChanged(Qt::WindowModality modality);
|
||||||
|
void windowStateChanged(Qt::WindowState windowState);
|
||||||
|
|
||||||
void xChanged(int arg);
|
void xChanged(int arg);
|
||||||
void yChanged(int arg);
|
void yChanged(int arg);
|
||||||
|
@ -54,7 +54,7 @@ QShapedPixmapWindow::QShapedPixmapWindow()
|
|||||||
format.setAlphaBufferSize(8);
|
format.setAlphaBufferSize(8);
|
||||||
setFormat(format);
|
setFormat(format);
|
||||||
setSurfaceType(RasterSurface);
|
setSurfaceType(RasterSurface);
|
||||||
setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint |
|
setFlags(Qt::ToolTip | Qt::FramelessWindowHint |
|
||||||
Qt::X11BypassWindowManagerHint | Qt::WindowTransparentForInput);
|
Qt::X11BypassWindowManagerHint | Qt::WindowTransparentForInput);
|
||||||
create();
|
create();
|
||||||
m_backingStore = new QBackingStore(this);
|
m_backingStore = new QBackingStore(this);
|
||||||
|
@ -219,7 +219,7 @@ QList<QCocoaMenuItem*> QCocoaMenuBar::merged() const
|
|||||||
|
|
||||||
bool QCocoaMenuBar::shouldDisable(QCocoaWindow *active) const
|
bool QCocoaMenuBar::shouldDisable(QCocoaWindow *active) const
|
||||||
{
|
{
|
||||||
if (active && (active->window()->windowModality() == Qt::NonModal))
|
if (active && (active->window()->modality() == Qt::NonModal))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (m_window == active) {
|
if (m_window == active) {
|
||||||
@ -232,7 +232,7 @@ bool QCocoaMenuBar::shouldDisable(QCocoaWindow *active) const
|
|||||||
// the menubar should be disabled. The exception in Qt is that if the
|
// the menubar should be disabled. The exception in Qt is that if the
|
||||||
// modal window is the only window on screen, then we enable the menu bar.
|
// modal window is the only window on screen, then we enable the menu bar.
|
||||||
foreach (QWindow *w, topWindows) {
|
foreach (QWindow *w, topWindows) {
|
||||||
if (w->isVisible() && w->windowModality() == Qt::ApplicationModal) {
|
if (w->isVisible() && w->modality() == Qt::ApplicationModal) {
|
||||||
// check for other visible windows
|
// check for other visible windows
|
||||||
foreach (QWindow *other, topWindows) {
|
foreach (QWindow *other, topWindows) {
|
||||||
if ((w != other) && (other->isVisible())) {
|
if ((w != other) && (other->isVisible())) {
|
||||||
|
@ -149,9 +149,9 @@ static bool isMouseEvent(NSEvent *ev)
|
|||||||
- (BOOL)canBecomeKeyWindow
|
- (BOOL)canBecomeKeyWindow
|
||||||
{
|
{
|
||||||
// Most panels can be come the key window. Exceptions are:
|
// Most panels can be come the key window. Exceptions are:
|
||||||
if (m_cocoaPlatformWindow->window()->windowType() == Qt::ToolTip)
|
if (m_cocoaPlatformWindow->window()->type() == Qt::ToolTip)
|
||||||
return NO;
|
return NO;
|
||||||
if (m_cocoaPlatformWindow->window()->windowType() == Qt::SplashScreen)
|
if (m_cocoaPlatformWindow->window()->type() == Qt::SplashScreen)
|
||||||
return NO;
|
return NO;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@ -252,7 +252,7 @@ void QCocoaWindow::setVisible(bool visible)
|
|||||||
#endif
|
#endif
|
||||||
if (visible) {
|
if (visible) {
|
||||||
// We need to recreate if the modality has changed as the style mask will need updating
|
// We need to recreate if the modality has changed as the style mask will need updating
|
||||||
if (m_windowModality != window()->windowModality())
|
if (m_windowModality != window()->modality())
|
||||||
recreateWindow(parent());
|
recreateWindow(parent());
|
||||||
QCocoaWindow *parentCocoaWindow = 0;
|
QCocoaWindow *parentCocoaWindow = 0;
|
||||||
if (window()->transientParent()) {
|
if (window()->transientParent()) {
|
||||||
@ -264,8 +264,8 @@ void QCocoaWindow::setVisible(bool visible)
|
|||||||
|
|
||||||
// Register popup windows so that the parent window can
|
// Register popup windows so that the parent window can
|
||||||
// close them when needed.
|
// close them when needed.
|
||||||
if (window()->windowType() == Qt::Popup) {
|
if (window()->type() == Qt::Popup) {
|
||||||
// qDebug() << "transientParent and popup" << window()->windowType() << Qt::Popup << (window()->windowType() & Qt::Popup);
|
// qDebug() << "transientParent and popup" << window()->type() << Qt::Popup << (window()->type() & Qt::Popup);
|
||||||
parentCocoaWindow->m_activePopupWindow = window();
|
parentCocoaWindow->m_activePopupWindow = window();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,12 +281,12 @@ void QCocoaWindow::setVisible(bool visible)
|
|||||||
syncWindowState(window()->windowState());
|
syncWindowState(window()->windowState());
|
||||||
|
|
||||||
if (window()->windowState() != Qt::WindowMinimized) {
|
if (window()->windowState() != Qt::WindowMinimized) {
|
||||||
if ((window()->windowModality() == Qt::WindowModal
|
if ((window()->modality() == Qt::WindowModal
|
||||||
|| window()->windowType() == Qt::Sheet)
|
|| window()->type() == Qt::Sheet)
|
||||||
&& parentCocoaWindow) {
|
&& parentCocoaWindow) {
|
||||||
// show the window as a sheet
|
// show the window as a sheet
|
||||||
[NSApp beginSheet:m_nsWindow modalForWindow:parentCocoaWindow->m_nsWindow modalDelegate:nil didEndSelector:nil contextInfo:nil];
|
[NSApp beginSheet:m_nsWindow modalForWindow:parentCocoaWindow->m_nsWindow modalDelegate:nil didEndSelector:nil contextInfo:nil];
|
||||||
} else if (window()->windowModality() != Qt::NonModal) {
|
} else if (window()->modality() != Qt::NonModal) {
|
||||||
// show the window as application modal
|
// show the window as application modal
|
||||||
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
|
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
|
||||||
Q_ASSERT(cocoaEventDispatcher != 0);
|
Q_ASSERT(cocoaEventDispatcher != 0);
|
||||||
@ -300,7 +300,7 @@ void QCocoaWindow::setVisible(bool visible)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We want the events to properly reach the popup
|
// We want the events to properly reach the popup
|
||||||
if (window()->windowType() == Qt::Popup)
|
if (window()->type() == Qt::Popup)
|
||||||
[(NSPanel *)m_nsWindow setWorksWhenModal:YES];
|
[(NSPanel *)m_nsWindow setWorksWhenModal:YES];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -366,7 +366,7 @@ NSUInteger QCocoaWindow::windowStyleMask(Qt::WindowFlags flags)
|
|||||||
Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint;
|
Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint;
|
||||||
if (flags == Qt::Window) {
|
if (flags == Qt::Window) {
|
||||||
styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask);
|
styleMask = (NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSTitledWindowMask);
|
||||||
} else if ((flags & Qt::Dialog) && (window()->windowModality() != Qt::NonModal)) {
|
} else if ((flags & Qt::Dialog) && (window()->modality() != Qt::NonModal)) {
|
||||||
styleMask = NSTitledWindowMask;
|
styleMask = NSTitledWindowMask;
|
||||||
} else if (!(flags & Qt::FramelessWindowHint)) {
|
} else if (!(flags & Qt::FramelessWindowHint)) {
|
||||||
if (flags & Qt::WindowMaximizeButtonHint)
|
if (flags & Qt::WindowMaximizeButtonHint)
|
||||||
@ -435,7 +435,7 @@ void QCocoaWindow::setWindowIcon(const QIcon &icon)
|
|||||||
|
|
||||||
NSButton *iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
|
NSButton *iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
|
||||||
if (iconButton == nil) {
|
if (iconButton == nil) {
|
||||||
NSString *title = QCFString::toNSString(window()->windowTitle());
|
NSString *title = QCFString::toNSString(window()->title());
|
||||||
[m_nsWindow setRepresentedURL:[NSURL fileURLWithPath:title]];
|
[m_nsWindow setRepresentedURL:[NSURL fileURLWithPath:title]];
|
||||||
iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
|
iconButton = [m_nsWindow standardWindowButton:NSWindowDocumentIconButton];
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ void QCocoaWindow::windowWillClose()
|
|||||||
bool QCocoaWindow::windowIsPopupType(Qt::WindowType type) const
|
bool QCocoaWindow::windowIsPopupType(Qt::WindowType type) const
|
||||||
{
|
{
|
||||||
if (type == Qt::Widget)
|
if (type == Qt::Widget)
|
||||||
type = window()->windowType();
|
type = window()->type();
|
||||||
if (type == Qt::Tool)
|
if (type == Qt::Tool)
|
||||||
return false; // Qt::Tool has the Popup bit set but isn't, at least on Mac.
|
return false; // Qt::Tool has the Popup bit set but isn't, at least on Mac.
|
||||||
|
|
||||||
@ -632,8 +632,8 @@ void QCocoaWindow::recreateWindow(const QPlatformWindow *parentWindow)
|
|||||||
|
|
||||||
// QPlatformWindow subclasses must sync up with QWindow on creation:
|
// QPlatformWindow subclasses must sync up with QWindow on creation:
|
||||||
propagateSizeHints();
|
propagateSizeHints();
|
||||||
setWindowFlags(window()->windowFlags());
|
setWindowFlags(window()->flags());
|
||||||
setWindowTitle(window()->windowTitle());
|
setWindowTitle(window()->title());
|
||||||
setWindowState(window()->windowState());
|
setWindowState(window()->windowState());
|
||||||
} else {
|
} else {
|
||||||
// Child windows have no NSWindow, link the NSViews instead.
|
// Child windows have no NSWindow, link the NSViews instead.
|
||||||
@ -648,8 +648,8 @@ NSWindow * QCocoaWindow::createNSWindow()
|
|||||||
|
|
||||||
NSRect frame = qt_mac_flipRect(window()->geometry(), window());
|
NSRect frame = qt_mac_flipRect(window()->geometry(), window());
|
||||||
|
|
||||||
Qt::WindowType type = window()->windowType();
|
Qt::WindowType type = window()->type();
|
||||||
Qt::WindowFlags flags = window()->windowFlags();
|
Qt::WindowFlags flags = window()->flags();
|
||||||
|
|
||||||
NSUInteger styleMask = windowStyleMask(flags);
|
NSUInteger styleMask = windowStyleMask(flags);
|
||||||
NSWindow *createdWindow = 0;
|
NSWindow *createdWindow = 0;
|
||||||
@ -695,7 +695,7 @@ NSWindow * QCocoaWindow::createNSWindow()
|
|||||||
|
|
||||||
NSInteger level = windowLevel(flags);
|
NSInteger level = windowLevel(flags);
|
||||||
[createdWindow setLevel:level];
|
[createdWindow setLevel:level];
|
||||||
m_windowModality = window()->windowModality();
|
m_windowModality = window()->modality();
|
||||||
return createdWindow;
|
return createdWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion,
|
|||||||
QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window);
|
QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window);
|
||||||
|
|
||||||
#ifndef Q_OS_WINCE
|
#ifndef Q_OS_WINCE
|
||||||
if (rw->format().hasAlpha() && (window->windowFlags() & Qt::FramelessWindowHint)) {
|
if (rw->format().hasAlpha() && (window->flags() & Qt::FramelessWindowHint)) {
|
||||||
const long wl = GetWindowLong(rw->handle(), GWL_EXSTYLE);
|
const long wl = GetWindowLong(rw->handle(), GWL_EXSTYLE);
|
||||||
if ((wl & WS_EX_LAYERED) == 0)
|
if ((wl & WS_EX_LAYERED) == 0)
|
||||||
SetWindowLong(rw->handle(), GWL_EXSTYLE, wl | WS_EX_LAYERED);
|
SetWindowLong(rw->handle(), GWL_EXSTYLE, wl | WS_EX_LAYERED);
|
||||||
|
@ -374,7 +374,7 @@ void QWindowsContext::setKeyGrabber(QWindow *w)
|
|||||||
|
|
||||||
QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL)
|
QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL)
|
||||||
{
|
{
|
||||||
const Qt::WindowFlags flags = w ? w->windowFlags() : (Qt::WindowFlags)0;
|
const Qt::WindowFlags flags = w ? w->flags() : (Qt::WindowFlags)0;
|
||||||
const Qt::WindowFlags type = flags & Qt::WindowType_Mask;
|
const Qt::WindowFlags type = flags & Qt::WindowType_Mask;
|
||||||
|
|
||||||
uint style = 0;
|
uint style = 0;
|
||||||
|
@ -354,10 +354,10 @@ QPlatformPixmap *QWindowsIntegration::createPlatformPixmap(QPlatformPixmap::Pixe
|
|||||||
QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) const
|
QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) const
|
||||||
{
|
{
|
||||||
QWindowsWindow::WindowData requested;
|
QWindowsWindow::WindowData requested;
|
||||||
requested.flags = window->windowFlags();
|
requested.flags = window->flags();
|
||||||
requested.geometry = window->geometry();
|
requested.geometry = window->geometry();
|
||||||
const QWindowsWindow::WindowData obtained
|
const QWindowsWindow::WindowData obtained
|
||||||
= QWindowsWindow::WindowData::create(window, requested, window->windowTitle());
|
= QWindowsWindow::WindowData::create(window, requested, window->title());
|
||||||
if (QWindowsContext::verboseIntegration || QWindowsContext::verboseWindows)
|
if (QWindowsContext::verboseIntegration || QWindowsContext::verboseWindows)
|
||||||
qDebug().nospace()
|
qDebug().nospace()
|
||||||
<< __FUNCTION__ << '<' << window << '\n'
|
<< __FUNCTION__ << '<' << window << '\n'
|
||||||
@ -372,7 +372,7 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons
|
|||||||
if (!obtained.hwnd)
|
if (!obtained.hwnd)
|
||||||
return 0;
|
return 0;
|
||||||
if (requested.flags != obtained.flags)
|
if (requested.flags != obtained.flags)
|
||||||
window->setWindowFlags(obtained.flags);
|
window->setFlags(obtained.flags);
|
||||||
return new QWindowsWindow(window, obtained);
|
return new QWindowsWindow(window, obtained);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,16 +682,16 @@ static void showSystemMenu(QWindow* w)
|
|||||||
#define enabled (MF_BYCOMMAND | MF_ENABLED)
|
#define enabled (MF_BYCOMMAND | MF_ENABLED)
|
||||||
#define disabled (MF_BYCOMMAND | MF_GRAYED)
|
#define disabled (MF_BYCOMMAND | MF_GRAYED)
|
||||||
|
|
||||||
EnableMenuItem(menu, SC_MINIMIZE, (topLevel->windowFlags() & Qt::WindowMinimizeButtonHint)?enabled:disabled);
|
EnableMenuItem(menu, SC_MINIMIZE, (topLevel->flags() & Qt::WindowMinimizeButtonHint)?enabled:disabled);
|
||||||
bool maximized = IsZoomed(topLevelHwnd);
|
bool maximized = IsZoomed(topLevelHwnd);
|
||||||
|
|
||||||
EnableMenuItem(menu, SC_MAXIMIZE, ! (topLevel->windowFlags() & Qt::WindowMaximizeButtonHint) || maximized?disabled:enabled);
|
EnableMenuItem(menu, SC_MAXIMIZE, ! (topLevel->flags() & Qt::WindowMaximizeButtonHint) || maximized?disabled:enabled);
|
||||||
EnableMenuItem(menu, SC_RESTORE, maximized?enabled:disabled);
|
EnableMenuItem(menu, SC_RESTORE, maximized?enabled:disabled);
|
||||||
|
|
||||||
// We should _not_ check with the setFixedSize(x,y) case here, since Windows is not able to check
|
// We should _not_ check with the setFixedSize(x,y) case here, since Windows is not able to check
|
||||||
// this and our menu here would be out-of-sync with the menu produced by mouse-click on the
|
// this and our menu here would be out-of-sync with the menu produced by mouse-click on the
|
||||||
// System Menu, or right-click on the title bar.
|
// System Menu, or right-click on the title bar.
|
||||||
EnableMenuItem(menu, SC_SIZE, (topLevel->windowFlags() & Qt::MSWindowsFixedSizeDialogHint) || maximized?disabled:enabled);
|
EnableMenuItem(menu, SC_SIZE, (topLevel->flags() & Qt::MSWindowsFixedSizeDialogHint) || maximized?disabled:enabled);
|
||||||
EnableMenuItem(menu, SC_MOVE, maximized?disabled:enabled);
|
EnableMenuItem(menu, SC_MOVE, maximized?disabled:enabled);
|
||||||
EnableMenuItem(menu, SC_CLOSE, enabled);
|
EnableMenuItem(menu, SC_CLOSE, enabled);
|
||||||
// Set bold on close menu item
|
// Set bold on close menu item
|
||||||
|
@ -715,7 +715,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) :
|
|||||||
setFlag(OpenGLSurface);
|
setFlag(OpenGLSurface);
|
||||||
QWindowsContext::instance()->addWindow(m_data.hwnd, this);
|
QWindowsContext::instance()->addWindow(m_data.hwnd, this);
|
||||||
if (aWindow->isTopLevel()) {
|
if (aWindow->isTopLevel()) {
|
||||||
switch (aWindow->windowType()) {
|
switch (aWindow->type()) {
|
||||||
case Qt::Window:
|
case Qt::Window:
|
||||||
case Qt::Dialog:
|
case Qt::Dialog:
|
||||||
case Qt::Sheet:
|
case Qt::Sheet:
|
||||||
@ -893,8 +893,8 @@ void QWindowsWindow::show_sys() const
|
|||||||
int sm = SW_SHOWNORMAL;
|
int sm = SW_SHOWNORMAL;
|
||||||
bool fakedMaximize = false;
|
bool fakedMaximize = false;
|
||||||
const QWindow *w = window();
|
const QWindow *w = window();
|
||||||
const Qt::WindowFlags flags = w->windowFlags();
|
const Qt::WindowFlags flags = w->flags();
|
||||||
const Qt::WindowType type = w->windowType();
|
const Qt::WindowType type = w->type();
|
||||||
if (w->isTopLevel()) {
|
if (w->isTopLevel()) {
|
||||||
const Qt::WindowState state = w->windowState();
|
const Qt::WindowState state = w->windowState();
|
||||||
if (state & Qt::WindowMinimized) {
|
if (state & Qt::WindowMinimized) {
|
||||||
@ -931,7 +931,7 @@ void QWindowsWindow::show_sys() const
|
|||||||
// partially from QWidgetPrivate::hide_sys()
|
// partially from QWidgetPrivate::hide_sys()
|
||||||
void QWindowsWindow::hide_sys() const
|
void QWindowsWindow::hide_sys() const
|
||||||
{
|
{
|
||||||
const Qt::WindowFlags flags = window()->windowFlags();
|
const Qt::WindowFlags flags = window()->flags();
|
||||||
if (flags != Qt::Desktop) {
|
if (flags != Qt::Desktop) {
|
||||||
if (flags & Qt::Popup)
|
if (flags & Qt::Popup)
|
||||||
ShowWindow(m_data.hwnd, SW_HIDE);
|
ShowWindow(m_data.hwnd, SW_HIDE);
|
||||||
@ -979,7 +979,7 @@ void QWindowsWindow::setParent_sys(const QPlatformWindow *parent) const
|
|||||||
// to dialog frames, etc (see SetParent() ) if the top level state changes.
|
// to dialog frames, etc (see SetParent() ) if the top level state changes.
|
||||||
if (wasTopLevel != isTopLevel) {
|
if (wasTopLevel != isTopLevel) {
|
||||||
const unsigned flags = isTopLevel ? unsigned(0) : unsigned(WindowCreationData::ForceChild);
|
const unsigned flags = isTopLevel ? unsigned(0) : unsigned(WindowCreationData::ForceChild);
|
||||||
setWindowFlags_sys(window()->windowFlags(), flags);
|
setWindowFlags_sys(window()->flags(), flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -396,7 +396,7 @@ void QXcbDrag::move(const QMouseEvent *me)
|
|||||||
QXcbWindow *w = 0;
|
QXcbWindow *w = 0;
|
||||||
if (target) {
|
if (target) {
|
||||||
w = connection()->platformWindowFromId(target);
|
w = connection()->platformWindowFromId(target);
|
||||||
if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/)
|
if (w && (w->window()->type() == Qt::Desktop) /*&& !w->acceptDrops()*/)
|
||||||
w = 0;
|
w = 0;
|
||||||
} else {
|
} else {
|
||||||
w = 0;
|
w = 0;
|
||||||
@ -507,7 +507,7 @@ void QXcbDrag::drop(const QMouseEvent *event)
|
|||||||
|
|
||||||
QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target);
|
QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target);
|
||||||
|
|
||||||
if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/)
|
if (w && (w->window()->type() == Qt::Desktop) /*&& !w->acceptDrops()*/)
|
||||||
w = 0;
|
w = 0;
|
||||||
|
|
||||||
Transaction t = {
|
Transaction t = {
|
||||||
@ -722,7 +722,7 @@ void QXcbDrag::handle_xdnd_position(QWindow *w, const xcb_client_message_event_t
|
|||||||
|
|
||||||
p -= geometry.topLeft();
|
p -= geometry.topLeft();
|
||||||
|
|
||||||
if (!w || (w->windowType() == Qt::Desktop))
|
if (!w || (w->type() == Qt::Desktop))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (e->data.data32[0] != xdnd_dragsource) {
|
if (e->data.data32[0] != xdnd_dragsource) {
|
||||||
@ -912,7 +912,7 @@ void QXcbDrag::send_leave()
|
|||||||
|
|
||||||
QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target);
|
QXcbWindow *w = connection()->platformWindowFromId(current_proxy_target);
|
||||||
|
|
||||||
if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/)
|
if (w && (w->window()->type() == Qt::Desktop) /*&& !w->acceptDrops()*/)
|
||||||
w = 0;
|
w = 0;
|
||||||
|
|
||||||
if (w)
|
if (w)
|
||||||
@ -1157,7 +1157,7 @@ bool QXcbDrag::dndEnable(QXcbWindow *w, bool on)
|
|||||||
DNDDEBUG << "xdndEnable" << w << on;
|
DNDDEBUG << "xdndEnable" << w << on;
|
||||||
if (on) {
|
if (on) {
|
||||||
QXcbWindow *xdnd_widget = 0;
|
QXcbWindow *xdnd_widget = 0;
|
||||||
if ((w->window()->windowType() == Qt::Desktop)) {
|
if ((w->window()->type() == Qt::Desktop)) {
|
||||||
if (desktop_proxy) // *WE* already have one.
|
if (desktop_proxy) // *WE* already have one.
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1191,7 +1191,7 @@ bool QXcbDrag::dndEnable(QXcbWindow *w, bool on)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ((w->window()->windowType() == Qt::Desktop)) {
|
if ((w->window()->type() == Qt::Desktop)) {
|
||||||
xcb_delete_property(xcb_connection(), w->xcb_window(), atom(QXcbAtom::XdndProxy));
|
xcb_delete_property(xcb_connection(), w->xcb_window(), atom(QXcbAtom::XdndProxy));
|
||||||
delete desktop_proxy;
|
delete desktop_proxy;
|
||||||
desktop_proxy = 0;
|
desktop_proxy = 0;
|
||||||
@ -1225,7 +1225,7 @@ QVariant QXcbDropData::xdndObtainData(const QByteArray &format, QVariant::Type r
|
|||||||
|
|
||||||
QXcbConnection *c = drag->connection();
|
QXcbConnection *c = drag->connection();
|
||||||
QXcbWindow *xcb_window = c->platformWindowFromId(drag->xdnd_dragsource);
|
QXcbWindow *xcb_window = c->platformWindowFromId(drag->xdnd_dragsource);
|
||||||
if (xcb_window && drag->currentDrag() && xcb_window->window()->windowType() != Qt::Desktop) {
|
if (xcb_window && drag->currentDrag() && xcb_window->window()->type() != Qt::Desktop) {
|
||||||
QMimeData *data = drag->currentDrag()->mimeData();
|
QMimeData *data = drag->currentDrag()->mimeData();
|
||||||
if (data->hasFormat(QLatin1String(format)))
|
if (data->hasFormat(QLatin1String(format)))
|
||||||
result = data->data(QLatin1String(format));
|
result = data->data(QLatin1String(format));
|
||||||
|
@ -121,13 +121,13 @@ QT_BEGIN_NAMESPACE
|
|||||||
// Returns true if we should set WM_TRANSIENT_FOR on \a w
|
// Returns true if we should set WM_TRANSIENT_FOR on \a w
|
||||||
static inline bool isTransient(const QWindow *w)
|
static inline bool isTransient(const QWindow *w)
|
||||||
{
|
{
|
||||||
return w->windowType() == Qt::Dialog
|
return w->type() == Qt::Dialog
|
||||||
|| w->windowType() == Qt::Sheet
|
|| w->type() == Qt::Sheet
|
||||||
|| w->windowType() == Qt::Tool
|
|| w->type() == Qt::Tool
|
||||||
|| w->windowType() == Qt::SplashScreen
|
|| w->type() == Qt::SplashScreen
|
||||||
|| w->windowType() == Qt::ToolTip
|
|| w->type() == Qt::ToolTip
|
||||||
|| w->windowType() == Qt::Drawer
|
|| w->type() == Qt::Drawer
|
||||||
|| w->windowType() == Qt::Popup;
|
|| w->type() == Qt::Popup;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QImage::Format imageFormatForDepth(int depth)
|
static inline QImage::Format imageFormatForDepth(int depth)
|
||||||
@ -175,7 +175,7 @@ void QXcbWindow::create()
|
|||||||
m_configureNotifyPending = true;
|
m_configureNotifyPending = true;
|
||||||
m_windowState = Qt::WindowNoState;
|
m_windowState = Qt::WindowNoState;
|
||||||
|
|
||||||
Qt::WindowType type = window()->windowType();
|
Qt::WindowType type = window()->type();
|
||||||
|
|
||||||
if (type == Qt::Desktop) {
|
if (type == Qt::Desktop) {
|
||||||
m_window = m_screen->root();
|
m_window = m_screen->root();
|
||||||
@ -309,7 +309,7 @@ void QXcbWindow::create()
|
|||||||
if (m_screen->syncRequestSupported())
|
if (m_screen->syncRequestSupported())
|
||||||
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST);
|
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_SYNC_REQUEST);
|
||||||
|
|
||||||
if (window()->windowFlags() & Qt::WindowContextHelpButtonHint)
|
if (window()->flags() & Qt::WindowContextHelpButtonHint)
|
||||||
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_CONTEXT_HELP);
|
properties[propertyCount++] = atom(QXcbAtom::_NET_WM_CONTEXT_HELP);
|
||||||
|
|
||||||
Q_XCB_CALL(xcb_change_property(xcb_connection(),
|
Q_XCB_CALL(xcb_change_property(xcb_connection(),
|
||||||
@ -347,7 +347,7 @@ void QXcbWindow::create()
|
|||||||
memset(&hints, 0, sizeof(hints));
|
memset(&hints, 0, sizeof(hints));
|
||||||
xcb_wm_hints_set_normal(&hints);
|
xcb_wm_hints_set_normal(&hints);
|
||||||
|
|
||||||
xcb_wm_hints_set_input(&hints, !(window()->windowFlags() & Qt::WindowDoesNotAcceptFocus));
|
xcb_wm_hints_set_input(&hints, !(window()->flags() & Qt::WindowDoesNotAcceptFocus));
|
||||||
|
|
||||||
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
|
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
|
||||||
|
|
||||||
@ -375,11 +375,11 @@ void QXcbWindow::create()
|
|||||||
connection()->xi2Select(m_window);
|
connection()->xi2Select(m_window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
setWindowFlags(window()->windowFlags());
|
|
||||||
setWindowTitle(window()->windowTitle());
|
|
||||||
setWindowState(window()->windowState());
|
setWindowState(window()->windowState());
|
||||||
|
setWindowFlags(window()->flags());
|
||||||
|
setWindowTitle(window()->title());
|
||||||
|
|
||||||
if (window()->windowFlags() & Qt::WindowTransparentForInput)
|
if (window()->flags() & Qt::WindowTransparentForInput)
|
||||||
setTransparentForMouseEvents(true);
|
setTransparentForMouseEvents(true);
|
||||||
|
|
||||||
#ifndef QT_NO_DRAGANDDROP
|
#ifndef QT_NO_DRAGANDDROP
|
||||||
@ -534,7 +534,7 @@ void QXcbWindow::show()
|
|||||||
else
|
else
|
||||||
xcb_wm_hints_set_normal(&hints);
|
xcb_wm_hints_set_normal(&hints);
|
||||||
|
|
||||||
xcb_wm_hints_set_input(&hints, !(window()->windowFlags() & Qt::WindowDoesNotAcceptFocus));
|
xcb_wm_hints_set_input(&hints, !(window()->flags() & Qt::WindowDoesNotAcceptFocus));
|
||||||
|
|
||||||
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
|
xcb_set_wm_hints(xcb_connection(), m_window, &hints);
|
||||||
|
|
||||||
@ -943,8 +943,8 @@ void QXcbWindow::updateMotifWmHintsBeforeMap()
|
|||||||
{
|
{
|
||||||
QtMotifWmHints mwmhints = getMotifWmHints(connection(), m_window);
|
QtMotifWmHints mwmhints = getMotifWmHints(connection(), m_window);
|
||||||
|
|
||||||
if (window()->windowModality() != Qt::NonModal) {
|
if (window()->modality() != Qt::NonModal) {
|
||||||
switch (window()->windowModality()) {
|
switch (window()->modality()) {
|
||||||
case Qt::WindowModal:
|
case Qt::WindowModal:
|
||||||
mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL;
|
mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL;
|
||||||
break;
|
break;
|
||||||
@ -979,17 +979,17 @@ void QXcbWindow::updateMotifWmHintsBeforeMap()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window()->windowFlags() & Qt::WindowMinimizeButtonHint) {
|
if (window()->flags() & Qt::WindowMinimizeButtonHint) {
|
||||||
mwmhints.flags |= MWM_HINTS_DECORATIONS;
|
mwmhints.flags |= MWM_HINTS_DECORATIONS;
|
||||||
mwmhints.decorations |= MWM_DECOR_MINIMIZE;
|
mwmhints.decorations |= MWM_DECOR_MINIMIZE;
|
||||||
mwmhints.functions |= MWM_FUNC_MINIMIZE;
|
mwmhints.functions |= MWM_FUNC_MINIMIZE;
|
||||||
}
|
}
|
||||||
if (window()->windowFlags() & Qt::WindowMaximizeButtonHint) {
|
if (window()->flags() & Qt::WindowMaximizeButtonHint) {
|
||||||
mwmhints.flags |= MWM_HINTS_DECORATIONS;
|
mwmhints.flags |= MWM_HINTS_DECORATIONS;
|
||||||
mwmhints.decorations |= MWM_DECOR_MAXIMIZE;
|
mwmhints.decorations |= MWM_DECOR_MAXIMIZE;
|
||||||
mwmhints.functions |= MWM_FUNC_MAXIMIZE;
|
mwmhints.functions |= MWM_FUNC_MAXIMIZE;
|
||||||
}
|
}
|
||||||
if (window()->windowFlags() & Qt::WindowCloseButtonHint)
|
if (window()->flags() & Qt::WindowCloseButtonHint)
|
||||||
mwmhints.functions |= MWM_FUNC_CLOSE;
|
mwmhints.functions |= MWM_FUNC_CLOSE;
|
||||||
|
|
||||||
setMotifWmHints(connection(), m_window, mwmhints);
|
setMotifWmHints(connection(), m_window, mwmhints);
|
||||||
@ -999,7 +999,7 @@ void QXcbWindow::updateNetWmStateBeforeMap()
|
|||||||
{
|
{
|
||||||
NetWmStates states(0);
|
NetWmStates states(0);
|
||||||
|
|
||||||
const Qt::WindowFlags flags = window()->windowFlags();
|
const Qt::WindowFlags flags = window()->flags();
|
||||||
if (flags & Qt::WindowStaysOnTopHint) {
|
if (flags & Qt::WindowStaysOnTopHint) {
|
||||||
states |= NetWmStateAbove;
|
states |= NetWmStateAbove;
|
||||||
states |= NetWmStateStaysOnTop;
|
states |= NetWmStateStaysOnTop;
|
||||||
@ -1015,7 +1015,7 @@ void QXcbWindow::updateNetWmStateBeforeMap()
|
|||||||
states |= NetWmStateMaximizedVert;
|
states |= NetWmStateMaximizedVert;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window()->windowModality() != Qt::NonModal)
|
if (window()->modality() != Qt::NonModal)
|
||||||
states |= NetWmStateModal;
|
states |= NetWmStateModal;
|
||||||
|
|
||||||
setNetWmStates(states);
|
setNetWmStates(states);
|
||||||
|
@ -2331,7 +2331,7 @@ bool QApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blockingWin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::WindowModality windowModality = modalWindow->windowModality();
|
Qt::WindowModality windowModality = modalWindow->modality();
|
||||||
QWidgetWindow *modalWidgetWindow = qobject_cast<QWidgetWindow *>(modalWindow);
|
QWidgetWindow *modalWidgetWindow = qobject_cast<QWidgetWindow *>(modalWindow);
|
||||||
if (windowModality == Qt::NonModal) {
|
if (windowModality == Qt::NonModal) {
|
||||||
// determine the modality type if it hasn't been set on the
|
// determine the modality type if it hasn't been set on the
|
||||||
|
@ -107,7 +107,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
|
|||||||
win = topData()->window;
|
win = topData()->window;
|
||||||
}
|
}
|
||||||
|
|
||||||
win->setWindowFlags(data.window_flags);
|
win->setFlags(data.window_flags);
|
||||||
fixPosIncludesFrame();
|
fixPosIncludesFrame();
|
||||||
win->setGeometry(q->geometry());
|
win->setGeometry(q->geometry());
|
||||||
win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0));
|
win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0));
|
||||||
@ -134,7 +134,7 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
|
|||||||
QWindowPrivate::WindowFrameInclusive : QWindowPrivate::WindowFrameExclusive;
|
QWindowPrivate::WindowFrameInclusive : QWindowPrivate::WindowFrameExclusive;
|
||||||
win->create();
|
win->create();
|
||||||
|
|
||||||
data.window_flags = win->windowFlags();
|
data.window_flags = win->flags();
|
||||||
|
|
||||||
QBackingStore *store = q->backingStore();
|
QBackingStore *store = q->backingStore();
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f)
|
|||||||
if (parent != newparent) {
|
if (parent != newparent) {
|
||||||
QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function???
|
QObjectPrivate::setParent_helper(newparent); //### why does this have to be done in the _sys function???
|
||||||
if (q->windowHandle()) {
|
if (q->windowHandle()) {
|
||||||
q->windowHandle()->setWindowFlags(f);
|
q->windowHandle()->setFlags(f);
|
||||||
QWidget *parentWithWindow =
|
QWidget *parentWithWindow =
|
||||||
newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : 0;
|
newparent ? (newparent->windowHandle() ? newparent : newparent->nativeParentWidget()) : 0;
|
||||||
if (parentWithWindow) {
|
if (parentWithWindow) {
|
||||||
@ -342,7 +342,7 @@ void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (QWindow *window = q->windowHandle())
|
if (QWindow *window = q->windowHandle())
|
||||||
window->setWindowTitle(caption);
|
window->setTitle(caption);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,14 +353,14 @@ void QWidgetPrivate::setWindowFilePath_sys(const QString &filePath)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
if (QWindow *window = q->windowHandle())
|
if (QWindow *window = q->windowHandle())
|
||||||
window->setWindowFilePath(filePath);
|
window->setFilePath(filePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWidgetPrivate::setWindowIcon_sys()
|
void QWidgetPrivate::setWindowIcon_sys()
|
||||||
{
|
{
|
||||||
Q_Q(QWidget);
|
Q_Q(QWidget);
|
||||||
if (QWindow *window = q->windowHandle())
|
if (QWindow *window = q->windowHandle())
|
||||||
window->setWindowIcon(q->windowIcon());
|
window->setIcon(q->windowIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWidgetPrivate::setWindowIconText_sys(const QString &iconText)
|
void QWidgetPrivate::setWindowIconText_sys(const QString &iconText)
|
||||||
@ -463,7 +463,7 @@ void QWidget::activateWindow()
|
|||||||
QWindow *const wnd = window()->windowHandle();
|
QWindow *const wnd = window()->windowHandle();
|
||||||
|
|
||||||
if (wnd)
|
if (wnd)
|
||||||
wnd->requestActivateWindow();
|
wnd->requestActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Position top level windows at the center, avoid showing
|
// Position top level windows at the center, avoid showing
|
||||||
@ -640,7 +640,7 @@ void QWidgetPrivate::setFocus_sys()
|
|||||||
if (QWindow *nativeWindow = q->window()->windowHandle()) {
|
if (QWindow *nativeWindow = q->window()->windowHandle()) {
|
||||||
if (nativeWindow != QGuiApplication::focusWindow()
|
if (nativeWindow != QGuiApplication::focusWindow()
|
||||||
&& q->testAttribute(Qt::WA_WState_Created)) {
|
&& q->testAttribute(Qt::WA_WState_Created)) {
|
||||||
nativeWindow->requestActivateWindow();
|
nativeWindow->requestActivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -987,7 +987,7 @@ void QWidgetPrivate::setModal_sys()
|
|||||||
{
|
{
|
||||||
Q_Q(QWidget);
|
Q_Q(QWidget);
|
||||||
if (q->windowHandle())
|
if (q->windowHandle())
|
||||||
q->windowHandle()->setWindowModality(q->windowModality());
|
q->windowHandle()->setModality(q->windowModality());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_CURSOR
|
#ifndef QT_NO_CURSOR
|
||||||
|
@ -111,7 +111,7 @@ void tst_QGuiApplication::focusObject()
|
|||||||
|
|
||||||
|
|
||||||
// verify active window focus propagates to qguiapplication
|
// verify active window focus propagates to qguiapplication
|
||||||
window1.requestActivateWindow();
|
window1.requestActivate();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&window1));
|
QVERIFY(QTest::qWaitForWindowActive(&window1));
|
||||||
QCOMPARE(app.focusWindow(), &window1);
|
QCOMPARE(app.focusWindow(), &window1);
|
||||||
|
|
||||||
@ -247,10 +247,10 @@ void tst_QGuiApplication::changeFocusWindow()
|
|||||||
window2.show();
|
window2.show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(&window1));
|
QVERIFY(QTest::qWaitForWindowExposed(&window1));
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(&window2));
|
QVERIFY(QTest::qWaitForWindowExposed(&window2));
|
||||||
window1.requestActivateWindow();
|
window1.requestActivate();
|
||||||
QTRY_COMPARE(app.focusWindow(), &window1);
|
QTRY_COMPARE(app.focusWindow(), &window1);
|
||||||
|
|
||||||
window2.requestActivateWindow();
|
window2.requestActivate();
|
||||||
QTRY_COMPARE(app.focusWindow(), &window2);
|
QTRY_COMPARE(app.focusWindow(), &window2);
|
||||||
QCOMPARE(window1.windowDuringFocusAboutToChange, &window1);
|
QCOMPARE(window1.windowDuringFocusAboutToChange, &window1);
|
||||||
QCOMPARE(window1.windowDuringFocusOut, &window2);
|
QCOMPARE(window1.windowDuringFocusOut, &window2);
|
||||||
@ -381,14 +381,14 @@ void tst_QGuiApplication::modalWindow()
|
|||||||
|
|
||||||
BlockableWindow *windowModalWindow1 = new BlockableWindow;
|
BlockableWindow *windowModalWindow1 = new BlockableWindow;
|
||||||
windowModalWindow1->setTransientParent(window1);
|
windowModalWindow1->setTransientParent(window1);
|
||||||
windowModalWindow1->setWindowModality(Qt::WindowModal);
|
windowModalWindow1->setModality(Qt::WindowModal);
|
||||||
|
|
||||||
BlockableWindow *windowModalWindow2 = new BlockableWindow;
|
BlockableWindow *windowModalWindow2 = new BlockableWindow;
|
||||||
windowModalWindow2->setTransientParent(windowModalWindow1);
|
windowModalWindow2->setTransientParent(windowModalWindow1);
|
||||||
windowModalWindow2->setWindowModality(Qt::WindowModal);
|
windowModalWindow2->setModality(Qt::WindowModal);
|
||||||
|
|
||||||
BlockableWindow *applicationModalWindow1 = new BlockableWindow;
|
BlockableWindow *applicationModalWindow1 = new BlockableWindow;
|
||||||
applicationModalWindow1->setWindowModality(Qt::ApplicationModal);
|
applicationModalWindow1->setModality(Qt::ApplicationModal);
|
||||||
|
|
||||||
// show the 2 windows, nothing is blocked
|
// show the 2 windows, nothing is blocked
|
||||||
window1->show();
|
window1->show();
|
||||||
|
@ -202,7 +202,7 @@ void tst_qinputmethod::cursorRectangle()
|
|||||||
DummyWindow window;
|
DummyWindow window;
|
||||||
window.show();
|
window.show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(&window));
|
QVERIFY(QTest::qWaitForWindowExposed(&window));
|
||||||
window.requestActivateWindow();
|
window.requestActivate();
|
||||||
QTRY_COMPARE(qApp->focusWindow(), &window);
|
QTRY_COMPARE(qApp->focusWindow(), &window);
|
||||||
window.setFocusObject(&m_inputItem);
|
window.setFocusObject(&m_inputItem);
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ void tst_qinputmethod::inputMethodAccepted()
|
|||||||
DummyWindow window;
|
DummyWindow window;
|
||||||
window.show();
|
window.show();
|
||||||
QVERIFY(QTest::qWaitForWindowExposed(&window));
|
QVERIFY(QTest::qWaitForWindowExposed(&window));
|
||||||
window.requestActivateWindow();
|
window.requestActivate();
|
||||||
QTRY_COMPARE(qApp->focusWindow(), &window);
|
QTRY_COMPARE(qApp->focusWindow(), &window);
|
||||||
window.setFocusObject(&disabledItem);
|
window.setFocusObject(&disabledItem);
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ public:
|
|||||||
Window()
|
Window()
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
setFlags(Qt::Window | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset()
|
void reset()
|
||||||
@ -268,7 +268,7 @@ void tst_QWindow::isActive()
|
|||||||
|
|
||||||
QTRY_VERIFY(child.isExposed());
|
QTRY_VERIFY(child.isExposed());
|
||||||
|
|
||||||
child.requestActivateWindow();
|
child.requestActivate();
|
||||||
|
|
||||||
QTRY_VERIFY(QGuiApplication::focusWindow() == &child);
|
QTRY_VERIFY(QGuiApplication::focusWindow() == &child);
|
||||||
QVERIFY(child.isActive());
|
QVERIFY(child.isActive());
|
||||||
@ -288,7 +288,7 @@ void tst_QWindow::isActive()
|
|||||||
dialog.setGeometry(110, 110, 300, 30);
|
dialog.setGeometry(110, 110, 300, 30);
|
||||||
dialog.show();
|
dialog.show();
|
||||||
|
|
||||||
dialog.requestActivateWindow();
|
dialog.requestActivate();
|
||||||
|
|
||||||
QTRY_VERIFY(dialog.isExposed());
|
QTRY_VERIFY(dialog.isExposed());
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
@ -302,7 +302,7 @@ void tst_QWindow::isActive()
|
|||||||
// parent is active
|
// parent is active
|
||||||
QVERIFY(child.isActive());
|
QVERIFY(child.isActive());
|
||||||
|
|
||||||
window.requestActivateWindow();
|
window.requestActivate();
|
||||||
|
|
||||||
QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
|
QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
@ -731,9 +731,9 @@ void tst_QWindow::orientation()
|
|||||||
window.reportContentOrientationChange(Qt::PrimaryOrientation);
|
window.reportContentOrientationChange(Qt::PrimaryOrientation);
|
||||||
QCOMPARE(window.contentOrientation(), Qt::PrimaryOrientation);
|
QCOMPARE(window.contentOrientation(), Qt::PrimaryOrientation);
|
||||||
|
|
||||||
QVERIFY(!window.requestWindowOrientation(Qt::LandscapeOrientation) || window.windowOrientation() == Qt::LandscapeOrientation);
|
QVERIFY(!window.requestOrientation(Qt::LandscapeOrientation) || window.orientation() == Qt::LandscapeOrientation);
|
||||||
QVERIFY(!window.requestWindowOrientation(Qt::PortraitOrientation) || window.windowOrientation() == Qt::PortraitOrientation);
|
QVERIFY(!window.requestOrientation(Qt::PortraitOrientation) || window.orientation() == Qt::PortraitOrientation);
|
||||||
QVERIFY(!window.requestWindowOrientation(Qt::PrimaryOrientation) || window.windowOrientation() == Qt::PrimaryOrientation);
|
QVERIFY(!window.requestOrientation(Qt::PrimaryOrientation) || window.orientation() == Qt::PrimaryOrientation);
|
||||||
|
|
||||||
QSignalSpy spy(&window, SIGNAL(contentOrientationChanged(Qt::ScreenOrientation)));
|
QSignalSpy spy(&window, SIGNAL(contentOrientationChanged(Qt::ScreenOrientation)));
|
||||||
window.reportContentOrientationChange(Qt::LandscapeOrientation);
|
window.reportContentOrientationChange(Qt::LandscapeOrientation);
|
||||||
@ -812,7 +812,7 @@ void tst_QWindow::activateAndClose()
|
|||||||
for (int i = 0; i < 10; ++i) {
|
for (int i = 0; i < 10; ++i) {
|
||||||
QWindow window;
|
QWindow window;
|
||||||
window.show();
|
window.show();
|
||||||
window.requestActivateWindow();
|
window.requestActivate();
|
||||||
QVERIFY(QTest::qWaitForWindowActive(&window));
|
QVERIFY(QTest::qWaitForWindowActive(&window));
|
||||||
QCOMPARE(qGuiApp->focusWindow(), &window);
|
QCOMPARE(qGuiApp->focusWindow(), &window);
|
||||||
}
|
}
|
||||||
@ -914,29 +914,29 @@ void tst_QWindow::windowModality()
|
|||||||
qRegisterMetaType<Qt::WindowModality>("Qt::WindowModality");
|
qRegisterMetaType<Qt::WindowModality>("Qt::WindowModality");
|
||||||
|
|
||||||
QWindow window;
|
QWindow window;
|
||||||
QSignalSpy spy(&window, SIGNAL(windowModalityChanged(Qt::WindowModality)));
|
QSignalSpy spy(&window, SIGNAL(modalityChanged(Qt::WindowModality)));
|
||||||
|
|
||||||
QCOMPARE(window.windowModality(), Qt::NonModal);
|
QCOMPARE(window.modality(), Qt::NonModal);
|
||||||
window.setWindowModality(Qt::NonModal);
|
window.setModality(Qt::NonModal);
|
||||||
QCOMPARE(window.windowModality(), Qt::NonModal);
|
QCOMPARE(window.modality(), Qt::NonModal);
|
||||||
QCOMPARE(spy.count(), 0);
|
QCOMPARE(spy.count(), 0);
|
||||||
|
|
||||||
window.setWindowModality(Qt::WindowModal);
|
window.setModality(Qt::WindowModal);
|
||||||
QCOMPARE(window.windowModality(), Qt::WindowModal);
|
QCOMPARE(window.modality(), Qt::WindowModal);
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
window.setWindowModality(Qt::WindowModal);
|
window.setModality(Qt::WindowModal);
|
||||||
QCOMPARE(window.windowModality(), Qt::WindowModal);
|
QCOMPARE(window.modality(), Qt::WindowModal);
|
||||||
QCOMPARE(spy.count(), 1);
|
QCOMPARE(spy.count(), 1);
|
||||||
|
|
||||||
window.setWindowModality(Qt::ApplicationModal);
|
window.setModality(Qt::ApplicationModal);
|
||||||
QCOMPARE(window.windowModality(), Qt::ApplicationModal);
|
QCOMPARE(window.modality(), Qt::ApplicationModal);
|
||||||
QCOMPARE(spy.count(), 2);
|
QCOMPARE(spy.count(), 2);
|
||||||
window.setWindowModality(Qt::ApplicationModal);
|
window.setModality(Qt::ApplicationModal);
|
||||||
QCOMPARE(window.windowModality(), Qt::ApplicationModal);
|
QCOMPARE(window.modality(), Qt::ApplicationModal);
|
||||||
QCOMPARE(spy.count(), 2);
|
QCOMPARE(spy.count(), 2);
|
||||||
|
|
||||||
window.setWindowModality(Qt::NonModal);
|
window.setModality(Qt::NonModal);
|
||||||
QCOMPARE(window.windowModality(), Qt::NonModal);
|
QCOMPARE(window.modality(), Qt::NonModal);
|
||||||
QCOMPARE(spy.count(), 3);
|
QCOMPARE(spy.count(), 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1050,13 +1050,13 @@ void tst_QWindow::windowModality_QTBUG27039()
|
|||||||
InputTestWindow modalA;
|
InputTestWindow modalA;
|
||||||
modalA.setTransientParent(&parent);
|
modalA.setTransientParent(&parent);
|
||||||
modalA.setGeometry(10, 10, 20, 20);
|
modalA.setGeometry(10, 10, 20, 20);
|
||||||
modalA.setWindowModality(Qt::ApplicationModal);
|
modalA.setModality(Qt::ApplicationModal);
|
||||||
modalA.show();
|
modalA.show();
|
||||||
|
|
||||||
InputTestWindow modalB;
|
InputTestWindow modalB;
|
||||||
modalB.setTransientParent(&parent);
|
modalB.setTransientParent(&parent);
|
||||||
modalB.setGeometry(30, 10, 20, 20);
|
modalB.setGeometry(30, 10, 20, 20);
|
||||||
modalB.setWindowModality(Qt::ApplicationModal);
|
modalB.setModality(Qt::ApplicationModal);
|
||||||
modalB.show();
|
modalB.show();
|
||||||
|
|
||||||
QPointF local(5, 5);
|
QPointF local(5, 5);
|
||||||
|
@ -813,7 +813,7 @@ void tst_QAccessibility::mainWindowTest()
|
|||||||
child.setGeometry(10, 10, 20, 20);
|
child.setGeometry(10, 10, 20, 20);
|
||||||
child.show();
|
child.show();
|
||||||
|
|
||||||
child.requestActivateWindow();
|
child.requestActivate();
|
||||||
QTRY_VERIFY(QGuiApplication::focusWindow() == &child);
|
QTRY_VERIFY(QGuiApplication::focusWindow() == &child);
|
||||||
|
|
||||||
QAccessibleStateChangeEvent deactivate(&window, activeState);
|
QAccessibleStateChangeEvent deactivate(&window, activeState);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user