summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-12-18 18:54:17 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-12-18 17:58:02 +0000
commit2f441d3c6474226d606ce4b8dc3c62d926ebf9cb (patch)
tree4a5f840800f18e372f194523cce3ed3c525da617 /src
parenta3c7013e3e4464ba30228fd38cee23271bfacadc (diff)
Pimplify the view classes
Change-Id: I4d6e1440f797a91e9280523d58a1a64440cf3f39 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/android/view/qnativeandroidlayoutparams.cpp52
-rw-r--r--src/android/view/qnativeandroidlayoutparams_p.h9
-rw-r--r--src/android/view/qnativeandroidlayoutparams_p_p.h69
-rw-r--r--src/android/view/qnativeandroidmenu.cpp10
-rw-r--r--src/android/view/qnativeandroidmenu_p.h7
-rw-r--r--src/android/view/qnativeandroidmenu_p_p.h61
-rw-r--r--src/android/view/qnativeandroidmenuitem.cpp106
-rw-r--r--src/android/view/qnativeandroidmenuitem_p.h10
-rw-r--r--src/android/view/qnativeandroidviewgroup.cpp5
-rw-r--r--src/android/view/qnativeandroidviewgroup_p.h8
-rw-r--r--src/android/view/qnativeandroidviewgroup_p_p.h62
-rw-r--r--src/android/view/qnativeandroidwindow.cpp27
-rw-r--r--src/android/view/qnativeandroidwindow_p.h6
-rw-r--r--src/android/view/view.pri3
14 files changed, 353 insertions, 82 deletions
diff --git a/src/android/view/qnativeandroidlayoutparams.cpp b/src/android/view/qnativeandroidlayoutparams.cpp
index 3119a40..04af00b 100644
--- a/src/android/view/qnativeandroidlayoutparams.cpp
+++ b/src/android/view/qnativeandroidlayoutparams.cpp
@@ -35,15 +35,26 @@
****************************************************************************/
#include "qnativeandroidlayoutparams_p.h"
+#include "qnativeandroidlayoutparams_p_p.h"
#include "qtnativeandroidfunctions_p.h"
#include "qnativeandroidview_p.h"
QT_BEGIN_NAMESPACE
-QNativeAndroidLayoutParams::QNativeAndroidLayoutParams(QNativeAndroidView *view) :
- QNativeAndroidObject(view), m_dirty(false), m_view(view)
+QNativeAndroidLayoutParams::QNativeAndroidLayoutParams(QNativeAndroidView *view)
+ : QNativeAndroidObject(*(new QNativeAndroidLayoutParamsPrivate), view)
{
- m_view->setLayoutParams(this);
+ Q_D(QNativeAndroidLayoutParams);
+ d->view = view;
+ view->setLayoutParams(this);
+}
+
+QNativeAndroidLayoutParams::QNativeAndroidLayoutParams(QNativeAndroidLayoutParamsPrivate &dd, QNativeAndroidView *view)
+ : QNativeAndroidObject(dd, view)
+{
+ Q_D(QNativeAndroidLayoutParams);
+ d->view = view;
+ view->setLayoutParams(this);
}
QNativeAndroidLayoutParams *QNativeAndroidLayoutParams::qmlAttachedProperties(QObject *object)
@@ -56,15 +67,17 @@ QNativeAndroidLayoutParams *QNativeAndroidLayoutParams::qmlAttachedProperties(QO
int QNativeAndroidLayoutParams::width() const
{
- if (m_width.isNull())
+ Q_D(const QNativeAndroidLayoutParams);
+ if (d->width.isNull())
return MATCH_PARENT;
- return m_width;
+ return d->width;
}
void QNativeAndroidLayoutParams::setWidth(int value)
{
+ Q_D(QNativeAndroidLayoutParams);
if (value != width()) {
- m_width = value;
+ d->width = value;
invalidate();
emit widthChanged();
}
@@ -72,15 +85,17 @@ void QNativeAndroidLayoutParams::setWidth(int value)
int QNativeAndroidLayoutParams::height() const
{
- if (m_height.isNull())
+ Q_D(const QNativeAndroidLayoutParams);
+ if (d->height.isNull())
return MATCH_PARENT;
- return m_height;
+ return d->height;
}
void QNativeAndroidLayoutParams::setHeight(int value)
{
+ Q_D(QNativeAndroidLayoutParams);
if (value != height()) {
- m_height = value;
+ d->height = value;
invalidate();
emit heightChanged();
}
@@ -88,8 +103,9 @@ void QNativeAndroidLayoutParams::setHeight(int value)
void QNativeAndroidLayoutParams::invalidate()
{
- if (!m_dirty && isValid()) {
- m_dirty = true;
+ Q_D(QNativeAndroidLayoutParams);
+ if (!d->dirty && isValid()) {
+ d->dirty = true;
QCoreApplication::postEvent(this, new QEvent(QEvent::LayoutRequest));
}
}
@@ -103,18 +119,20 @@ QAndroidJniObject QNativeAndroidLayoutParams::onCreate()
void QNativeAndroidLayoutParams::onInflate(QAndroidJniObject &instance)
{
- if (!m_width.isNull())
- instance.setField<int>("width", m_width);
- if (!m_height.isNull())
- instance.setField<int>("height", m_height);
+ Q_D(QNativeAndroidLayoutParams);
+ if (!d->width.isNull())
+ instance.setField<int>("width", d->width);
+ if (!d->height.isNull())
+ instance.setField<int>("height", d->height);
}
bool QNativeAndroidLayoutParams::event(QEvent *event)
{
+ Q_D(QNativeAndroidLayoutParams);
if (event->type() == QEvent::LayoutRequest) {
- if (m_dirty && isValid()) {
+ if (d->dirty && isValid()) {
construct();
- m_dirty = false;
+ d->dirty = false;
}
}
return QNativeAndroidObject::event(event);
diff --git a/src/android/view/qnativeandroidlayoutparams_p.h b/src/android/view/qnativeandroidlayoutparams_p.h
index 56ee9d1..bd306ec 100644
--- a/src/android/view/qnativeandroidlayoutparams_p.h
+++ b/src/android/view/qnativeandroidlayoutparams_p.h
@@ -55,6 +55,7 @@
QT_BEGIN_NAMESPACE
class QNativeAndroidView;
+class QNativeAndroidLayoutParamsPrivate;
class Q_NATIVEANDROID_EXPORT QNativeAndroidLayoutParams : public QNativeAndroidObject
{
@@ -88,16 +89,16 @@ Q_SIGNALS:
void heightChanged();
protected:
+ QNativeAndroidLayoutParams(QNativeAndroidLayoutParamsPrivate &dd, QNativeAndroidView *view);
+
QAndroidJniObject onCreate() override;
void onInflate(QAndroidJniObject &instance) override;
bool event(QEvent *event) override;
private:
- bool m_dirty;
- QNativeAndroidView *m_view;
- QNativeAndroidOptional<int> m_width;
- QNativeAndroidOptional<int> m_height;
+ Q_DISABLE_COPY(QNativeAndroidLayoutParams)
+ Q_DECLARE_PRIVATE(QNativeAndroidLayoutParams)
};
QT_END_NAMESPACE
diff --git a/src/android/view/qnativeandroidlayoutparams_p_p.h b/src/android/view/qnativeandroidlayoutparams_p_p.h
new file mode 100644
index 0000000..7d4fee7
--- /dev/null
+++ b/src/android/view/qnativeandroidlayoutparams_p_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt QML Android 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 QNATIVEANDROIDLAYOUTPARAMS_P_P_H
+#define QNATIVEANDROIDLAYOUTPARAMS_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 <QtNativeAndroid/private/qnativeandroidobject_p_p.h>
+#include <QtNativeAndroid/private/qnativeandroidoptional_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNativeAndroidView;
+
+class QNativeAndroidLayoutParamsPrivate : public QNativeAndroidObjectPrivate
+{
+public:
+ bool dirty = false;
+ QNativeAndroidView *view = nullptr;
+ QNativeAndroidOptional<int> width;
+ QNativeAndroidOptional<int> height;
+};
+
+QT_END_NAMESPACE
+
+#endif // QNATIVEANDROIDLAYOUTPARAMS_P_P_H
diff --git a/src/android/view/qnativeandroidmenu.cpp b/src/android/view/qnativeandroidmenu.cpp
index d36fe38..6edc96f 100644
--- a/src/android/view/qnativeandroidmenu.cpp
+++ b/src/android/view/qnativeandroidmenu.cpp
@@ -35,12 +35,18 @@
****************************************************************************/
#include "qnativeandroidmenu_p.h"
+#include "qnativeandroidmenu_p_p.h"
#include "qnativeandroidmenuitem_p.h"
QT_BEGIN_NAMESPACE
-QNativeAndroidMenu::QNativeAndroidMenu(QObject *parent) :
- QNativeAndroidContextual(parent)
+QNativeAndroidMenu::QNativeAndroidMenu(QObject *parent)
+ : QNativeAndroidContextual(*(new QNativeAndroidMenuPrivate), parent)
+{
+}
+
+QNativeAndroidMenu::QNativeAndroidMenu(QNativeAndroidMenuPrivate &dd, QObject *parent)
+ : QNativeAndroidContextual(dd, parent)
{
}
diff --git a/src/android/view/qnativeandroidmenu_p.h b/src/android/view/qnativeandroidmenu_p.h
index 863d2c6..ec25e8a 100644
--- a/src/android/view/qnativeandroidmenu_p.h
+++ b/src/android/view/qnativeandroidmenu_p.h
@@ -53,6 +53,7 @@
QT_BEGIN_NAMESPACE
class QNativeAndroidMenuItem;
+class QNativeAndroidMenuPrivate;
class Q_NATIVEANDROID_EXPORT QNativeAndroidMenu : public QNativeAndroidContextual
{
@@ -64,8 +65,14 @@ public:
QList<QNativeAndroidMenuItem *> items() const;
protected:
+ QNativeAndroidMenu(QNativeAndroidMenuPrivate &dd, QObject *parent = nullptr);
+
QAndroidJniObject onCreate() override;
void onInflate(QAndroidJniObject &instance) override;
+
+private:
+ Q_DISABLE_COPY(QNativeAndroidMenu)
+ Q_DECLARE_PRIVATE(QNativeAndroidMenu)
};
QT_END_NAMESPACE
diff --git a/src/android/view/qnativeandroidmenu_p_p.h b/src/android/view/qnativeandroidmenu_p_p.h
new file mode 100644
index 0000000..7a04f45
--- /dev/null
+++ b/src/android/view/qnativeandroidmenu_p_p.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt QML Android 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 QNATIVEANDROIDMENU_P_P_H
+#define QNATIVEANDROIDMENU_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 <QtNativeAndroid/private/qnativeandroidcontextual_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNativeAndroidMenuPrivate : public QNativeAndroidContextualPrivate
+{
+};
+
+QT_END_NAMESPACE
+
+#endif // QNATIVEANDROIDMENU_P_P_H
diff --git a/src/android/view/qnativeandroidmenuitem.cpp b/src/android/view/qnativeandroidmenuitem.cpp
index 75da1aa..ad802a4 100644
--- a/src/android/view/qnativeandroidmenuitem.cpp
+++ b/src/android/view/qnativeandroidmenuitem.cpp
@@ -35,29 +35,41 @@
****************************************************************************/
#include "qnativeandroidmenuitem_p.h"
+#include "qnativeandroidcontextual_p_p.h"
#include "qtnativeandroidfunctions_p.h"
#include "qnativeandroidcontext_p.h"
#include "qnativeandroidview_p.h"
QT_BEGIN_NAMESPACE
-QNativeAndroidMenuItem::QNativeAndroidMenuItem(QObject *parent) :
- QNativeAndroidContextual(parent), m_enabled(true), m_visible(true),
- m_checkable(false), m_checked(false),
- m_showAs(0), // TODO: SHOW_AS_ACTION_NEVER
- m_actionView(0)
+class QNativeAndroidMenuItemPrivate : public QNativeAndroidContextualPrivate
+{
+public:
+ QString title;
+ bool enabled = true;
+ bool visible = true;
+ bool checkable = false;
+ bool checked = false;
+ int showAs = 0; // TODO: SHOW_AS_ACTION_NEVER
+ QNativeAndroidView *actionView = nullptr;
+};
+
+QNativeAndroidMenuItem::QNativeAndroidMenuItem(QObject *parent)
+ : QNativeAndroidContextual(*(new QNativeAndroidMenuItemPrivate), parent)
{
}
QString QNativeAndroidMenuItem::title() const
{
- return m_title;
+ Q_D(const QNativeAndroidMenuItem);
+ return d->title;
}
void QNativeAndroidMenuItem::setTitle(const QString &title)
{
- if (m_title != title) {
- m_title = title;
+ Q_D(QNativeAndroidMenuItem);
+ if (d->title != title) {
+ d->title = title;
QtNativeAndroid::callTextMethod(instance(), "setTitle", title);
emit titleChanged();
}
@@ -65,13 +77,15 @@ void QNativeAndroidMenuItem::setTitle(const QString &title)
bool QNativeAndroidMenuItem::isEnabled() const
{
- return m_enabled;
+ Q_D(const QNativeAndroidMenuItem);
+ return d->enabled;
}
void QNativeAndroidMenuItem::setEnabled(bool enabled)
{
- if (m_enabled != enabled) {
- m_enabled = enabled;
+ Q_D(QNativeAndroidMenuItem);
+ if (d->enabled != enabled) {
+ d->enabled = enabled;
QtNativeAndroid::callBoolMethod(instance(), "setEnabled", enabled);
emit enabledChanged();
}
@@ -79,13 +93,15 @@ void QNativeAndroidMenuItem::setEnabled(bool enabled)
bool QNativeAndroidMenuItem::isVisible() const
{
- return m_visible;
+ Q_D(const QNativeAndroidMenuItem);
+ return d->visible;
}
void QNativeAndroidMenuItem::setVisible(bool visible)
{
- if (m_visible != visible) {
- m_visible = visible;
+ Q_D(QNativeAndroidMenuItem);
+ if (d->visible != visible) {
+ d->visible = visible;
QtNativeAndroid::callBoolMethod(instance(), "setVisible", visible);
if (isValid() && context())
QMetaObject::invokeMethod(context(), "invalidateOptionsMenu");
@@ -95,13 +111,15 @@ void QNativeAndroidMenuItem::setVisible(bool visible)
bool QNativeAndroidMenuItem::isCheckable() const
{
- return m_checkable;
+ Q_D(const QNativeAndroidMenuItem);
+ return d->checkable;
}
void QNativeAndroidMenuItem::setCheckable(bool checkable)
{
- if (m_checkable != checkable) {
- m_checkable = checkable;
+ Q_D(QNativeAndroidMenuItem);
+ if (d->checkable != checkable) {
+ d->checkable = checkable;
QtNativeAndroid::callBoolMethod(instance(), "setCheckable", checkable);
emit checkableChanged();
}
@@ -109,13 +127,15 @@ void QNativeAndroidMenuItem::setCheckable(bool checkable)
bool QNativeAndroidMenuItem::isChecked() const
{
- return m_checked;
+ Q_D(const QNativeAndroidMenuItem);
+ return d->checked;
}
void QNativeAndroidMenuItem::setChecked(bool checked)
{
- if (m_checked != checked) {
- m_checked = checked;
+ Q_D(QNativeAndroidMenuItem);
+ if (d->checked != checked) {
+ d->checked = checked;
QtNativeAndroid::callBoolMethod(instance(), "setChecked", checked);
emit checkedChanged();
}
@@ -123,13 +143,15 @@ void QNativeAndroidMenuItem::setChecked(bool checked)
int QNativeAndroidMenuItem::showAs() const
{
- return m_showAs;
+ Q_D(const QNativeAndroidMenuItem);
+ return d->showAs;
}
void QNativeAndroidMenuItem::setShowAs(int showAs)
{
- if (m_showAs != showAs) {
- m_showAs = showAs;
+ Q_D(QNativeAndroidMenuItem);
+ if (d->showAs != showAs) {
+ d->showAs = showAs;
QtNativeAndroid::callIntMethod(instance(), "setShowAs", showAs);
emit showAsChanged();
}
@@ -137,21 +159,23 @@ void QNativeAndroidMenuItem::setShowAs(int showAs)
QNativeAndroidView *QNativeAndroidMenuItem::actionView() const
{
- return m_actionView;
+ Q_D(const QNativeAndroidMenuItem);
+ return d->actionView;
}
void QNativeAndroidMenuItem::setActionView(QNativeAndroidView *view)
{
- if (m_actionView != view) {
- if (m_actionView) {
- disconnect(m_actionView, &QNativeAndroidObject::instanceChanged, this, &QNativeAndroidMenuItem::updateActionView);
- m_actionView->destruct();
+ Q_D(QNativeAndroidMenuItem);
+ if (d->actionView != view) {
+ if (d->actionView) {
+ disconnect(d->actionView, &QNativeAndroidObject::instanceChanged, this, &QNativeAndroidMenuItem::updateActionView);
+ d->actionView->destruct();
}
- m_actionView = view;
- if (m_actionView) {
- connect(m_actionView, &QNativeAndroidObject::instanceChanged, this, &QNativeAndroidMenuItem::updateActionView);
+ d->actionView = view;
+ if (d->actionView) {
+ connect(d->actionView, &QNativeAndroidObject::instanceChanged, this, &QNativeAndroidMenuItem::updateActionView);
if (isValid())
- m_actionView->construct();
+ d->actionView->construct();
}
emit actionViewChanged();
}
@@ -166,12 +190,13 @@ QAndroidJniObject QNativeAndroidMenuItem::onCreate()
void QNativeAndroidMenuItem::onInflate(QAndroidJniObject &instance)
{
- instance.callMethod<void>("setTitle", "(Ljava/lang/CharSequence;)V", QAndroidJniObject::fromString(m_title).object());
- instance.callMethod<void>("setEnabled", "(Z)V", m_enabled);
- instance.callMethod<void>("setVisible", "(Z)V", m_visible);
- instance.callMethod<void>("setCheckable", "(Z)V", m_checkable);
- instance.callMethod<void>("setChecked", "(Z)V", m_enabled);
- instance.callMethod<void>("setShowAs", "(I)V", m_showAs);
+ Q_D(QNativeAndroidMenuItem);
+ instance.callMethod<void>("setTitle", "(Ljava/lang/CharSequence;)V", QAndroidJniObject::fromString(d->title).object());
+ instance.callMethod<void>("setEnabled", "(Z)V", d->enabled);
+ instance.callMethod<void>("setVisible", "(Z)V", d->visible);
+ instance.callMethod<void>("setCheckable", "(Z)V", d->checkable);
+ instance.callMethod<void>("setChecked", "(Z)V", d->enabled);
+ instance.callMethod<void>("setShowAs", "(I)V", d->showAs);
static bool nativeMethodsRegistered = false;
if (!nativeMethodsRegistered) {
@@ -238,11 +263,12 @@ void QNativeAndroidMenuItem::objectChange(ObjectChange change)
void QNativeAndroidMenuItem::updateActionView()
{
- if (!isValid() || !m_actionView)
+ Q_D(QNativeAndroidMenuItem);
+ if (!isValid() || !d->actionView)
return;
QAndroidJniObject item = instance();
- QAndroidJniObject view = m_actionView->instance();
+ QAndroidJniObject view = d->actionView->instance();
QtNativeAndroid::callFunction([=]() {
item.callMethod<void>("setActionView", "(Landroid/view/View;)V", view.object());
});
diff --git a/src/android/view/qnativeandroidmenuitem_p.h b/src/android/view/qnativeandroidmenuitem_p.h
index a009fa2..2ad3859 100644
--- a/src/android/view/qnativeandroidmenuitem_p.h
+++ b/src/android/view/qnativeandroidmenuitem_p.h
@@ -53,6 +53,7 @@
QT_BEGIN_NAMESPACE
class QNativeAndroidView;
+class QNativeAndroidMenuItemPrivate;
class Q_NATIVEANDROID_EXPORT QNativeAndroidMenuItem : public QNativeAndroidContextual
{
@@ -123,13 +124,8 @@ private Q_SLOTS:
void updateActionView();
private:
- QString m_title;
- bool m_enabled;
- bool m_visible;
- bool m_checkable;
- bool m_checked;
- int m_showAs;
- QNativeAndroidView *m_actionView;
+ Q_DISABLE_COPY(QNativeAndroidMenuItem)
+ Q_DECLARE_PRIVATE(QNativeAndroidMenuItem)
};
QT_END_NAMESPACE
diff --git a/src/android/view/qnativeandroidviewgroup.cpp b/src/android/view/qnativeandroidviewgroup.cpp
index 376da38..86de858 100644
--- a/src/android/view/qnativeandroidviewgroup.cpp
+++ b/src/android/view/qnativeandroidviewgroup.cpp
@@ -35,14 +35,15 @@
****************************************************************************/
#include "qnativeandroidviewgroup_p.h"
+#include "qnativeandroidviewgroup_p_p.h"
#include "qnativeandroidlayoutparams_p.h"
#include "qtnativeandroidfunctions_p.h"
#include "qnativeandroidcontext_p.h"
QT_BEGIN_NAMESPACE
-QNativeAndroidViewGroup::QNativeAndroidViewGroup(QNativeAndroidContext *context) :
- QNativeAndroidView(context)
+QNativeAndroidViewGroup::QNativeAndroidViewGroup(QNativeAndroidContext *context)
+ : QNativeAndroidView(*(new QNativeAndroidViewGroupPrivate), context)
{
}
diff --git a/src/android/view/qnativeandroidviewgroup_p.h b/src/android/view/qnativeandroidviewgroup_p.h
index 5345ba4..8fe297e 100644
--- a/src/android/view/qnativeandroidviewgroup_p.h
+++ b/src/android/view/qnativeandroidviewgroup_p.h
@@ -52,6 +52,8 @@
QT_BEGIN_NAMESPACE
+class QNativeAndroidViewGroupPrivate;
+
class Q_NATIVEANDROID_EXPORT QNativeAndroidViewGroup : public QNativeAndroidView
{
Q_OBJECT
@@ -62,10 +64,16 @@ public:
static QNativeAndroidLayoutParams *qmlAttachedProperties(QObject *object);
protected:
+ QNativeAndroidViewGroup(QNativeAndroidViewGroupPrivate &dd, QNativeAndroidContext *context = nullptr);
+
QAndroidJniObject onCreate() override;
void onInflate(QAndroidJniObject &instance) override;
void viewChange(ViewChange change, const ViewChangeData &data) override;
+
+private:
+ Q_DISABLE_COPY(QNativeAndroidViewGroup)
+ Q_DECLARE_PRIVATE(QNativeAndroidViewGroup)
};
QT_END_NAMESPACE
diff --git a/src/android/view/qnativeandroidviewgroup_p_p.h b/src/android/view/qnativeandroidviewgroup_p_p.h
new file mode 100644
index 0000000..e06d211
--- /dev/null
+++ b/src/android/view/qnativeandroidviewgroup_p_p.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt QML Android 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 QNATIVEANDROIDVIEWGROUP_P_P_H
+#define QNATIVEANDROIDVIEWGROUP_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 <QtNativeAndroid/private/qnativeandroidview_p_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class QNativeAndroidViewGroupPrivate : public QNativeAndroidViewPrivate
+{
+public:
+};
+
+QT_END_NAMESPACE
+
+#endif // QNATIVEANDROIDVIEWGROUP_P_P_H
diff --git a/src/android/view/qnativeandroidwindow.cpp b/src/android/view/qnativeandroidwindow.cpp
index 084a185..88a6eb8 100644
--- a/src/android/view/qnativeandroidwindow.cpp
+++ b/src/android/view/qnativeandroidwindow.cpp
@@ -35,28 +35,38 @@
****************************************************************************/
#include "qnativeandroidwindow_p.h"
+#include "qnativeandroidcontextual_p_p.h"
#include "qnativeandroidcontext_p.h"
+#include "qnativeandroidoptional_p.h"
#include "qtnativeandroidfunctions_p.h"
QT_BEGIN_NAMESPACE
-QNativeAndroidWindow::QNativeAndroidWindow(QNativeAndroidContext *context) :
- QNativeAndroidContextual(context)
+class QNativeAndroidWindowPrivate : public QNativeAndroidContextualPrivate
+{
+public:
+ QNativeAndroidOptional<int> statusBarColor;
+};
+
+QNativeAndroidWindow::QNativeAndroidWindow(QNativeAndroidContext *context)
+ : QNativeAndroidContextual(*(new QNativeAndroidWindowPrivate), context)
{
setContext(context);
}
int QNativeAndroidWindow::statusBarColor() const
{
- if (m_statusBarColor.isNull())
+ Q_D(const QNativeAndroidWindow);
+ if (d->statusBarColor.isNull())
return 0; // TODO
- return m_statusBarColor;
+ return d->statusBarColor;
}
void QNativeAndroidWindow::setStatusBarColor(int color)
{
- if (m_statusBarColor.isNull() || m_statusBarColor != color) {
- m_statusBarColor = color;
+ Q_D(QNativeAndroidWindow);
+ if (d->statusBarColor.isNull() || d->statusBarColor != color) {
+ d->statusBarColor = color;
QtNativeAndroid::callIntMethod(instance(), "setStatusBarColor", color);
emit statusBarColorChanged();
}
@@ -64,12 +74,13 @@ void QNativeAndroidWindow::setStatusBarColor(int color)
void QNativeAndroidWindow::onInflate(QAndroidJniObject &instance)
{
- if (!m_statusBarColor.isNull()) {
+ Q_D(QNativeAndroidWindow);
+ if (!d->statusBarColor.isNull()) {
// TODO: WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
instance.callMethod<void>("addFlags", "(I)V", 0x80000000);
// TODO: WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
instance.callMethod<void>("clearFlags", "(I)V", 0x04000000);
- instance.callMethod<void>("setStatusBarColor", "(I)V", m_statusBarColor);
+ instance.callMethod<void>("setStatusBarColor", "(I)V", d->statusBarColor);
}
}
diff --git a/src/android/view/qnativeandroidwindow_p.h b/src/android/view/qnativeandroidwindow_p.h
index cd4236f..76f6645 100644
--- a/src/android/view/qnativeandroidwindow_p.h
+++ b/src/android/view/qnativeandroidwindow_p.h
@@ -49,10 +49,11 @@
//
#include <QtNativeAndroid/private/qnativeandroidcontextual_p.h>
-#include <QtNativeAndroid/private/qnativeandroidoptional_p.h>
QT_BEGIN_NAMESPACE
+class QNativeAndroidWindowPrivate;
+
class Q_NATIVEANDROID_EXPORT QNativeAndroidWindow : public QNativeAndroidContextual
{
Q_OBJECT
@@ -71,7 +72,8 @@ protected:
void onInflate(QAndroidJniObject &instance) override;
private:
- QNativeAndroidOptional<int> m_statusBarColor;
+ Q_DISABLE_COPY(QNativeAndroidWindow)
+ Q_DECLARE_PRIVATE(QNativeAndroidWindow)
};
QT_END_NAMESPACE
diff --git a/src/android/view/view.pri b/src/android/view/view.pri
index b31cc8a..dc6f795 100644
--- a/src/android/view/view.pri
+++ b/src/android/view/view.pri
@@ -3,11 +3,14 @@ INCLUDEPATH += $$PWD
HEADERS += \
$$PWD/qnativeandroidgravity_p.h \
$$PWD/qnativeandroidlayoutparams_p.h \
+ $$PWD/qnativeandroidlayoutparams_p_p.h \
$$PWD/qnativeandroidmenu_p.h \
+ $$PWD/qnativeandroidmenu_p_p.h \
$$PWD/qnativeandroidmenuitem_p.h \
$$PWD/qnativeandroidview_p.h \
$$PWD/qnativeandroidview_p_p.h \
$$PWD/qnativeandroidviewgroup_p.h \
+ $$PWD/qnativeandroidviewgroup_p_p.h \
$$PWD/qnativeandroidwindow_p.h
SOURCES += \