aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-06-14 20:39:43 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-06-14 18:49:27 +0000
commit2ae178f42442d633ac4563315f212a6cdcc5b174 (patch)
treeef23adb407161daa5d8f2165b7ba26bc98a1e993 /src
parent25f68921a3c8071f5f1821bf8c08820a7f1bc586 (diff)
Let QQuickGroupBox inherit QQuickFrame
Change-Id: If1d8f3c5ca35b47031adb308a313deb5c1f38bca Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/controls/controls.pri1
-rw-r--r--src/controls/qquickframe.cpp35
-rw-r--r--src/controls/qquickframe_p.h16
-rw-r--r--src/controls/qquickframe_p_p.h65
-rw-r--r--src/controls/qquickgroupbox.cpp34
-rw-r--r--src/controls/qquickgroupbox_p.h9
-rw-r--r--src/imports/controls/Frame.qml5
7 files changed, 127 insertions, 38 deletions
diff --git a/src/controls/controls.pri b/src/controls/controls.pri
index 9a7efe97..bf636066 100644
--- a/src/controls/controls.pri
+++ b/src/controls/controls.pri
@@ -14,6 +14,7 @@ HEADERS += \
$$PWD/qquickcontrol_p_p.h \
$$PWD/qquickexclusivegroup_p.h \
$$PWD/qquickframe_p.h \
+ $$PWD/qquickframe_p_p.h \
$$PWD/qquickgroupbox_p.h \
$$PWD/qquicklabel_p.h \
$$PWD/qquickpageindicator_p.h \
diff --git a/src/controls/qquickframe.cpp b/src/controls/qquickframe.cpp
index 1a0f5f68..e64ff13e 100644
--- a/src/controls/qquickframe.cpp
+++ b/src/controls/qquickframe.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "qquickframe_p.h"
+#include "qquickframe_p_p.h"
QT_BEGIN_NAMESPACE
@@ -49,9 +50,41 @@ QT_BEGIN_NAMESPACE
TODO
*/
+QQuickFramePrivate::QQuickFramePrivate() : frame(Q_NULLPTR)
+{
+}
+
QQuickFrame::QQuickFrame(QQuickItem *parent) :
- QQuickContainer(parent)
+ QQuickContainer(*(new QQuickFramePrivate), parent)
+{
+}
+
+QQuickFrame::QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent) :
+ QQuickContainer(dd, parent)
+{
+}
+
+/*!
+ \qmlproperty Item QtQuickControls2::Frame::frame
+
+ TODO
+*/
+QQuickItem *QQuickFrame::frame() const
+{
+ Q_D(const QQuickFrame);
+ return d->frame;
+}
+
+void QQuickFrame::setFrame(QQuickItem *frame)
{
+ Q_D(QQuickFrame);
+ if (d->frame != frame) {
+ delete d->frame;
+ d->frame = frame;
+ if (frame && !frame->parentItem())
+ frame->setParentItem(this);
+ emit frameChanged();
+ }
}
QT_END_NAMESPACE
diff --git a/src/controls/qquickframe_p.h b/src/controls/qquickframe_p.h
index 85bd72fc..c62cf0fb 100644
--- a/src/controls/qquickframe_p.h
+++ b/src/controls/qquickframe_p.h
@@ -52,12 +52,28 @@
QT_BEGIN_NAMESPACE
+class QQuickFramePrivate;
+
class Q_QUICKCONTROLS_EXPORT QQuickFrame : public QQuickContainer
{
Q_OBJECT
+ Q_PROPERTY(QQuickItem *frame READ frame WRITE setFrame NOTIFY frameChanged FINAL)
public:
explicit QQuickFrame(QQuickItem *parent = Q_NULLPTR);
+
+ QQuickItem *frame() const;
+ void setFrame(QQuickItem *frame);
+
+Q_SIGNALS:
+ void frameChanged();
+
+protected:
+ QQuickFrame(QQuickFramePrivate &dd, QQuickItem *parent);
+
+private:
+ Q_DISABLE_COPY(QQuickFrame)
+ Q_DECLARE_PRIVATE(QQuickFrame)
};
QT_END_NAMESPACE
diff --git a/src/controls/qquickframe_p_p.h b/src/controls/qquickframe_p_p.h
new file mode 100644
index 00000000..f7985593
--- /dev/null
+++ b/src/controls/qquickframe_p_p.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Quick Controls module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later 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 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QQUICKFRAME_P_P_H
+#define QQUICKFRAME_P_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtQuickControls/private/qquickcontainer_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class Q_QUICKCONTROLS_EXPORT QQuickFramePrivate : public QQuickContainerPrivate
+{
+public:
+ QQuickFramePrivate();
+
+ QQuickItem *frame;
+};
+
+QT_END_NAMESPACE
+
+#endif // QQUICKFRAME_P_P_H
diff --git a/src/controls/qquickgroupbox.cpp b/src/controls/qquickgroupbox.cpp
index 3937f6c1..a3266aa6 100644
--- a/src/controls/qquickgroupbox.cpp
+++ b/src/controls/qquickgroupbox.cpp
@@ -35,13 +35,13 @@
****************************************************************************/
#include "qquickgroupbox_p.h"
-#include "qquickcontainer_p_p.h"
+#include "qquickframe_p_p.h"
QT_BEGIN_NAMESPACE
/*!
\qmltype GroupBox
- \inherits Container
+ \inherits Frame
\instantiates QQuickGroupBox
\inqmlmodule QtQuick.Controls
\ingroup containers
@@ -50,18 +50,17 @@ QT_BEGIN_NAMESPACE
TODO
*/
-class QQuickGroupBoxPrivate : public QQuickContainerPrivate
+class QQuickGroupBoxPrivate : public QQuickFramePrivate
{
public:
- QQuickGroupBoxPrivate() : label(Q_NULLPTR), frame(Q_NULLPTR) { }
+ QQuickGroupBoxPrivate() : label(Q_NULLPTR) { }
QString title;
QQuickItem *label;
- QQuickItem *frame;
};
QQuickGroupBox::QQuickGroupBox(QQuickItem *parent) :
- QQuickContainer(*(new QQuickGroupBoxPrivate), parent)
+ QQuickFrame(*(new QQuickGroupBoxPrivate), parent)
{
}
@@ -108,27 +107,4 @@ void QQuickGroupBox::setLabel(QQuickItem *label)
}
}
-/*!
- \qmlproperty Item QtQuickControls2::GroupBox::frame
-
- TODO
-*/
-QQuickItem *QQuickGroupBox::frame() const
-{
- Q_D(const QQuickGroupBox);
- return d->frame;
-}
-
-void QQuickGroupBox::setFrame(QQuickItem *frame)
-{
- Q_D(QQuickGroupBox);
- if (d->frame != frame) {
- delete d->frame;
- d->frame = frame;
- if (frame && !frame->parentItem())
- frame->setParentItem(this);
- emit frameChanged();
- }
-}
-
QT_END_NAMESPACE
diff --git a/src/controls/qquickgroupbox_p.h b/src/controls/qquickgroupbox_p.h
index d2e65f63..bae21a36 100644
--- a/src/controls/qquickgroupbox_p.h
+++ b/src/controls/qquickgroupbox_p.h
@@ -48,18 +48,17 @@
// We mean it.
//
-#include <QtQuickControls/private/qquickcontainer_p.h>
+#include <QtQuickControls/private/qquickframe_p.h>
QT_BEGIN_NAMESPACE
class QQuickGroupBoxPrivate;
-class Q_QUICKCONTROLS_EXPORT QQuickGroupBox : public QQuickContainer
+class Q_QUICKCONTROLS_EXPORT QQuickGroupBox : public QQuickFrame
{
Q_OBJECT
Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged FINAL)
Q_PROPERTY(QQuickItem *label READ label WRITE setLabel NOTIFY labelChanged FINAL)
- Q_PROPERTY(QQuickItem *frame READ frame WRITE setFrame NOTIFY frameChanged FINAL)
public:
explicit QQuickGroupBox(QQuickItem *parent = Q_NULLPTR);
@@ -70,13 +69,9 @@ public:
QQuickItem *label() const;
void setLabel(QQuickItem *label);
- QQuickItem *frame() const;
- void setFrame(QQuickItem *frame);
-
Q_SIGNALS:
void titleChanged();
void labelChanged();
- void frameChanged();
private:
Q_DISABLE_COPY(QQuickGroupBox)
diff --git a/src/imports/controls/Frame.qml b/src/imports/controls/Frame.qml
index 02972e4b..c1c2ea62 100644
--- a/src/imports/controls/Frame.qml
+++ b/src/imports/controls/Frame.qml
@@ -56,7 +56,10 @@ AbstractFrame {
id: content
}
- background: Rectangle {
+ frame: Rectangle {
+ width: parent.width
+ height: parent.height
+
color: "transparent"
radius: control.Theme.roundness
border.color: control.Theme.frameColor