Commit 6b8a0dab authored by J-P Nurmi's avatar J-P Nurmi Committed by Gabriel de Dietrich
Browse files

Fix ApplicationWindow state / content size


QML Window is not a plain QQuickWindow, but QQuickWindowQmlImpl that
does delayed visibility handling and shows the window in appropriate
state. Thus, ApplicationWindow cannot inherit QQuickWindow or it would
lose all that magic.

QQuickApplicationWindow was added in order for ApplicationWindowStyle
to be able to know whether a custom window color had been set. This
change gets rid of the QQuickWindow subclass and simply compares the
window color to white, which is the default fill color of QQuickWindow.

Change-Id: Ibd95ef0717c2db51246c6a71585e9286e61cef0b
Reviewed-by: default avatarRichard Moe Gustavsen <richard.gustavsen@digia.com>
Reviewed-by: default avatarGabriel de Dietrich <gabriel.dedietrich@digia.com>
parent 42a5930a
No related merge requests found
Showing with 2 additions and 142 deletions
...@@ -88,7 +88,7 @@ import QtQuick.Controls.Private 1.0 ...@@ -88,7 +88,7 @@ import QtQuick.Controls.Private 1.0
point to explore this type. point to explore this type.
*/ */
ApplicationWindowPrivate { Window {
id: root id: root
/*! /*!
...@@ -221,7 +221,7 @@ ApplicationWindowPrivate { ...@@ -221,7 +221,7 @@ ApplicationWindowPrivate {
sourceComponent: style sourceComponent: style
property var __control: root property var __control: root
property QtObject styleData: QtObject { property QtObject styleData: QtObject {
readonly property bool hasColor: root.__hasColor readonly property bool hasColor: root.color != "#ffffff"
} }
onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root) onStatusChanged: if (status === Loader.Error) console.error("Failed to load Style for", root)
} }
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include "qquickstack_p.h" #include "qquickstack_p.h"
#include "qquickdesktopiconprovider_p.h" #include "qquickdesktopiconprovider_p.h"
#include "qquickselectionmode_p.h" #include "qquickselectionmode_p.h"
#include "qquickapplicationwindow_p.h"
#include "Private/qquickcalendarmodel_p.h" #include "Private/qquickcalendarmodel_p.h"
#include "Private/qquickrangeddate_p.h" #include "Private/qquickrangeddate_p.h"
...@@ -151,7 +150,6 @@ void QtQuickControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri ...@@ -151,7 +150,6 @@ void QtQuickControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri
qmlRegisterType<QQuickMenu>(private_uri, 1, 0, "MenuPrivate"); qmlRegisterType<QQuickMenu>(private_uri, 1, 0, "MenuPrivate");
qmlRegisterType<QQuickMenuBar>(private_uri, 1, 0, "MenuBarPrivate"); qmlRegisterType<QQuickMenuBar>(private_uri, 1, 0, "MenuBarPrivate");
qmlRegisterType<QQuickPopupWindow>(private_uri, 1, 0, "PopupWindow"); qmlRegisterType<QQuickPopupWindow>(private_uri, 1, 0, "PopupWindow");
qmlRegisterType<QQuickApplicationWindow>(private_uri, 1, 0, "ApplicationWindowPrivate");
#ifdef QT_WIDGETS_LIB #ifdef QT_WIDGETS_LIB
qmlRegisterType<QQuickStyleItem>(private_uri, 1, 0, "StyleItem"); qmlRegisterType<QQuickStyleItem>(private_uri, 1, 0, "StyleItem");
......
HEADERS += \ HEADERS += \
$$PWD/qquickaction_p.h \ $$PWD/qquickaction_p.h \
$$PWD/qquickapplicationwindow_p.h \
$$PWD/qquickexclusivegroup_p.h \ $$PWD/qquickexclusivegroup_p.h \
$$PWD/qquickmenu_p.h \ $$PWD/qquickmenu_p.h \
$$PWD/qquickmenubar_p.h \ $$PWD/qquickmenubar_p.h \
...@@ -14,7 +13,6 @@ HEADERS += \ ...@@ -14,7 +13,6 @@ HEADERS += \
SOURCES += \ SOURCES += \
$$PWD/qquickaction.cpp \ $$PWD/qquickaction.cpp \
$$PWD/qquickapplicationwindow.cpp \
$$PWD/qquickexclusivegroup.cpp \ $$PWD/qquickexclusivegroup.cpp \
$$PWD/qquickmenu.cpp \ $$PWD/qquickmenu.cpp \
$$PWD/qquickmenubar.cpp \ $$PWD/qquickmenubar.cpp \
......
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Quick Controls module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qquickapplicationwindow_p.h"
QT_BEGIN_NAMESPACE
QQuickApplicationWindow::QQuickApplicationWindow(QWindow *parent) :
QQuickWindow(parent), m_hasColor(false)
{
connect(this, SIGNAL(colorChanged(QColor)), this, SLOT(setHasColor()));
}
bool QQuickApplicationWindow::hasColor() const
{
return m_hasColor;
}
void QQuickApplicationWindow::setHasColor(bool hasColor)
{
if (m_hasColor != hasColor) {
m_hasColor = hasColor;
emit hasColorChanged(hasColor);
}
}
QT_END_NAMESPACE
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Quick Controls module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QQUICKAPPLICATIONWINDOW_H
#define QQUICKAPPLICATIONWINDOW_H
#include <QtQuick/qquickwindow.h>
QT_BEGIN_NAMESPACE
class QQuickApplicationWindow : public QQuickWindow
{
Q_OBJECT
Q_PROPERTY(bool __hasColor READ hasColor NOTIFY hasColorChanged)
public:
QQuickApplicationWindow(QWindow *parent = 0);
bool hasColor() const;
Q_SIGNALS:
void hasColorChanged(bool hasColor);
private Q_SLOTS:
void setHasColor(bool hasColor = true);
private:
bool m_hasColor;
};
QT_END_NAMESPACE
#endif // QQUICKAPPLICATIONWINDOW_H
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment