From 8961dd09598c47bb79ecdd9297f8d0eb126a2260 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Thu, 27 Dec 2012 10:54:30 +0100 Subject: Moved all header files to _p.h Change-Id: I58c6f143de8d074fe2b382eff524500c6a8270ea Reviewed-by: Liang Qi --- src/qtdesktop/qdesktopitem.cpp | 2 +- src/qtdesktop/qdesktopitem.h | 80 ---------- src/qtdesktop/qdesktopitem_p.h | 80 ++++++++++ src/qtdesktop/qfiledialogitem.cpp | 2 +- src/qtdesktop/qfiledialogitem.h | 132 ---------------- src/qtdesktop/qfiledialogitem_p.h | 132 ++++++++++++++++ src/qtdesktop/qquickcomponentsprivate.cpp | 2 +- src/qtdesktop/qquickcomponentsprivate.h | 58 ------- src/qtdesktop/qquickcomponentsprivate_p.h | 58 +++++++ src/qtdesktop/qquicklayout.cpp | 2 +- src/qtdesktop/qquicklayout.h | 129 --------------- src/qtdesktop/qquicklayout_p.h | 129 +++++++++++++++ src/qtdesktop/qquicklinearlayout.cpp | 2 +- src/qtdesktop/qquicklinearlayout.h | 111 ------------- src/qtdesktop/qquicklinearlayout_p.h | 111 +++++++++++++ src/qtdesktop/qrangemodel.cpp | 2 +- src/qtdesktop/qrangemodel.h | 125 --------------- src/qtdesktop/qrangemodel_p.h | 121 ++++++++------ src/qtdesktop/qrangemodel_p_p.h | 106 +++++++++++++ src/qtdesktop/qstyleitem.cpp | 2 +- src/qtdesktop/qstyleitem.h | 254 ------------------------------ src/qtdesktop/qstyleitem_p.h | 254 ++++++++++++++++++++++++++++++ src/qtdesktop/qstyleplugin.cpp | 22 +-- src/qtdesktop/qstyleplugin.h | 57 ------- src/qtdesktop/qstyleplugin_p.h | 57 +++++++ src/qtdesktop/qtmenu.cpp | 2 +- src/qtdesktop/qtmenu.h | 121 -------------- src/qtdesktop/qtmenu_p.h | 121 ++++++++++++++ src/qtdesktop/qtmenubar.cpp | 2 +- src/qtdesktop/qtmenubar.h | 88 ----------- src/qtdesktop/qtmenubar_p.h | 88 +++++++++++ src/qtdesktop/qtmenuitem.cpp | 2 +- src/qtdesktop/qtmenuitem.h | 126 --------------- src/qtdesktop/qtmenuitem_p.h | 126 +++++++++++++++ src/qtdesktop/qtsplitterbase.cpp | 2 +- src/qtdesktop/qtsplitterbase.h | 123 --------------- src/qtdesktop/qtsplitterbase_p.h | 123 +++++++++++++++ src/qtdesktop/qwheelarea.cpp | 2 +- src/qtdesktop/qwheelarea.h | 119 -------------- src/qtdesktop/qwheelarea_p.h | 119 ++++++++++++++ src/qtdesktop/styleplugin.pri | 26 +-- 41 files changed, 1610 insertions(+), 1610 deletions(-) delete mode 100644 src/qtdesktop/qdesktopitem.h create mode 100644 src/qtdesktop/qdesktopitem_p.h delete mode 100644 src/qtdesktop/qfiledialogitem.h create mode 100644 src/qtdesktop/qfiledialogitem_p.h delete mode 100644 src/qtdesktop/qquickcomponentsprivate.h create mode 100644 src/qtdesktop/qquickcomponentsprivate_p.h delete mode 100644 src/qtdesktop/qquicklayout.h create mode 100644 src/qtdesktop/qquicklayout_p.h delete mode 100644 src/qtdesktop/qquicklinearlayout.h create mode 100644 src/qtdesktop/qquicklinearlayout_p.h delete mode 100644 src/qtdesktop/qrangemodel.h create mode 100644 src/qtdesktop/qrangemodel_p_p.h delete mode 100644 src/qtdesktop/qstyleitem.h create mode 100644 src/qtdesktop/qstyleitem_p.h delete mode 100644 src/qtdesktop/qstyleplugin.h create mode 100644 src/qtdesktop/qstyleplugin_p.h delete mode 100644 src/qtdesktop/qtmenu.h create mode 100644 src/qtdesktop/qtmenu_p.h delete mode 100644 src/qtdesktop/qtmenubar.h create mode 100644 src/qtdesktop/qtmenubar_p.h delete mode 100644 src/qtdesktop/qtmenuitem.h create mode 100644 src/qtdesktop/qtmenuitem_p.h delete mode 100644 src/qtdesktop/qtsplitterbase.h create mode 100644 src/qtdesktop/qtsplitterbase_p.h delete mode 100644 src/qtdesktop/qwheelarea.h create mode 100644 src/qtdesktop/qwheelarea_p.h diff --git a/src/qtdesktop/qdesktopitem.cpp b/src/qtdesktop/qdesktopitem.cpp index 15c260af..1d38d4bc 100644 --- a/src/qtdesktop/qdesktopitem.cpp +++ b/src/qtdesktop/qdesktopitem.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qdesktopitem.h" +#include "qdesktopitem_p.h" QDesktopItem::QDesktopItem(QObject* obj) : QObject(obj) { connect(&desktopWidget, SIGNAL(resized(int)), this, SIGNAL(screenGeometryChanged())); diff --git a/src/qtdesktop/qdesktopitem.h b/src/qtdesktop/qdesktopitem.h deleted file mode 100644 index 6639b8ee..00000000 --- a/src/qtdesktop/qdesktopitem.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDESKTOPITEM_H -#define QDESKTOPITEM_H - -#include -#include - -class QDesktopItem : public QObject -{ - Q_OBJECT - - Q_PROPERTY(int screenWidth READ screenWidth NOTIFY screenGeometryChanged) - Q_PROPERTY(int screenHeight READ screenHeight NOTIFY screenGeometryChanged) - Q_PROPERTY(int availableWidth READ availableWidth NOTIFY availableGeometryChanged) - Q_PROPERTY(int availableHeight READ availableHeight NOTIFY availableGeometryChanged) - Q_PROPERTY(int screenCount READ screenCount NOTIFY screenCountChanged) - -public: - QDesktopItem(QObject* obj); - - int screenCount() const; - Q_INVOKABLE QRect screenGeometry(int screen) const; - Q_INVOKABLE QRect availableGeometry(int screen) const; - int screenWidth() const; - int screenHeight() const; - int availableWidth() const; - int availableHeight() const; - static QDesktopItem *qmlAttachedProperties(QObject *obj); - -private: - QDesktopWidget desktopWidget; - -Q_SIGNALS: - void screenGeometryChanged(); - void availableGeometryChanged(); - void screenCountChanged(); -}; - -QML_DECLARE_TYPEINFO(QDesktopItem, QML_HAS_ATTACHED_PROPERTIES) - -#endif // QDesktopItemITEM_H diff --git a/src/qtdesktop/qdesktopitem_p.h b/src/qtdesktop/qdesktopitem_p.h new file mode 100644 index 00000000..6639b8ee --- /dev/null +++ b/src/qtdesktop/qdesktopitem_p.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDESKTOPITEM_H +#define QDESKTOPITEM_H + +#include +#include + +class QDesktopItem : public QObject +{ + Q_OBJECT + + Q_PROPERTY(int screenWidth READ screenWidth NOTIFY screenGeometryChanged) + Q_PROPERTY(int screenHeight READ screenHeight NOTIFY screenGeometryChanged) + Q_PROPERTY(int availableWidth READ availableWidth NOTIFY availableGeometryChanged) + Q_PROPERTY(int availableHeight READ availableHeight NOTIFY availableGeometryChanged) + Q_PROPERTY(int screenCount READ screenCount NOTIFY screenCountChanged) + +public: + QDesktopItem(QObject* obj); + + int screenCount() const; + Q_INVOKABLE QRect screenGeometry(int screen) const; + Q_INVOKABLE QRect availableGeometry(int screen) const; + int screenWidth() const; + int screenHeight() const; + int availableWidth() const; + int availableHeight() const; + static QDesktopItem *qmlAttachedProperties(QObject *obj); + +private: + QDesktopWidget desktopWidget; + +Q_SIGNALS: + void screenGeometryChanged(); + void availableGeometryChanged(); + void screenCountChanged(); +}; + +QML_DECLARE_TYPEINFO(QDesktopItem, QML_HAS_ATTACHED_PROPERTIES) + +#endif // QDesktopItemITEM_H diff --git a/src/qtdesktop/qfiledialogitem.cpp b/src/qtdesktop/qfiledialogitem.cpp index 91f83c93..75359c7e 100644 --- a/src/qtdesktop/qfiledialogitem.cpp +++ b/src/qtdesktop/qfiledialogitem.cpp @@ -71,7 +71,7 @@ either by closing the dialog window or by pressing the Cancel button. */ -#include "qfiledialogitem.h" +#include "qfiledialogitem_p.h" #if QT_VERSION < 0x050000 #include diff --git a/src/qtdesktop/qfiledialogitem.h b/src/qtdesktop/qfiledialogitem.h deleted file mode 100644 index 1870a3a9..00000000 --- a/src/qtdesktop/qfiledialogitem.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Alberto Mardegan -** Contact: http://www.qt-project.org/ -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QFILEDIALOGITEM_H -#define QFILEDIALOGITEM_H - -#include -#if QT_VERSION < 0x050000 -#include -#include -#else -#include -#include -#endif -#include - -#if QT_VERSION < 0x050000 -class QFileDialogItem : public QDeclarativeItem -#else -class QFileDialogItem : public QQuickItem -#endif -{ - Q_OBJECT - Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) - Q_PROPERTY(bool modal READ modal WRITE setModal NOTIFY modalityChanged) - Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) - Q_PROPERTY(bool selectExisting READ selectExisting \ - WRITE setSelectExisting NOTIFY selectExistingChanged) - Q_PROPERTY(bool selectMultiple READ selectMultiple \ - WRITE setSelectMultiple NOTIFY selectMultipleChanged) - Q_PROPERTY(bool selectFolder READ selectFolder \ - WRITE setSelectFolder NOTIFY selectFolderChanged) - Q_PROPERTY(QString folder READ folder WRITE setFolder NOTIFY folderChanged) - Q_PROPERTY(QStringList nameFilters READ nameFilters \ - WRITE setNameFilters NOTIFY nameFiltersChanged) - Q_PROPERTY(QString filePath READ filePath NOTIFY accepted) - Q_PROPERTY(QStringList filePaths READ filePaths NOTIFY accepted) - -public: - QFileDialogItem(); - ~QFileDialogItem(); - - bool isVisible() const { return _dialog->isVisible(); } - QString title() const { return _dialog->windowTitle(); } - bool modal() const { return _dialog->isModal(); } - bool selectExisting() const { return _selectExisting; } - bool selectMultiple() const { return _selectMultiple; } - bool selectFolder() const { return _selectFolder; } - QString folder() const; - QStringList nameFilters() const { return _dialog->nameFilters(); } - QString filePath() const; - QStringList filePaths() const; - - void setVisible(bool visible); - void setTitle(QString title); - void setModal(bool modal); - void setSelectExisting(bool selectExisting); - void setSelectMultiple(bool selectMultiple); - void setSelectFolder(bool selectFolder); - void setFolder(const QString &folder); - void setNameFilters(const QStringList &nameFilters); - -public Q_SLOTS: - void open(); - void close(); - -Q_SIGNALS: - void titleChanged(); - void modalityChanged(); - void accepted(); - void rejected(); - void selectExistingChanged(); - void selectMultipleChanged(); - void selectFolderChanged(); - void folderChanged(); - void nameFiltersChanged(); - void visibleChanged(); - -protected: -#if QT_VERSION < 0x050000 - QVariant itemChange(GraphicsItemChange change, const QVariant &value); -#endif - -private: - void updateFileMode(); - -private: - QFileDialog *_dialog; - bool _isOpen; - bool _selectExisting; - bool _selectMultiple; - bool _selectFolder; -}; - -#endif // QFILEDIALOGITEM_H diff --git a/src/qtdesktop/qfiledialogitem_p.h b/src/qtdesktop/qfiledialogitem_p.h new file mode 100644 index 00000000..1870a3a9 --- /dev/null +++ b/src/qtdesktop/qfiledialogitem_p.h @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Alberto Mardegan +** Contact: http://www.qt-project.org/ +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFILEDIALOGITEM_H +#define QFILEDIALOGITEM_H + +#include +#if QT_VERSION < 0x050000 +#include +#include +#else +#include +#include +#endif +#include + +#if QT_VERSION < 0x050000 +class QFileDialogItem : public QDeclarativeItem +#else +class QFileDialogItem : public QQuickItem +#endif +{ + Q_OBJECT + Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(bool modal READ modal WRITE setModal NOTIFY modalityChanged) + Q_PROPERTY(QString title READ title WRITE setTitle NOTIFY titleChanged) + Q_PROPERTY(bool selectExisting READ selectExisting \ + WRITE setSelectExisting NOTIFY selectExistingChanged) + Q_PROPERTY(bool selectMultiple READ selectMultiple \ + WRITE setSelectMultiple NOTIFY selectMultipleChanged) + Q_PROPERTY(bool selectFolder READ selectFolder \ + WRITE setSelectFolder NOTIFY selectFolderChanged) + Q_PROPERTY(QString folder READ folder WRITE setFolder NOTIFY folderChanged) + Q_PROPERTY(QStringList nameFilters READ nameFilters \ + WRITE setNameFilters NOTIFY nameFiltersChanged) + Q_PROPERTY(QString filePath READ filePath NOTIFY accepted) + Q_PROPERTY(QStringList filePaths READ filePaths NOTIFY accepted) + +public: + QFileDialogItem(); + ~QFileDialogItem(); + + bool isVisible() const { return _dialog->isVisible(); } + QString title() const { return _dialog->windowTitle(); } + bool modal() const { return _dialog->isModal(); } + bool selectExisting() const { return _selectExisting; } + bool selectMultiple() const { return _selectMultiple; } + bool selectFolder() const { return _selectFolder; } + QString folder() const; + QStringList nameFilters() const { return _dialog->nameFilters(); } + QString filePath() const; + QStringList filePaths() const; + + void setVisible(bool visible); + void setTitle(QString title); + void setModal(bool modal); + void setSelectExisting(bool selectExisting); + void setSelectMultiple(bool selectMultiple); + void setSelectFolder(bool selectFolder); + void setFolder(const QString &folder); + void setNameFilters(const QStringList &nameFilters); + +public Q_SLOTS: + void open(); + void close(); + +Q_SIGNALS: + void titleChanged(); + void modalityChanged(); + void accepted(); + void rejected(); + void selectExistingChanged(); + void selectMultipleChanged(); + void selectFolderChanged(); + void folderChanged(); + void nameFiltersChanged(); + void visibleChanged(); + +protected: +#if QT_VERSION < 0x050000 + QVariant itemChange(GraphicsItemChange change, const QVariant &value); +#endif + +private: + void updateFileMode(); + +private: + QFileDialog *_dialog; + bool _isOpen; + bool _selectExisting; + bool _selectMultiple; + bool _selectFolder; +}; + +#endif // QFILEDIALOGITEM_H diff --git a/src/qtdesktop/qquickcomponentsprivate.cpp b/src/qtdesktop/qquickcomponentsprivate.cpp index 54b41b4c..9b8fd85d 100644 --- a/src/qtdesktop/qquickcomponentsprivate.cpp +++ b/src/qtdesktop/qquickcomponentsprivate.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qquickcomponentsprivate.h" +#include "qquickcomponentsprivate_p.h" #include #include diff --git a/src/qtdesktop/qquickcomponentsprivate.h b/src/qtdesktop/qquickcomponentsprivate.h deleted file mode 100644 index 5a5fa794..00000000 --- a/src/qtdesktop/qquickcomponentsprivate.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQUICKCOMPONENTSPRIVATE_H -#define QQUICKCOMPONENTSPRIVATE_H - -#include -#include - -class QQuickComponentsPrivate : public QObject -{ - Q_OBJECT - -public: - QQuickComponentsPrivate(QObject *parent = 0); - - Q_INVOKABLE void showToolTip(QQuickItem *item, const QPointF &pos, const QString &text); - Q_INVOKABLE void hideToolTip(); -}; - -#endif diff --git a/src/qtdesktop/qquickcomponentsprivate_p.h b/src/qtdesktop/qquickcomponentsprivate_p.h new file mode 100644 index 00000000..5a5fa794 --- /dev/null +++ b/src/qtdesktop/qquickcomponentsprivate_p.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKCOMPONENTSPRIVATE_H +#define QQUICKCOMPONENTSPRIVATE_H + +#include +#include + +class QQuickComponentsPrivate : public QObject +{ + Q_OBJECT + +public: + QQuickComponentsPrivate(QObject *parent = 0); + + Q_INVOKABLE void showToolTip(QQuickItem *item, const QPointF &pos, const QString &text); + Q_INVOKABLE void hideToolTip(); +}; + +#endif diff --git a/src/qtdesktop/qquicklayout.cpp b/src/qtdesktop/qquicklayout.cpp index 3c081446..f787c032 100644 --- a/src/qtdesktop/qquicklayout.cpp +++ b/src/qtdesktop/qquicklayout.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qquicklayout.h" +#include "qquicklayout_p.h" #include #include #include diff --git a/src/qtdesktop/qquicklayout.h b/src/qtdesktop/qquicklayout.h deleted file mode 100644 index 86f50266..00000000 --- a/src/qtdesktop/qquicklayout.h +++ /dev/null @@ -1,129 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVELAYOUT_H -#define QDECLARATIVELAYOUT_H - -#include -#include - -class QQuickComponentsLayoutAttached; - - -class QQuickComponentsLayout : public QQuickItem -{ - Q_OBJECT - Q_ENUMS(SizePolicy) - -public: - enum SizePolicy { - Fixed, - Expanding - }; - - explicit QQuickComponentsLayout(QQuickItem *parent = 0); - ~QQuickComponentsLayout(); - - static QQuickComponentsLayoutAttached *qmlAttachedProperties(QObject *object); - -protected: - void invalidate(); - bool event(QEvent *e); - void reconfigureTopDown(); - virtual void reconfigureLayout(); - void setupItemLayout(QQuickItem *item); - -private: - bool m_dirty; - - friend class QQuickComponentsLayoutAttached; -}; - - -class QQuickComponentsLayoutAttached : public QObject -{ - Q_OBJECT - Q_PROPERTY(qreal minimumWidth READ minimumWidth WRITE setMinimumWidth) - Q_PROPERTY(qreal minimumHeight READ minimumHeight WRITE setMinimumHeight) - Q_PROPERTY(qreal maximumWidth READ maximumWidth WRITE setMaximumWidth) - Q_PROPERTY(qreal maximumHeight READ maximumHeight WRITE setMaximumHeight) - Q_PROPERTY(QQuickComponentsLayout::SizePolicy verticalSizePolicy READ verticalSizePolicy WRITE setVerticalSizePolicy) - Q_PROPERTY(QQuickComponentsLayout::SizePolicy horizontalSizePolicy READ horizontalSizePolicy WRITE setHorizontalSizePolicy) - -public: - QQuickComponentsLayoutAttached(QObject *object); - - qreal minimumWidth() const { return m_minimumWidth; } - void setMinimumWidth(qreal width); - - qreal minimumHeight() const { return m_minimumHeight; } - void setMinimumHeight(qreal height); - - qreal maximumWidth() const { return m_maximumWidth; } - void setMaximumWidth(qreal width); - - qreal maximumHeight() const { return m_maximumHeight; } - void setMaximumHeight(qreal height); - - QQuickComponentsLayout::SizePolicy verticalSizePolicy() const { return m_verticalSizePolicy; } - void setVerticalSizePolicy(QQuickComponentsLayout::SizePolicy policy); - - QQuickComponentsLayout::SizePolicy horizontalSizePolicy() const { return m_horizontalSizePolicy; } - void setHorizontalSizePolicy(QQuickComponentsLayout::SizePolicy policy); - -protected: - void updateLayout(); - -private: - qreal m_minimumWidth; - qreal m_minimumHeight; - qreal m_maximumWidth; - qreal m_maximumHeight; - QQuickComponentsLayout::SizePolicy m_verticalSizePolicy; - QQuickComponentsLayout::SizePolicy m_horizontalSizePolicy; - QPointer m_layout; - - friend class QQuickComponentsLayout; -}; - -QML_DECLARE_TYPE(QQuickComponentsLayout) -QML_DECLARE_TYPEINFO(QQuickComponentsLayout, QML_HAS_ATTACHED_PROPERTIES) - -#endif diff --git a/src/qtdesktop/qquicklayout_p.h b/src/qtdesktop/qquicklayout_p.h new file mode 100644 index 00000000..86f50266 --- /dev/null +++ b/src/qtdesktop/qquicklayout_p.h @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVELAYOUT_H +#define QDECLARATIVELAYOUT_H + +#include +#include + +class QQuickComponentsLayoutAttached; + + +class QQuickComponentsLayout : public QQuickItem +{ + Q_OBJECT + Q_ENUMS(SizePolicy) + +public: + enum SizePolicy { + Fixed, + Expanding + }; + + explicit QQuickComponentsLayout(QQuickItem *parent = 0); + ~QQuickComponentsLayout(); + + static QQuickComponentsLayoutAttached *qmlAttachedProperties(QObject *object); + +protected: + void invalidate(); + bool event(QEvent *e); + void reconfigureTopDown(); + virtual void reconfigureLayout(); + void setupItemLayout(QQuickItem *item); + +private: + bool m_dirty; + + friend class QQuickComponentsLayoutAttached; +}; + + +class QQuickComponentsLayoutAttached : public QObject +{ + Q_OBJECT + Q_PROPERTY(qreal minimumWidth READ minimumWidth WRITE setMinimumWidth) + Q_PROPERTY(qreal minimumHeight READ minimumHeight WRITE setMinimumHeight) + Q_PROPERTY(qreal maximumWidth READ maximumWidth WRITE setMaximumWidth) + Q_PROPERTY(qreal maximumHeight READ maximumHeight WRITE setMaximumHeight) + Q_PROPERTY(QQuickComponentsLayout::SizePolicy verticalSizePolicy READ verticalSizePolicy WRITE setVerticalSizePolicy) + Q_PROPERTY(QQuickComponentsLayout::SizePolicy horizontalSizePolicy READ horizontalSizePolicy WRITE setHorizontalSizePolicy) + +public: + QQuickComponentsLayoutAttached(QObject *object); + + qreal minimumWidth() const { return m_minimumWidth; } + void setMinimumWidth(qreal width); + + qreal minimumHeight() const { return m_minimumHeight; } + void setMinimumHeight(qreal height); + + qreal maximumWidth() const { return m_maximumWidth; } + void setMaximumWidth(qreal width); + + qreal maximumHeight() const { return m_maximumHeight; } + void setMaximumHeight(qreal height); + + QQuickComponentsLayout::SizePolicy verticalSizePolicy() const { return m_verticalSizePolicy; } + void setVerticalSizePolicy(QQuickComponentsLayout::SizePolicy policy); + + QQuickComponentsLayout::SizePolicy horizontalSizePolicy() const { return m_horizontalSizePolicy; } + void setHorizontalSizePolicy(QQuickComponentsLayout::SizePolicy policy); + +protected: + void updateLayout(); + +private: + qreal m_minimumWidth; + qreal m_minimumHeight; + qreal m_maximumWidth; + qreal m_maximumHeight; + QQuickComponentsLayout::SizePolicy m_verticalSizePolicy; + QQuickComponentsLayout::SizePolicy m_horizontalSizePolicy; + QPointer m_layout; + + friend class QQuickComponentsLayout; +}; + +QML_DECLARE_TYPE(QQuickComponentsLayout) +QML_DECLARE_TYPEINFO(QQuickComponentsLayout, QML_HAS_ATTACHED_PROPERTIES) + +#endif diff --git a/src/qtdesktop/qquicklinearlayout.cpp b/src/qtdesktop/qquicklinearlayout.cpp index 9931f4ee..642e2fc7 100644 --- a/src/qtdesktop/qquicklinearlayout.cpp +++ b/src/qtdesktop/qquicklinearlayout.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qquicklinearlayout.h" +#include "qquicklinearlayout_p.h" #include "qquicklayoutengine_p.h" #include diff --git a/src/qtdesktop/qquicklinearlayout.h b/src/qtdesktop/qquicklinearlayout.h deleted file mode 100644 index 8cd73e86..00000000 --- a/src/qtdesktop/qquicklinearlayout.h +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the examples of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QDECLARATIVELINEARLAYOUT_H -#define QDECLARATIVELINEARLAYOUT_H - -#include "qquicklayout.h" - - -class QQuickComponentsLinearLayout : public QQuickComponentsLayout -{ - Q_OBJECT - Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) - -public: - enum Orientation { - Vertical, - Horizontal - }; - - explicit QQuickComponentsLinearLayout(Orientation orientation, - QQuickItem *parent = 0); - ~QQuickComponentsLinearLayout() {} - - qreal spacing() const; - void setSpacing(qreal spacing); - - Orientation orientation() const; - void setOrientation(Orientation orientation); - - void componentComplete(); - -signals: - void spacingChanged(); - void orientationChanged(); - -protected: - void updateLayoutItems(); - void reconfigureLayout(); - void insertLayoutItem(QQuickItem *item); - void removeLayoutItem(QQuickItem *item); - void itemChange(ItemChange change, const ItemChangeData &data); - void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); - -protected slots: - void onItemDestroyed(); - -private: - qreal m_spacing; - Orientation m_orientation; - QList m_items; -}; - - -class QQuickComponentsRowLayout : public QQuickComponentsLinearLayout -{ - Q_OBJECT - -public: - explicit QQuickComponentsRowLayout(QQuickItem *parent = 0) - : QQuickComponentsLinearLayout(Horizontal, parent) {} -}; - - -class QQuickComponentsColumnLayout : public QQuickComponentsLinearLayout -{ - Q_OBJECT - -public: - explicit QQuickComponentsColumnLayout(QQuickItem *parent = 0) - : QQuickComponentsLinearLayout(Vertical, parent) {} -}; - -#endif diff --git a/src/qtdesktop/qquicklinearlayout_p.h b/src/qtdesktop/qquicklinearlayout_p.h new file mode 100644 index 00000000..2209ce62 --- /dev/null +++ b/src/qtdesktop/qquicklinearlayout_p.h @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVELINEARLAYOUT_H +#define QDECLARATIVELINEARLAYOUT_H + +#include "qquicklayout_p.h" + + +class QQuickComponentsLinearLayout : public QQuickComponentsLayout +{ + Q_OBJECT + Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) + +public: + enum Orientation { + Vertical, + Horizontal + }; + + explicit QQuickComponentsLinearLayout(Orientation orientation, + QQuickItem *parent = 0); + ~QQuickComponentsLinearLayout() {} + + qreal spacing() const; + void setSpacing(qreal spacing); + + Orientation orientation() const; + void setOrientation(Orientation orientation); + + void componentComplete(); + +signals: + void spacingChanged(); + void orientationChanged(); + +protected: + void updateLayoutItems(); + void reconfigureLayout(); + void insertLayoutItem(QQuickItem *item); + void removeLayoutItem(QQuickItem *item); + void itemChange(ItemChange change, const ItemChangeData &data); + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); + +protected slots: + void onItemDestroyed(); + +private: + qreal m_spacing; + Orientation m_orientation; + QList m_items; +}; + + +class QQuickComponentsRowLayout : public QQuickComponentsLinearLayout +{ + Q_OBJECT + +public: + explicit QQuickComponentsRowLayout(QQuickItem *parent = 0) + : QQuickComponentsLinearLayout(Horizontal, parent) {} +}; + + +class QQuickComponentsColumnLayout : public QQuickComponentsLinearLayout +{ + Q_OBJECT + +public: + explicit QQuickComponentsColumnLayout(QQuickItem *parent = 0) + : QQuickComponentsLinearLayout(Vertical, parent) {} +}; + +#endif diff --git a/src/qtdesktop/qrangemodel.cpp b/src/qtdesktop/qrangemodel.cpp index d4c2d2e8..4d07e81b 100644 --- a/src/qtdesktop/qrangemodel.cpp +++ b/src/qtdesktop/qrangemodel.cpp @@ -64,8 +64,8 @@ #include #endif -#include "qrangemodel.h" #include "qrangemodel_p.h" +#include "qrangemodel_p_p.h" QRangeModelPrivate::QRangeModelPrivate(QRangeModel *qq) : q_ptr(qq) diff --git a/src/qtdesktop/qrangemodel.h b/src/qtdesktop/qrangemodel.h deleted file mode 100644 index 675967ae..00000000 --- a/src/qtdesktop/qrangemodel.h +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QRANGEMODEL_H -#define QRANGEMODEL_H - -#include -//#include -#include -#include - -class QRangeModelPrivate; - -class QRangeModel : public QObject -{ - Q_OBJECT - Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged USER true) - Q_PROPERTY(qreal minimumValue READ minimum WRITE setMinimum NOTIFY minimumChanged) - Q_PROPERTY(qreal maximumValue READ maximum WRITE setMaximum NOTIFY maximumChanged) - Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged) - Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged) - Q_PROPERTY(qreal positionAtMinimum READ positionAtMinimum WRITE setPositionAtMinimum NOTIFY positionAtMinimumChanged) - Q_PROPERTY(qreal positionAtMaximum READ positionAtMaximum WRITE setPositionAtMaximum NOTIFY positionAtMaximumChanged) - Q_PROPERTY(bool inverted READ inverted WRITE setInverted NOTIFY invertedChanged) - -public: - QRangeModel(QObject *parent = 0); - virtual ~QRangeModel(); - - void setRange(qreal min, qreal max); - void setPositionRange(qreal min, qreal max); - - void setStepSize(qreal stepSize); - qreal stepSize() const; - - void setMinimum(qreal min); - qreal minimum() const; - - void setMaximum(qreal max); - qreal maximum() const; - - void setPositionAtMinimum(qreal posAtMin); - qreal positionAtMinimum() const; - - void setPositionAtMaximum(qreal posAtMax); - qreal positionAtMaximum() const; - - void setInverted(bool inverted); - bool inverted() const; - - qreal value() const; - qreal position() const; - - Q_INVOKABLE qreal valueForPosition(qreal position) const; - Q_INVOKABLE qreal positionForValue(qreal value) const; - -public Q_SLOTS: - void toMinimum(); - void toMaximum(); - void setValue(qreal value); - void setPosition(qreal position); - -Q_SIGNALS: - void valueChanged(qreal value); - void positionChanged(qreal position); - - void stepSizeChanged(qreal stepSize); - - void invertedChanged(bool inverted); - - void minimumChanged(qreal min); - void maximumChanged(qreal max); - void positionAtMinimumChanged(qreal min); - void positionAtMaximumChanged(qreal max); - -protected: - QRangeModel(QRangeModelPrivate &dd, QObject *parent); - QRangeModelPrivate* d_ptr; - -private: - Q_DISABLE_COPY(QRangeModel) - Q_DECLARE_PRIVATE(QRangeModel) - -}; - -QML_DECLARE_TYPE(QRangeModel) - -#endif // QRANGEMODEL_H diff --git a/src/qtdesktop/qrangemodel_p.h b/src/qtdesktop/qrangemodel_p.h index 83b28949..675967ae 100644 --- a/src/qtdesktop/qrangemodel_p.h +++ b/src/qtdesktop/qrangemodel_p.h @@ -38,69 +38,88 @@ ** ****************************************************************************/ -#ifndef QRANGEMODEL_P_H -#define QRANGEMODEL_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt Components 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 "qrangemodel.h" - -class QRangeModelPrivate +#ifndef QRANGEMODEL_H +#define QRANGEMODEL_H + +#include +//#include +#include +#include + +class QRangeModelPrivate; + +class QRangeModel : public QObject { - Q_DECLARE_PUBLIC(QRangeModel) + Q_OBJECT + Q_PROPERTY(qreal value READ value WRITE setValue NOTIFY valueChanged USER true) + Q_PROPERTY(qreal minimumValue READ minimum WRITE setMinimum NOTIFY minimumChanged) + Q_PROPERTY(qreal maximumValue READ maximum WRITE setMaximum NOTIFY maximumChanged) + Q_PROPERTY(qreal stepSize READ stepSize WRITE setStepSize NOTIFY stepSizeChanged) + Q_PROPERTY(qreal position READ position WRITE setPosition NOTIFY positionChanged) + Q_PROPERTY(qreal positionAtMinimum READ positionAtMinimum WRITE setPositionAtMinimum NOTIFY positionAtMinimumChanged) + Q_PROPERTY(qreal positionAtMaximum READ positionAtMaximum WRITE setPositionAtMaximum NOTIFY positionAtMaximumChanged) + Q_PROPERTY(bool inverted READ inverted WRITE setInverted NOTIFY invertedChanged) + public: - QRangeModelPrivate(QRangeModel *qq); - virtual ~QRangeModelPrivate(); + QRangeModel(QObject *parent = 0); + virtual ~QRangeModel(); + + void setRange(qreal min, qreal max); + void setPositionRange(qreal min, qreal max); + + void setStepSize(qreal stepSize); + qreal stepSize() const; - void init(); + void setMinimum(qreal min); + qreal minimum() const; - qreal posatmin, posatmax; - qreal minimum, maximum, stepSize, pos, value; + void setMaximum(qreal max); + qreal maximum() const; - uint inverted : 1; + void setPositionAtMinimum(qreal posAtMin); + qreal positionAtMinimum() const; - QRangeModel *q_ptr; + void setPositionAtMaximum(qreal posAtMax); + qreal positionAtMaximum() const; - inline qreal effectivePosAtMin() const { - return inverted ? posatmax : posatmin; - } + void setInverted(bool inverted); + bool inverted() const; - inline qreal effectivePosAtMax() const { - return inverted ? posatmin : posatmax; - } + qreal value() const; + qreal position() const; - inline qreal equivalentPosition(qreal value) const { - // Return absolute position from absolute value - const qreal valueRange = maximum - minimum; - if (valueRange == 0) - return effectivePosAtMin(); + Q_INVOKABLE qreal valueForPosition(qreal position) const; + Q_INVOKABLE qreal positionForValue(qreal value) const; - const qreal scale = (effectivePosAtMax() - effectivePosAtMin()) / valueRange; - return (value - minimum) * scale + effectivePosAtMin(); - } +public Q_SLOTS: + void toMinimum(); + void toMaximum(); + void setValue(qreal value); + void setPosition(qreal position); - inline qreal equivalentValue(qreal pos) const { - // Return absolute value from absolute position - const qreal posRange = effectivePosAtMax() - effectivePosAtMin(); - if (posRange == 0) - return minimum; +Q_SIGNALS: + void valueChanged(qreal value); + void positionChanged(qreal position); - const qreal scale = (maximum - minimum) / posRange; - return (pos - effectivePosAtMin()) * scale + minimum; - } + void stepSizeChanged(qreal stepSize); + + void invertedChanged(bool inverted); + + void minimumChanged(qreal min); + void maximumChanged(qreal max); + void positionAtMinimumChanged(qreal min); + void positionAtMaximumChanged(qreal max); + +protected: + QRangeModel(QRangeModelPrivate &dd, QObject *parent); + QRangeModelPrivate* d_ptr; + +private: + Q_DISABLE_COPY(QRangeModel) + Q_DECLARE_PRIVATE(QRangeModel) - qreal publicPosition(qreal position) const; - qreal publicValue(qreal value) const; - void emitValueAndPositionIfChanged(const qreal oldValue, const qreal oldPosition); }; -#endif // QRANGEMODEL_P_H +QML_DECLARE_TYPE(QRangeModel) + +#endif // QRANGEMODEL_H diff --git a/src/qtdesktop/qrangemodel_p_p.h b/src/qtdesktop/qrangemodel_p_p.h new file mode 100644 index 00000000..376d0895 --- /dev/null +++ b/src/qtdesktop/qrangemodel_p_p.h @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QRANGEMODEL_P_H +#define QRANGEMODEL_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt Components 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 "qrangemodel_p.h" + +class QRangeModelPrivate +{ + Q_DECLARE_PUBLIC(QRangeModel) +public: + QRangeModelPrivate(QRangeModel *qq); + virtual ~QRangeModelPrivate(); + + void init(); + + qreal posatmin, posatmax; + qreal minimum, maximum, stepSize, pos, value; + + uint inverted : 1; + + QRangeModel *q_ptr; + + inline qreal effectivePosAtMin() const { + return inverted ? posatmax : posatmin; + } + + inline qreal effectivePosAtMax() const { + return inverted ? posatmin : posatmax; + } + + inline qreal equivalentPosition(qreal value) const { + // Return absolute position from absolute value + const qreal valueRange = maximum - minimum; + if (valueRange == 0) + return effectivePosAtMin(); + + const qreal scale = (effectivePosAtMax() - effectivePosAtMin()) / valueRange; + return (value - minimum) * scale + effectivePosAtMin(); + } + + inline qreal equivalentValue(qreal pos) const { + // Return absolute value from absolute position + const qreal posRange = effectivePosAtMax() - effectivePosAtMin(); + if (posRange == 0) + return minimum; + + const qreal scale = (maximum - minimum) / posRange; + return (pos - effectivePosAtMin()) * scale + minimum; + } + + qreal publicPosition(qreal position) const; + qreal publicValue(qreal value) const; + void emitValueAndPositionIfChanged(const qreal oldValue, const qreal oldPosition); +}; + +#endif // QRANGEMODEL_P_H diff --git a/src/qtdesktop/qstyleitem.cpp b/src/qtdesktop/qstyleitem.cpp index 462f2759..43fade92 100644 --- a/src/qtdesktop/qstyleitem.cpp +++ b/src/qtdesktop/qstyleitem.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qstyleitem.h" +#include "qstyleitem_p.h" #include #include diff --git a/src/qtdesktop/qstyleitem.h b/src/qtdesktop/qstyleitem.h deleted file mode 100644 index 6b274060..00000000 --- a/src/qtdesktop/qstyleitem.h +++ /dev/null @@ -1,254 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef STYLEWRAPPER_H -#define STYLEWRAPPER_H - -#include -#include -#include - -class QStyleItem: public QQuickPaintedItem -{ - Q_OBJECT - - Q_PROPERTY( bool sunken READ sunken WRITE setSunken NOTIFY sunkenChanged) - Q_PROPERTY( bool raised READ raised WRITE setRaised NOTIFY raisedChanged) - Q_PROPERTY( bool active READ active WRITE setActive NOTIFY activeChanged) - Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectedChanged) - Q_PROPERTY( bool hasFocus READ hasFocus WRITE sethasFocus NOTIFY hasFocusChanged) - Q_PROPERTY( bool on READ on WRITE setOn NOTIFY onChanged) - Q_PROPERTY( bool hover READ hover WRITE setHover NOTIFY hoverChanged) - Q_PROPERTY( bool horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged) - - Q_PROPERTY( QString elementType READ elementType WRITE setElementType NOTIFY elementTypeChanged) - Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged) - Q_PROPERTY( QString activeControl READ activeControl WRITE setActiveControl NOTIFY activeControlChanged) - Q_PROPERTY( QString info READ info WRITE setInfo NOTIFY infoChanged) - Q_PROPERTY( QString style READ style NOTIFY styleChanged) - Q_PROPERTY( QStringList hint READ hint WRITE setHint NOTIFY hintChanged) - Q_PROPERTY( QFont font READ font NOTIFY fontChanged) - - // For range controls - Q_PROPERTY( int minimum READ minimum WRITE setMinimum NOTIFY minimumChanged) - Q_PROPERTY( int maximum READ maximum WRITE setMaximum NOTIFY maximumChanged) - Q_PROPERTY( int value READ value WRITE setValue NOTIFY valueChanged) - Q_PROPERTY( int step READ step WRITE setStep NOTIFY stepChanged) - Q_PROPERTY( int paintMargins READ paintMargins WRITE setPaintMargins NOTIFY paintMarginsChanged) - - Q_PROPERTY( int contentWidth READ contentWidth() WRITE setContentWidth NOTIFY contentWidthChanged) - Q_PROPERTY( int contentHeight READ contentHeight() WRITE setContentHeight NOTIFY contentHeightChanged) - -public: - QStyleItem(QQuickPaintedItem *parent = 0); - ~QStyleItem(); - - enum Type { - Undefined, - Button, - RadioButton, - CheckBox, - ComboBox, - ComboBoxItem, - Dial, - ToolBar, - ToolButton, - Tab, - TabFrame, - Frame, - FocusFrame, - SpinBox, - Slider, - ScrollBar, - ProgressBar, - Edit, - GroupBox, - Header, - Item, - ItemRow, - Splitter, - Menu, - MenuItem, - Widget, - StatusBar, - ScrollAreaCorner, - MacHelpButton, - MenuBar, - MenuBarItem - }; - - void paint(QPainter *); - - bool sunken() const { return m_sunken; } - bool raised() const { return m_raised; } - bool active() const { return m_active; } - bool selected() const { return m_selected; } - bool hasFocus() const { return m_focus; } - bool on() const { return m_on; } - bool hover() const { return m_hover; } - bool horizontal() const { return m_horizontal; } - - int minimum() const { return m_minimum; } - int maximum() const { return m_maximum; } - int step() const { return m_step; } - int value() const { return m_value; } - int paintMargins() const { return m_paintMargins; } - - QString elementType() const { return m_type; } - QString text() const { return m_text; } - QString activeControl() const { return m_activeControl; } - QString info() const { return m_info; } - QStringList hint() const { return m_hint; } - QFont font() const { return m_font;} - QString style() const; - - void setSunken(bool sunken) { if (m_sunken != sunken) {m_sunken = sunken; emit sunkenChanged();}} - void setRaised(bool raised) { if (m_raised!= raised) {m_raised = raised; emit raisedChanged();}} - void setActive(bool active) { if (m_active!= active) {m_active = active; emit activeChanged();}} - void setSelected(bool selected) { if (m_selected!= selected) {m_selected = selected; emit selectedChanged();}} - void sethasFocus(bool focus) { if (m_focus != focus) {m_focus = focus; emit hasFocusChanged();}} - void setOn(bool on) { if (m_on != on) {m_on = on ; emit onChanged();}} - void setHover(bool hover) { if (m_hover != hover) {m_hover = hover ; emit hoverChanged();}} - void setHorizontal(bool horizontal) { if (m_horizontal != horizontal) {m_horizontal = horizontal; emit horizontalChanged();}} - void setMinimum(int minimum) { if (m_minimum!= minimum) {m_minimum = minimum; emit minimumChanged();}} - void setMaximum(int maximum) { if (m_maximum != maximum) {m_maximum = maximum; emit maximumChanged();}} - void setValue(int value) { if (m_value!= value) {m_value = value; emit valueChanged();}} - void setStep(int step) { if (m_step != step) { m_step = step; emit stepChanged(); }} - void setPaintMargins(int value) { if (m_paintMargins!= value) {m_paintMargins = value;} } - void setElementType(const QString &str); - void setText(const QString &str) { if (m_text != str) {m_text = str; emit textChanged();}} - void setActiveControl(const QString &str) { if (m_activeControl != str) {m_activeControl = str; emit activeControlChanged();}} - void setInfo(const QString &str) { if (m_info != str) {m_info = str; emit infoChanged();}} - void setHint(const QStringList &str); - - int contentWidth() const { return m_contentWidth; } - int contentHeight() const { return m_contentHeight; } - - virtual void initStyleOption (); - -public Q_SLOTS: - int pixelMetric(const QString&); - QVariant styleHint(const QString&); - void updateSizeHint(); - void updateItem(){initStyleOption(); update();} - QString hitTest(int x, int y); - QRectF subControlRect(const QString &subcontrolString); - QString elidedText(const QString &text, int elideMode, int width); - int textWidth(const QString &); - bool hasThemeIcon(const QString &) const; - - void setContentWidth(int arg) - { - if (m_contentWidth != arg) { - m_contentWidth = arg; - emit contentWidthChanged(arg); - } - } - - void setContentHeight(int arg) - { - if (m_contentHeight != arg) { - m_contentHeight = arg; - emit contentHeightChanged(arg); - } - } - -Q_SIGNALS: - void elementTypeChanged(); - void textChanged(); - void sunkenChanged(); - void raisedChanged(); - void activeChanged(); - void selectedChanged(); - void hasFocusChanged(); - void onChanged(); - void hoverChanged(); - void horizontalChanged(); - void minimumChanged(); - void maximumChanged(); - void stepChanged(); - void valueChanged(); - void activeControlChanged(); - void infoChanged(); - void styleChanged(); - void paintMarginsChanged(); - void hintChanged(); - void fontChanged(); - - void contentWidthChanged(int arg); - void contentHeightChanged(int arg); - -private: - QSize sizeFromContents(int width, int height); - -protected: - QWidget *m_dummywidget; - QStyleOption *m_styleoption; - Type m_itemType; - - QString m_type; - QString m_text; - QString m_activeControl; - QString m_info; - QStringList m_hint; - QFont m_font; - - bool m_sunken; - bool m_raised; - bool m_active; - bool m_selected; - bool m_focus; - bool m_hover; - bool m_on; - bool m_horizontal; - bool m_sharedWidget; - - int m_minimum; - int m_maximum; - int m_value; - int m_step; - int m_paintMargins; - - int m_contentWidth; - int m_contentHeight; - -}; - -#endif //STYLEWRAPPER_H diff --git a/src/qtdesktop/qstyleitem_p.h b/src/qtdesktop/qstyleitem_p.h new file mode 100644 index 00000000..6b274060 --- /dev/null +++ b/src/qtdesktop/qstyleitem_p.h @@ -0,0 +1,254 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef STYLEWRAPPER_H +#define STYLEWRAPPER_H + +#include +#include +#include + +class QStyleItem: public QQuickPaintedItem +{ + Q_OBJECT + + Q_PROPERTY( bool sunken READ sunken WRITE setSunken NOTIFY sunkenChanged) + Q_PROPERTY( bool raised READ raised WRITE setRaised NOTIFY raisedChanged) + Q_PROPERTY( bool active READ active WRITE setActive NOTIFY activeChanged) + Q_PROPERTY( bool selected READ selected WRITE setSelected NOTIFY selectedChanged) + Q_PROPERTY( bool hasFocus READ hasFocus WRITE sethasFocus NOTIFY hasFocusChanged) + Q_PROPERTY( bool on READ on WRITE setOn NOTIFY onChanged) + Q_PROPERTY( bool hover READ hover WRITE setHover NOTIFY hoverChanged) + Q_PROPERTY( bool horizontal READ horizontal WRITE setHorizontal NOTIFY horizontalChanged) + + Q_PROPERTY( QString elementType READ elementType WRITE setElementType NOTIFY elementTypeChanged) + Q_PROPERTY( QString text READ text WRITE setText NOTIFY textChanged) + Q_PROPERTY( QString activeControl READ activeControl WRITE setActiveControl NOTIFY activeControlChanged) + Q_PROPERTY( QString info READ info WRITE setInfo NOTIFY infoChanged) + Q_PROPERTY( QString style READ style NOTIFY styleChanged) + Q_PROPERTY( QStringList hint READ hint WRITE setHint NOTIFY hintChanged) + Q_PROPERTY( QFont font READ font NOTIFY fontChanged) + + // For range controls + Q_PROPERTY( int minimum READ minimum WRITE setMinimum NOTIFY minimumChanged) + Q_PROPERTY( int maximum READ maximum WRITE setMaximum NOTIFY maximumChanged) + Q_PROPERTY( int value READ value WRITE setValue NOTIFY valueChanged) + Q_PROPERTY( int step READ step WRITE setStep NOTIFY stepChanged) + Q_PROPERTY( int paintMargins READ paintMargins WRITE setPaintMargins NOTIFY paintMarginsChanged) + + Q_PROPERTY( int contentWidth READ contentWidth() WRITE setContentWidth NOTIFY contentWidthChanged) + Q_PROPERTY( int contentHeight READ contentHeight() WRITE setContentHeight NOTIFY contentHeightChanged) + +public: + QStyleItem(QQuickPaintedItem *parent = 0); + ~QStyleItem(); + + enum Type { + Undefined, + Button, + RadioButton, + CheckBox, + ComboBox, + ComboBoxItem, + Dial, + ToolBar, + ToolButton, + Tab, + TabFrame, + Frame, + FocusFrame, + SpinBox, + Slider, + ScrollBar, + ProgressBar, + Edit, + GroupBox, + Header, + Item, + ItemRow, + Splitter, + Menu, + MenuItem, + Widget, + StatusBar, + ScrollAreaCorner, + MacHelpButton, + MenuBar, + MenuBarItem + }; + + void paint(QPainter *); + + bool sunken() const { return m_sunken; } + bool raised() const { return m_raised; } + bool active() const { return m_active; } + bool selected() const { return m_selected; } + bool hasFocus() const { return m_focus; } + bool on() const { return m_on; } + bool hover() const { return m_hover; } + bool horizontal() const { return m_horizontal; } + + int minimum() const { return m_minimum; } + int maximum() const { return m_maximum; } + int step() const { return m_step; } + int value() const { return m_value; } + int paintMargins() const { return m_paintMargins; } + + QString elementType() const { return m_type; } + QString text() const { return m_text; } + QString activeControl() const { return m_activeControl; } + QString info() const { return m_info; } + QStringList hint() const { return m_hint; } + QFont font() const { return m_font;} + QString style() const; + + void setSunken(bool sunken) { if (m_sunken != sunken) {m_sunken = sunken; emit sunkenChanged();}} + void setRaised(bool raised) { if (m_raised!= raised) {m_raised = raised; emit raisedChanged();}} + void setActive(bool active) { if (m_active!= active) {m_active = active; emit activeChanged();}} + void setSelected(bool selected) { if (m_selected!= selected) {m_selected = selected; emit selectedChanged();}} + void sethasFocus(bool focus) { if (m_focus != focus) {m_focus = focus; emit hasFocusChanged();}} + void setOn(bool on) { if (m_on != on) {m_on = on ; emit onChanged();}} + void setHover(bool hover) { if (m_hover != hover) {m_hover = hover ; emit hoverChanged();}} + void setHorizontal(bool horizontal) { if (m_horizontal != horizontal) {m_horizontal = horizontal; emit horizontalChanged();}} + void setMinimum(int minimum) { if (m_minimum!= minimum) {m_minimum = minimum; emit minimumChanged();}} + void setMaximum(int maximum) { if (m_maximum != maximum) {m_maximum = maximum; emit maximumChanged();}} + void setValue(int value) { if (m_value!= value) {m_value = value; emit valueChanged();}} + void setStep(int step) { if (m_step != step) { m_step = step; emit stepChanged(); }} + void setPaintMargins(int value) { if (m_paintMargins!= value) {m_paintMargins = value;} } + void setElementType(const QString &str); + void setText(const QString &str) { if (m_text != str) {m_text = str; emit textChanged();}} + void setActiveControl(const QString &str) { if (m_activeControl != str) {m_activeControl = str; emit activeControlChanged();}} + void setInfo(const QString &str) { if (m_info != str) {m_info = str; emit infoChanged();}} + void setHint(const QStringList &str); + + int contentWidth() const { return m_contentWidth; } + int contentHeight() const { return m_contentHeight; } + + virtual void initStyleOption (); + +public Q_SLOTS: + int pixelMetric(const QString&); + QVariant styleHint(const QString&); + void updateSizeHint(); + void updateItem(){initStyleOption(); update();} + QString hitTest(int x, int y); + QRectF subControlRect(const QString &subcontrolString); + QString elidedText(const QString &text, int elideMode, int width); + int textWidth(const QString &); + bool hasThemeIcon(const QString &) const; + + void setContentWidth(int arg) + { + if (m_contentWidth != arg) { + m_contentWidth = arg; + emit contentWidthChanged(arg); + } + } + + void setContentHeight(int arg) + { + if (m_contentHeight != arg) { + m_contentHeight = arg; + emit contentHeightChanged(arg); + } + } + +Q_SIGNALS: + void elementTypeChanged(); + void textChanged(); + void sunkenChanged(); + void raisedChanged(); + void activeChanged(); + void selectedChanged(); + void hasFocusChanged(); + void onChanged(); + void hoverChanged(); + void horizontalChanged(); + void minimumChanged(); + void maximumChanged(); + void stepChanged(); + void valueChanged(); + void activeControlChanged(); + void infoChanged(); + void styleChanged(); + void paintMarginsChanged(); + void hintChanged(); + void fontChanged(); + + void contentWidthChanged(int arg); + void contentHeightChanged(int arg); + +private: + QSize sizeFromContents(int width, int height); + +protected: + QWidget *m_dummywidget; + QStyleOption *m_styleoption; + Type m_itemType; + + QString m_type; + QString m_text; + QString m_activeControl; + QString m_info; + QStringList m_hint; + QFont m_font; + + bool m_sunken; + bool m_raised; + bool m_active; + bool m_selected; + bool m_focus; + bool m_hover; + bool m_on; + bool m_horizontal; + bool m_sharedWidget; + + int m_minimum; + int m_maximum; + int m_value; + int m_step; + int m_paintMargins; + + int m_contentWidth; + int m_contentHeight; + +}; + +#endif //STYLEWRAPPER_H diff --git a/src/qtdesktop/qstyleplugin.cpp b/src/qtdesktop/qstyleplugin.cpp index 500d4ee6..384ed62c 100644 --- a/src/qtdesktop/qstyleplugin.cpp +++ b/src/qtdesktop/qstyleplugin.cpp @@ -39,17 +39,17 @@ ****************************************************************************/ #include -#include "qstyleplugin.h" -#include "qstyleitem.h" -#include "qrangemodel.h" -#include "qtmenu.h" -#include "qtmenubar.h" -#include "qdesktopitem.h" -#include "qwheelarea.h" -#include "qtsplitterbase.h" -#include "qquicklinearlayout.h" -#include "qquickcomponentsprivate.h" -#include "qfiledialogitem.h" +#include "qstyleplugin_p.h" +#include "qstyleitem_p.h" +#include "qrangemodel_p.h" +#include "qtmenu_p.h" +#include "qtmenubar_p.h" +#include "qdesktopitem_p.h" +#include "qwheelarea_p.h" +#include "qtsplitterbase_p.h" +#include "qquicklinearlayout_p.h" +#include "qquickcomponentsprivate_p.h" +#include "qfiledialogitem_p.h" #include #include diff --git a/src/qtdesktop/qstyleplugin.h b/src/qtdesktop/qstyleplugin.h deleted file mode 100644 index 2bdb2a81..00000000 --- a/src/qtdesktop/qstyleplugin.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef STYLEPLUGIN_H -#define STYLEPLUGIN_H - -#include -#include -#include - -class StylePlugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.playground.qtdesktopcomponents.QQmlExtensionInterface" FILE "styleplugin.json") -public: - void registerTypes(const char *uri); - void initializeEngine(QQmlEngine *engine, const char *uri); -}; - -#endif // STYLEPLUGIN_H diff --git a/src/qtdesktop/qstyleplugin_p.h b/src/qtdesktop/qstyleplugin_p.h new file mode 100644 index 00000000..2bdb2a81 --- /dev/null +++ b/src/qtdesktop/qstyleplugin_p.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef STYLEPLUGIN_H +#define STYLEPLUGIN_H + +#include +#include +#include + +class StylePlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.playground.qtdesktopcomponents.QQmlExtensionInterface" FILE "styleplugin.json") +public: + void registerTypes(const char *uri); + void initializeEngine(QQmlEngine *engine, const char *uri); +}; + +#endif // STYLEPLUGIN_H diff --git a/src/qtdesktop/qtmenu.cpp b/src/qtdesktop/qtmenu.cpp index e6859df7..94ee5d14 100644 --- a/src/qtdesktop/qtmenu.cpp +++ b/src/qtdesktop/qtmenu.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qtmenu.h" +#include "qtmenu_p.h" #include "qdebug.h" #include #include diff --git a/src/qtdesktop/qtmenu.h b/src/qtdesktop/qtmenu.h deleted file mode 100644 index d718b55b..00000000 --- a/src/qtdesktop/qtmenu.h +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTMLMENU_H -#define QTMLMENU_H -#include -#include -#include -#include -#include -#include -#include "qtmenuitem.h" - -class QtMenu : public QtMenuBase -{ - Q_OBJECT - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) - Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) - Q_PROPERTY(int selectedIndex READ selectedIndex WRITE setSelectedIndex NOTIFY selectedIndexChanged) - Q_PROPERTY(int hoveredIndex READ hoveredIndex WRITE setHoveredIndex NOTIFY hoveredIndexChanged) - Q_PROPERTY(QQmlListProperty menuItems READ menuItems) - Q_CLASSINFO("DefaultProperty", "menuItems") -public: - QtMenu(QQuickItem *parent = 0); - virtual ~QtMenu(); - - void setText(const QString &text); - QString text() const; - - int selectedIndex() const { return m_selectedIndex; } - void setSelectedIndex(int index); - int hoveredIndex() const { return m_highlightedIndex; } - void setHoveredIndex(int index); - - QQmlListProperty menuItems(); - - QMenu* qmenu() { return m_qmenu; } - - QAction* action(); - - Q_INVOKABLE int minimumWidth() const { return m_qmenu->minimumWidth(); } - Q_INVOKABLE void setMinimumWidth(int w) { m_qmenu->setMinimumWidth(w); } - Q_INVOKABLE void showPopup(qreal x, qreal y, int atActionIndex = -1, QQuickWindow *window = 0); - Q_INVOKABLE void hidePopup(); - Q_INVOKABLE void clearMenuItems(); - Q_INVOKABLE void addMenuItem(const QString &text); - Q_INVOKABLE QString itemTextAt(int index) const; - Q_INVOKABLE QString modelTextAt(int index) const; - Q_INVOKABLE int modelCount() const; - - QVariant model() const { return m_model; } - Q_INVOKABLE bool hasNativeModel() const { return m_hasNativeModel; } - -public slots: - void setModel(const QVariant &newModel); - -public: -Q_SIGNALS: - void menuClosed(); - void selectedIndexChanged(); - void hoveredIndexChanged(); - void modelChanged(const QVariant &newModel); - void rebuildMenu(); - void textChanged(); - -private Q_SLOTS: - void emitSelected(); - void emitHovered(); - -private: - static void append_qmenuItem(QQmlListProperty *list, QtMenuBase *menuItem); - - QWidget *dummy; - QMenu *m_qmenu; - QList m_qmenuItems; - int m_selectedIndex; - int m_highlightedIndex; - bool m_hasNativeModel; - QVariant m_model; -}; - -QML_DECLARE_TYPE(QtMenu) - -#endif // QTMLMENU_H diff --git a/src/qtdesktop/qtmenu_p.h b/src/qtdesktop/qtmenu_p.h new file mode 100644 index 00000000..cc4bc87e --- /dev/null +++ b/src/qtdesktop/qtmenu_p.h @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTMLMENU_H +#define QTMLMENU_H +#include +#include +#include +#include +#include +#include +#include "qtmenuitem_p.h" + +class QtMenu : public QtMenuBase +{ + Q_OBJECT + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) + Q_PROPERTY(QVariant model READ model WRITE setModel NOTIFY modelChanged) + Q_PROPERTY(int selectedIndex READ selectedIndex WRITE setSelectedIndex NOTIFY selectedIndexChanged) + Q_PROPERTY(int hoveredIndex READ hoveredIndex WRITE setHoveredIndex NOTIFY hoveredIndexChanged) + Q_PROPERTY(QQmlListProperty menuItems READ menuItems) + Q_CLASSINFO("DefaultProperty", "menuItems") +public: + QtMenu(QQuickItem *parent = 0); + virtual ~QtMenu(); + + void setText(const QString &text); + QString text() const; + + int selectedIndex() const { return m_selectedIndex; } + void setSelectedIndex(int index); + int hoveredIndex() const { return m_highlightedIndex; } + void setHoveredIndex(int index); + + QQmlListProperty menuItems(); + + QMenu* qmenu() { return m_qmenu; } + + QAction* action(); + + Q_INVOKABLE int minimumWidth() const { return m_qmenu->minimumWidth(); } + Q_INVOKABLE void setMinimumWidth(int w) { m_qmenu->setMinimumWidth(w); } + Q_INVOKABLE void showPopup(qreal x, qreal y, int atActionIndex = -1, QQuickWindow *window = 0); + Q_INVOKABLE void hidePopup(); + Q_INVOKABLE void clearMenuItems(); + Q_INVOKABLE void addMenuItem(const QString &text); + Q_INVOKABLE QString itemTextAt(int index) const; + Q_INVOKABLE QString modelTextAt(int index) const; + Q_INVOKABLE int modelCount() const; + + QVariant model() const { return m_model; } + Q_INVOKABLE bool hasNativeModel() const { return m_hasNativeModel; } + +public slots: + void setModel(const QVariant &newModel); + +public: +Q_SIGNALS: + void menuClosed(); + void selectedIndexChanged(); + void hoveredIndexChanged(); + void modelChanged(const QVariant &newModel); + void rebuildMenu(); + void textChanged(); + +private Q_SLOTS: + void emitSelected(); + void emitHovered(); + +private: + static void append_qmenuItem(QQmlListProperty *list, QtMenuBase *menuItem); + + QWidget *dummy; + QMenu *m_qmenu; + QList m_qmenuItems; + int m_selectedIndex; + int m_highlightedIndex; + bool m_hasNativeModel; + QVariant m_model; +}; + +QML_DECLARE_TYPE(QtMenu) + +#endif // QTMLMENU_H diff --git a/src/qtdesktop/qtmenubar.cpp b/src/qtdesktop/qtmenubar.cpp index 76f31bc1..bab24c8e 100644 --- a/src/qtdesktop/qtmenubar.cpp +++ b/src/qtdesktop/qtmenubar.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qtmenubar.h" +#include "qtmenubar_p.h" #include #include diff --git a/src/qtdesktop/qtmenubar.h b/src/qtdesktop/qtmenubar.h deleted file mode 100644 index 6f762bb7..00000000 --- a/src/qtdesktop/qtmenubar.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTMENUBAR_H -#define QTMENUBAR_H - -#include - -#include -#include - -#include "qtmenu.h" - -class QtMenuBar: public QQuickItem -{ - Q_OBJECT - - Q_PROPERTY(QQmlListProperty menus READ menus NOTIFY menuChanged) - Q_PROPERTY(QList menuList READ menuList NOTIFY menuChanged) - Q_PROPERTY(bool showMenuBar READ showMenuBar NOTIFY showMenuBarChanged) - Q_CLASSINFO("DefaultProperty", "menus") -public: - QtMenuBar(QQuickItem *parent = 0); - ~QtMenuBar(); - - QQmlListProperty menus(); - QList menuList(); - - bool showMenuBar() { -#ifdef Q_OS_MAC - return false; -#endif - return true; -} - -signals: - void menuChanged(); - void showMenuBarChanged(); - -protected Q_SLOTS: - void updateParent(QQuickItem *newParent); - -private: - static void append_menu(QQmlListProperty *list, QtMenu *menu); - -private: - QList m_menus; - QMenuBar *_menuBar; -}; - -#endif //QTMENUBAR_H diff --git a/src/qtdesktop/qtmenubar_p.h b/src/qtdesktop/qtmenubar_p.h new file mode 100644 index 00000000..b1090287 --- /dev/null +++ b/src/qtdesktop/qtmenubar_p.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTMENUBAR_H +#define QTMENUBAR_H + +#include + +#include +#include + +#include "qtmenu_p.h" + +class QtMenuBar: public QQuickItem +{ + Q_OBJECT + + Q_PROPERTY(QQmlListProperty menus READ menus NOTIFY menuChanged) + Q_PROPERTY(QList menuList READ menuList NOTIFY menuChanged) + Q_PROPERTY(bool showMenuBar READ showMenuBar NOTIFY showMenuBarChanged) + Q_CLASSINFO("DefaultProperty", "menus") +public: + QtMenuBar(QQuickItem *parent = 0); + ~QtMenuBar(); + + QQmlListProperty menus(); + QList menuList(); + + bool showMenuBar() { +#ifdef Q_OS_MAC + return false; +#endif + return true; +} + +signals: + void menuChanged(); + void showMenuBarChanged(); + +protected Q_SLOTS: + void updateParent(QQuickItem *newParent); + +private: + static void append_menu(QQmlListProperty *list, QtMenu *menu); + +private: + QList m_menus; + QMenuBar *_menuBar; +}; + +#endif //QTMENUBAR_H diff --git a/src/qtdesktop/qtmenuitem.cpp b/src/qtdesktop/qtmenuitem.cpp index d814157e..8e4d82cd 100644 --- a/src/qtdesktop/qtmenuitem.cpp +++ b/src/qtdesktop/qtmenuitem.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qtmenuitem.h" +#include "qtmenuitem_p.h" void QtMenuBase::setIconSource(const QUrl &icon) { diff --git a/src/qtdesktop/qtmenuitem.h b/src/qtdesktop/qtmenuitem.h deleted file mode 100644 index 5ee11671..00000000 --- a/src/qtdesktop/qtmenuitem.h +++ /dev/null @@ -1,126 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTMENUITEM_H -#define QTMENUITEM_H - -#include -#include -#include - -#include - -class QtMenuBase: public QQuickItem -{ -Q_OBJECT - Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource NOTIFY iconSourceChanged) - Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged) - -public: - QtMenuBase(QQuickItem *parent = 0) : QQuickItem(parent) {} - - virtual QAction* action() = 0; - - void setIconSource(const QUrl &icon); - QUrl iconSource() const; - - void setIconName(const QString &icon); - QString iconName() const; - -Q_SIGNALS: - void iconSourceChanged(); - void iconNameChanged(); - -private: - QUrl _iconSource; - QString _iconName; -}; - -class QtMenuSeparator : public QtMenuBase -{ - Q_OBJECT -public: - QtMenuSeparator(QQuickItem *parent = 0); - ~QtMenuSeparator(); - QAction* action(); - -private: - QAction *_action; -}; - -class QtMenuItem: public QtMenuBase -{ - Q_OBJECT - Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged); - Q_PROPERTY(QString shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged) - Q_PROPERTY(bool checkable READ checkable WRITE setCheckable) - Q_PROPERTY(bool checked READ checked WRITE setChecked NOTIFY toggled) - Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) - -public: - QtMenuItem(QQuickItem *parent = 0); - ~QtMenuItem(); - - void setText(const QString &text); - void setShortcut(const QString &shortcut); - void setCheckable(bool checkable); - void setChecked(bool checked); - void setEnabled(bool enabled); - - QString text() const; - QString shortcut() const; - bool checkable() const; - bool checked() const; - bool enabled() const; - - QAction* action(); - -Q_SIGNALS: - void triggered(); - void textChanged(); - void shortcutChanged(); - void toggled(bool); - void enabledChanged(); - -private: - QAction *_action; -}; - -#endif //QTMENUITEM_H diff --git a/src/qtdesktop/qtmenuitem_p.h b/src/qtdesktop/qtmenuitem_p.h new file mode 100644 index 00000000..5ee11671 --- /dev/null +++ b/src/qtdesktop/qtmenuitem_p.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTMENUITEM_H +#define QTMENUITEM_H + +#include +#include +#include + +#include + +class QtMenuBase: public QQuickItem +{ +Q_OBJECT + Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource NOTIFY iconSourceChanged) + Q_PROPERTY(QString iconName READ iconName WRITE setIconName NOTIFY iconNameChanged) + +public: + QtMenuBase(QQuickItem *parent = 0) : QQuickItem(parent) {} + + virtual QAction* action() = 0; + + void setIconSource(const QUrl &icon); + QUrl iconSource() const; + + void setIconName(const QString &icon); + QString iconName() const; + +Q_SIGNALS: + void iconSourceChanged(); + void iconNameChanged(); + +private: + QUrl _iconSource; + QString _iconName; +}; + +class QtMenuSeparator : public QtMenuBase +{ + Q_OBJECT +public: + QtMenuSeparator(QQuickItem *parent = 0); + ~QtMenuSeparator(); + QAction* action(); + +private: + QAction *_action; +}; + +class QtMenuItem: public QtMenuBase +{ + Q_OBJECT + Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged); + Q_PROPERTY(QString shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged) + Q_PROPERTY(bool checkable READ checkable WRITE setCheckable) + Q_PROPERTY(bool checked READ checked WRITE setChecked NOTIFY toggled) + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) + +public: + QtMenuItem(QQuickItem *parent = 0); + ~QtMenuItem(); + + void setText(const QString &text); + void setShortcut(const QString &shortcut); + void setCheckable(bool checkable); + void setChecked(bool checked); + void setEnabled(bool enabled); + + QString text() const; + QString shortcut() const; + bool checkable() const; + bool checked() const; + bool enabled() const; + + QAction* action(); + +Q_SIGNALS: + void triggered(); + void textChanged(); + void shortcutChanged(); + void toggled(bool); + void enabledChanged(); + +private: + QAction *_action; +}; + +#endif //QTMENUITEM_H diff --git a/src/qtdesktop/qtsplitterbase.cpp b/src/qtdesktop/qtsplitterbase.cpp index 2b3a7b26..72be3e40 100644 --- a/src/qtdesktop/qtsplitterbase.cpp +++ b/src/qtdesktop/qtsplitterbase.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qtsplitterbase.h" +#include "qtsplitterbase_p.h" /*! \qmltype Splitter diff --git a/src/qtdesktop/qtsplitterbase.h b/src/qtdesktop/qtsplitterbase.h deleted file mode 100644 index 8bf4ee4d..00000000 --- a/src/qtdesktop/qtsplitterbase.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTSPLITTERBASE_H -#define QTSPLITTERBASE_H - -#include -#include - - -class QtSplitterAttached : public QObject -{ - Q_OBJECT - Q_PROPERTY(qreal minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged) - Q_PROPERTY(qreal maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged) - Q_PROPERTY(qreal minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged) - Q_PROPERTY(qreal maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged) - Q_PROPERTY(qreal percentageSize READ percentageSize WRITE setPercentageSize NOTIFY percentageWidthSize) - Q_PROPERTY(bool expanding READ expanding WRITE setExpanding NOTIFY expandingChanged) - Q_PROPERTY(int itemIndex READ itemIndex WRITE setItemIndex NOTIFY itemIndexChanged) - -public: - explicit QtSplitterAttached(QObject *object); - - qreal minimumWidth() const { return m_minimumWidth; } - void setMinimumWidth(qreal width); - - qreal maximumWidth() const { return m_maximumWidth; } - void setMaximumWidth(qreal width); - - qreal minimumHeight() const { return m_minimumHeight; } - void setMinimumHeight(qreal width); - - qreal maximumHeight() const { return m_maximumHeight; } - void setMaximumHeight(qreal width); - - bool expanding() const { return m_expanding; } - void setExpanding(bool expanding); - - qreal percentageSize() const { return m_percentageSize; } - - int itemIndex() const { return m_itemIndex; } - - void setPercentageSize(qreal arg) { m_percentageSize = arg; } - void setItemIndex(int arg) { - if (m_itemIndex != arg) { - m_itemIndex = arg; - emit itemIndexChanged(arg); - } - } - -signals: - void minimumWidthChanged(qreal arg); - void maximumWidthChanged(qreal arg); - void minimumHeightChanged(qreal arg); - void maximumHeightChanged(qreal arg); - void expandingChanged(bool arg); - void percentageWidthSize(qreal arg); - void itemIndexChanged(int arg); - -private: - qreal m_minimumWidth; - qreal m_maximumWidth; - qreal m_minimumHeight; - qreal m_maximumHeight; - qreal m_percentageSize; - int m_itemIndex; - bool m_expanding; - - friend class QtSplitterBase; -}; - - -class QtSplitterBase : public QQuickItem -{ - Q_OBJECT -public: - explicit QtSplitterBase(QQuickItem *parent = 0); - ~QtSplitterBase() {} - - static QtSplitterAttached *qmlAttachedProperties(QObject *object); -}; - -QML_DECLARE_TYPEINFO(QtSplitterBase, QML_HAS_ATTACHED_PROPERTIES) - -#endif // QTSPLITTERBASE_H diff --git a/src/qtdesktop/qtsplitterbase_p.h b/src/qtdesktop/qtsplitterbase_p.h new file mode 100644 index 00000000..8bf4ee4d --- /dev/null +++ b/src/qtdesktop/qtsplitterbase_p.h @@ -0,0 +1,123 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTSPLITTERBASE_H +#define QTSPLITTERBASE_H + +#include +#include + + +class QtSplitterAttached : public QObject +{ + Q_OBJECT + Q_PROPERTY(qreal minimumWidth READ minimumWidth WRITE setMinimumWidth NOTIFY minimumWidthChanged) + Q_PROPERTY(qreal maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged) + Q_PROPERTY(qreal minimumHeight READ minimumHeight WRITE setMinimumHeight NOTIFY minimumHeightChanged) + Q_PROPERTY(qreal maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged) + Q_PROPERTY(qreal percentageSize READ percentageSize WRITE setPercentageSize NOTIFY percentageWidthSize) + Q_PROPERTY(bool expanding READ expanding WRITE setExpanding NOTIFY expandingChanged) + Q_PROPERTY(int itemIndex READ itemIndex WRITE setItemIndex NOTIFY itemIndexChanged) + +public: + explicit QtSplitterAttached(QObject *object); + + qreal minimumWidth() const { return m_minimumWidth; } + void setMinimumWidth(qreal width); + + qreal maximumWidth() const { return m_maximumWidth; } + void setMaximumWidth(qreal width); + + qreal minimumHeight() const { return m_minimumHeight; } + void setMinimumHeight(qreal width); + + qreal maximumHeight() const { return m_maximumHeight; } + void setMaximumHeight(qreal width); + + bool expanding() const { return m_expanding; } + void setExpanding(bool expanding); + + qreal percentageSize() const { return m_percentageSize; } + + int itemIndex() const { return m_itemIndex; } + + void setPercentageSize(qreal arg) { m_percentageSize = arg; } + void setItemIndex(int arg) { + if (m_itemIndex != arg) { + m_itemIndex = arg; + emit itemIndexChanged(arg); + } + } + +signals: + void minimumWidthChanged(qreal arg); + void maximumWidthChanged(qreal arg); + void minimumHeightChanged(qreal arg); + void maximumHeightChanged(qreal arg); + void expandingChanged(bool arg); + void percentageWidthSize(qreal arg); + void itemIndexChanged(int arg); + +private: + qreal m_minimumWidth; + qreal m_maximumWidth; + qreal m_minimumHeight; + qreal m_maximumHeight; + qreal m_percentageSize; + int m_itemIndex; + bool m_expanding; + + friend class QtSplitterBase; +}; + + +class QtSplitterBase : public QQuickItem +{ + Q_OBJECT +public: + explicit QtSplitterBase(QQuickItem *parent = 0); + ~QtSplitterBase() {} + + static QtSplitterAttached *qmlAttachedProperties(QObject *object); +}; + +QML_DECLARE_TYPEINFO(QtSplitterBase, QML_HAS_ATTACHED_PROPERTIES) + +#endif // QTSPLITTERBASE_H diff --git a/src/qtdesktop/qwheelarea.cpp b/src/qtdesktop/qwheelarea.cpp index c5180d2a..3bf8016c 100644 --- a/src/qtdesktop/qwheelarea.cpp +++ b/src/qtdesktop/qwheelarea.cpp @@ -38,7 +38,7 @@ ** ****************************************************************************/ -#include "qwheelarea.h" +#include "qwheelarea_p.h" /*! \qmltype WheelArea diff --git a/src/qtdesktop/qwheelarea.h b/src/qtdesktop/qwheelarea.h deleted file mode 100644 index a112607c..00000000 --- a/src/qtdesktop/qwheelarea.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt Components project. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names -** of its contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWHEELAREA_H -#define QWHEELAREA_H - -#include -#include -#include - - -class QWheelArea : public QQuickItem -{ - Q_OBJECT - Q_PROPERTY(qreal verticalDelta READ verticalDelta WRITE setVerticalDelta NOTIFY verticalWheelMoved) - Q_PROPERTY(qreal horizontalDelta READ horizontalDelta WRITE setHorizontalDelta NOTIFY horizontalWheelMoved) - Q_PROPERTY(qreal horizontalMinimumValue READ horizontalMinimumValue WRITE setHorizontalMinimumValue) - Q_PROPERTY(qreal horizontalMaximumValue READ horizontalMaximumValue WRITE setHorizontalMaximumValue) - Q_PROPERTY(qreal verticalMinimumValue READ verticalMinimumValue WRITE setVerticalMinimumValue) - Q_PROPERTY(qreal verticalMaximumValue READ verticalMaximumValue WRITE setVerticalMaximumValue) - Q_PROPERTY(qreal horizontalValue READ horizontalValue WRITE setHorizontalValue) - Q_PROPERTY(qreal verticalValue READ verticalValue WRITE setVerticalValue) - Q_PROPERTY(qreal scrollSpeed READ scrollSpeed WRITE setScrollSpeed NOTIFY scrollSpeedChanged) - -public: - QWheelArea(QQuickItem *parent = 0); - virtual ~QWheelArea(); - - void setHorizontalMinimumValue(qreal value); - qreal horizontalMinimumValue() const; - - void setHorizontalMaximumValue(qreal value); - qreal horizontalMaximumValue() const; - - void setVerticalMinimumValue(qreal value); - qreal verticalMinimumValue() const; - - void setVerticalMaximumValue(qreal value); - qreal verticalMaximumValue() const; - - void setHorizontalValue(qreal value); - qreal horizontalValue() const; - - void setVerticalValue(qreal value); - qreal verticalValue() const; - - void setVerticalDelta(qreal value); - qreal verticalDelta() const; - - void setHorizontalDelta(qreal value); - qreal horizontalDelta() const; - - void setScrollSpeed(qreal value); - qreal scrollSpeed() const; - - void wheelEvent(QWheelEvent *event); - -Q_SIGNALS: - void verticalValueChanged(); - void horizontalValueChanged(); - void verticalWheelMoved(); - void horizontalWheelMoved(); - void scrollSpeedChanged(); - -private: - qreal m_horizontalMinimumValue; - qreal m_horizontalMaximumValue; - qreal m_verticalMinimumValue; - qreal m_verticalMaximumValue; - qreal m_horizontalValue; - qreal m_verticalValue; - qreal m_verticalDelta; - qreal m_horizontalDelta; - qreal m_scrollSpeed; - - Q_DISABLE_COPY(QWheelArea) -}; - -QML_DECLARE_TYPE(QWheelArea) - - -#endif // QWHEELAREA_H diff --git a/src/qtdesktop/qwheelarea_p.h b/src/qtdesktop/qwheelarea_p.h new file mode 100644 index 00000000..a112607c --- /dev/null +++ b/src/qtdesktop/qwheelarea_p.h @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt Components project. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names +** of its contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWHEELAREA_H +#define QWHEELAREA_H + +#include +#include +#include + + +class QWheelArea : public QQuickItem +{ + Q_OBJECT + Q_PROPERTY(qreal verticalDelta READ verticalDelta WRITE setVerticalDelta NOTIFY verticalWheelMoved) + Q_PROPERTY(qreal horizontalDelta READ horizontalDelta WRITE setHorizontalDelta NOTIFY horizontalWheelMoved) + Q_PROPERTY(qreal horizontalMinimumValue READ horizontalMinimumValue WRITE setHorizontalMinimumValue) + Q_PROPERTY(qreal horizontalMaximumValue READ horizontalMaximumValue WRITE setHorizontalMaximumValue) + Q_PROPERTY(qreal verticalMinimumValue READ verticalMinimumValue WRITE setVerticalMinimumValue) + Q_PROPERTY(qreal verticalMaximumValue READ verticalMaximumValue WRITE setVerticalMaximumValue) + Q_PROPERTY(qreal horizontalValue READ horizontalValue WRITE setHorizontalValue) + Q_PROPERTY(qreal verticalValue READ verticalValue WRITE setVerticalValue) + Q_PROPERTY(qreal scrollSpeed READ scrollSpeed WRITE setScrollSpeed NOTIFY scrollSpeedChanged) + +public: + QWheelArea(QQuickItem *parent = 0); + virtual ~QWheelArea(); + + void setHorizontalMinimumValue(qreal value); + qreal horizontalMinimumValue() const; + + void setHorizontalMaximumValue(qreal value); + qreal horizontalMaximumValue() const; + + void setVerticalMinimumValue(qreal value); + qreal verticalMinimumValue() const; + + void setVerticalMaximumValue(qreal value); + qreal verticalMaximumValue() const; + + void setHorizontalValue(qreal value); + qreal horizontalValue() const; + + void setVerticalValue(qreal value); + qreal verticalValue() const; + + void setVerticalDelta(qreal value); + qreal verticalDelta() const; + + void setHorizontalDelta(qreal value); + qreal horizontalDelta() const; + + void setScrollSpeed(qreal value); + qreal scrollSpeed() const; + + void wheelEvent(QWheelEvent *event); + +Q_SIGNALS: + void verticalValueChanged(); + void horizontalValueChanged(); + void verticalWheelMoved(); + void horizontalWheelMoved(); + void scrollSpeedChanged(); + +private: + qreal m_horizontalMinimumValue; + qreal m_horizontalMaximumValue; + qreal m_verticalMinimumValue; + qreal m_verticalMaximumValue; + qreal m_horizontalValue; + qreal m_verticalValue; + qreal m_verticalDelta; + qreal m_horizontalDelta; + qreal m_scrollSpeed; + + Q_DISABLE_COPY(QWheelArea) +}; + +QML_DECLARE_TYPE(QWheelArea) + + +#endif // QWHEELAREA_H diff --git a/src/qtdesktop/styleplugin.pri b/src/qtdesktop/styleplugin.pri index 5083a873..6ca28768 100644 --- a/src/qtdesktop/styleplugin.pri +++ b/src/qtdesktop/styleplugin.pri @@ -1,19 +1,19 @@ HEADERS += \ - qdesktopitem.h \ - qfiledialogitem.h \ - qquickcomponentsprivate.h \ - qquicklayout.h \ + qdesktopitem_p.h \ + qfiledialogitem_p.h \ + qquickcomponentsprivate_p.h \ + qquicklayout_p.h \ qquicklayoutengine_p.h \ - qquicklinearlayout.h \ - qrangemodel.h \ + qquicklinearlayout_p.h \ qrangemodel_p.h \ - qstyleitem.h \ - qstyleplugin.h \ - qtmenu.h \ - qtmenubar.h \ - qtmenuitem.h \ - qtsplitterbase.h \ - qwheelarea.h + qrangemodel_p_p.h \ + qstyleitem_p.h \ + qstyleplugin_p.h \ + qtmenu_p.h \ + qtmenubar_p.h \ + qtmenuitem_p.h \ + qtsplitterbase_p.h \ + qwheelarea_p.h SOURCES += \ qdesktopitem.cpp \ -- cgit v1.2.1