diff options
author | Mitch Curtis <[email protected]> | 2021-08-12 14:39:51 +0200 |
---|---|---|
committer | Mitch Curtis <[email protected]> | 2021-08-16 12:52:59 +0200 |
commit | 809339d1484cf556512534367b8170bc26baf072 (patch) | |
tree | 12871313b658f36d058b5ef25af1e247e9c46ce9 /src/labs/platform/widgets | |
parent | b01b4f00eae8022c6a97d90f54dac395144ae095 (diff) |
Now that qtquickcontrols2 has been merged into qtdeclarative,
we should make it obvious that this repo should no longer be
used, by preventing it from being built.
Task-number: QTBUG-95173
Pick-to: 6.2
Change-Id: I95bd6a214f3d75a865ab163ee0a1f9ffbeb7a051
Reviewed-by: Alexandru Croitor <[email protected]>
Reviewed-by: Volker Hilsheimer <[email protected]>
Diffstat (limited to 'src/labs/platform/widgets')
18 files changed, 0 insertions, 1765 deletions
diff --git a/src/labs/platform/widgets/qwidgetplatform_p.h b/src/labs/platform/widgets/qwidgetplatform_p.h deleted file mode 100644 index cbdaa24a..00000000 --- a/src/labs/platform/widgets/qwidgetplatform_p.h +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWIDGETPLATFORM_P_H -#define QWIDGETPLATFORM_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qdebug.h> -#include <QtCore/qcoreapplication.h> -#include <QtGui/qpa/qplatformtheme.h> -#include <QtGui/qpa/qplatformdialoghelper.h> -#include <QtGui/qpa/qplatformsystemtrayicon.h> -#include <QtGui/qpa/qplatformmenu.h> - -#ifdef QT_WIDGETS_LIB -#include <QtWidgets/qtwidgetsglobal.h> -#if QT_CONFIG(colordialog) -#include "qwidgetplatformcolordialog_p.h" -#endif -#if QT_CONFIG(filedialog) -#include "qwidgetplatformfiledialog_p.h" -#endif -#if QT_CONFIG(fontdialog) -#include "qwidgetplatformfontdialog_p.h" -#endif -#if QT_CONFIG(messagebox) -#include "qwidgetplatformmessagedialog_p.h" -#endif -#if QT_CONFIG(menu) -#include "qwidgetplatformmenu_p.h" -#include "qwidgetplatformmenuitem_p.h" -#endif -#ifndef QT_NO_SYSTEMTRAYICON -#include "qwidgetplatformsystemtrayicon_p.h" -#endif -#endif - -QT_BEGIN_NAMESPACE - -#ifndef QT_WIDGETS_LIB -typedef QPlatformMenu QWidgetPlatformMenu; -typedef QPlatformMenuItem QWidgetPlatformMenuItem; -typedef QPlatformColorDialogHelper QWidgetPlatformColorDialog; -typedef QPlatformFileDialogHelper QWidgetPlatformFileDialog; -typedef QPlatformFontDialogHelper QWidgetPlatformFontDialog; -typedef QPlatformMessageDialogHelper QWidgetPlatformMessageDialog; -typedef QPlatformSystemTrayIcon QWidgetPlatformSystemTrayIcon; -#endif - -namespace QWidgetPlatform -{ - static inline bool isAvailable(const char *type) - { - if (!qApp->inherits("QApplication")) { - qCritical("\nERROR: No native %s implementation available." - "\nQt Labs Platform requires Qt Widgets on this setup." - "\nAdd 'QT += widgets' to .pro and create QApplication in main().\n", type); - return false; - } - return true; - } - - template<typename T> - static inline T *createWidget(const char *name, QObject *parent) - { - static bool available = isAvailable(name); -#ifdef QT_WIDGETS_LIB - if (available) - return new T(parent); -#else - Q_UNUSED(parent); - Q_UNUSED(available); -#endif - return nullptr; - } - - static inline QPlatformMenu *createMenu(QObject *parent = nullptr) { -#if defined(QT_WIDGETS_LIB) && QT_CONFIG(menu) - return createWidget<QWidgetPlatformMenu>("Menu", parent); -#else - Q_UNUSED(parent); - return nullptr; -#endif - } - static inline QPlatformMenuItem *createMenuItem(QObject *parent = nullptr) { -#if defined(QT_WIDGETS_LIB) && QT_CONFIG(menu) - return createWidget<QWidgetPlatformMenuItem>("MenuItem", parent); -#else - Q_UNUSED(parent); - return nullptr; -#endif - } - static inline QPlatformSystemTrayIcon *createSystemTrayIcon(QObject *parent = nullptr) { -#ifndef QT_NO_SYSTEMTRAYICON - return createWidget<QWidgetPlatformSystemTrayIcon>("SystemTrayIcon", parent); -#else - Q_UNUSED(parent); - return nullptr; -#endif - } - static inline QPlatformDialogHelper *createDialog(QPlatformTheme::DialogType type, QObject *parent = nullptr) - { -#if !defined(QT_WIDGETS_LIB) || !(QT_CONFIG(colordialog) || QT_CONFIG(filedialog) || QT_CONFIG(fontdialog) || QT_CONFIG(messagebox)) - Q_UNUSED(parent); -#endif - switch (type) { -#if defined(QT_WIDGETS_LIB) && QT_CONFIG(colordialog) - case QPlatformTheme::ColorDialog: return createWidget<QWidgetPlatformColorDialog>("ColorDialog", parent); -#endif -#if defined(QT_WIDGETS_LIB) && QT_CONFIG(filedialog) - case QPlatformTheme::FileDialog: return createWidget<QWidgetPlatformFileDialog>("FileDialog", parent); -#endif -#if defined(QT_WIDGETS_LIB) && QT_CONFIG(fontdialog) - case QPlatformTheme::FontDialog: return createWidget<QWidgetPlatformFontDialog>("FontDialog", parent); -#endif -#if defined(QT_WIDGETS_LIB) && QT_CONFIG(messagebox) - case QPlatformTheme::MessageDialog: return createWidget<QWidgetPlatformMessageDialog>("MessageDialog", parent); -#endif - default: break; - } - return nullptr; - } -} - -QT_END_NAMESPACE - -#endif // QWIDGETPLATFORM_P_H diff --git a/src/labs/platform/widgets/qwidgetplatformcolordialog.cpp b/src/labs/platform/widgets/qwidgetplatformcolordialog.cpp deleted file mode 100644 index 6c0043ae..00000000 --- a/src/labs/platform/widgets/qwidgetplatformcolordialog.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwidgetplatformcolordialog_p.h" -#include "qwidgetplatformdialog_p.h" - -#include <QtWidgets/qcolordialog.h> - -QT_BEGIN_NAMESPACE - -QWidgetPlatformColorDialog::QWidgetPlatformColorDialog(QObject *parent) - : m_dialog(new QColorDialog) -{ - setParent(parent); - - connect(m_dialog.data(), &QColorDialog::accepted, this, &QPlatformDialogHelper::accept); - connect(m_dialog.data(), &QColorDialog::rejected, this, &QPlatformDialogHelper::reject); - connect(m_dialog.data(), &QColorDialog::currentColorChanged, this, &QPlatformColorDialogHelper::currentColorChanged); -} - -QWidgetPlatformColorDialog::~QWidgetPlatformColorDialog() -{ -} - -QColor QWidgetPlatformColorDialog::currentColor() const -{ - return m_dialog->currentColor(); -} - -void QWidgetPlatformColorDialog::setCurrentColor(const QColor &color) -{ - m_dialog->setCurrentColor(color); -} - -void QWidgetPlatformColorDialog::exec() -{ - m_dialog->exec(); -} - -bool QWidgetPlatformColorDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) -{ - QSharedPointer<QColorDialogOptions> options = QPlatformColorDialogHelper::options(); - m_dialog->setWindowTitle(options->windowTitle()); - m_dialog->setOptions(static_cast<QColorDialog::ColorDialogOptions>(int(options->options())) | QColorDialog::DontUseNativeDialog); - - return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent); -} - -void QWidgetPlatformColorDialog::hide() -{ - m_dialog->hide(); -} - -QT_END_NAMESPACE diff --git a/src/labs/platform/widgets/qwidgetplatformcolordialog_p.h b/src/labs/platform/widgets/qwidgetplatformcolordialog_p.h deleted file mode 100644 index 09ed5a1e..00000000 --- a/src/labs/platform/widgets/qwidgetplatformcolordialog_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWIDGETPLATFORMCOLORDIALOG_P_H -#define QWIDGETPLATFORMCOLORDIALOG_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtGui/qpa/qplatformdialoghelper.h> - -QT_BEGIN_NAMESPACE - -class QColorDialog; - -class QWidgetPlatformColorDialog : public QPlatformColorDialogHelper -{ - Q_OBJECT - -public: - explicit QWidgetPlatformColorDialog(QObject *parent = nullptr); - ~QWidgetPlatformColorDialog(); - - QColor currentColor() const override; - void setCurrentColor(const QColor &color) override; - - void exec() override; - bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override; - void hide() override; - -private: - QScopedPointer<QColorDialog> m_dialog; -}; - -QT_END_NAMESPACE - -#endif // QWIDGETPLATFORMCOLORDIALOG_P_H diff --git a/src/labs/platform/widgets/qwidgetplatformdialog.cpp b/src/labs/platform/widgets/qwidgetplatformdialog.cpp deleted file mode 100644 index 3a206839..00000000 --- a/src/labs/platform/widgets/qwidgetplatformdialog.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwidgetplatformdialog_p.h" - -#include <QtGui/qwindow.h> -#include <QtWidgets/qdialog.h> - -QT_BEGIN_NAMESPACE - -bool QWidgetPlatformDialog::show(QDialog *dialog, Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) -{ - dialog->setWindowFlags(flags); - dialog->setWindowModality(modality); - - dialog->createWinId(); - QWindow *handle = dialog->windowHandle(); - Q_ASSERT(handle); - handle->setTransientParent(const_cast<QWindow *>(parent)); - - dialog->show(); - return true; -} - -QT_END_NAMESPACE diff --git a/src/labs/platform/widgets/qwidgetplatformdialog_p.h b/src/labs/platform/widgets/qwidgetplatformdialog_p.h deleted file mode 100644 index d4f27655..00000000 --- a/src/labs/platform/widgets/qwidgetplatformdialog_p.h +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWIDGETPLATFORMDIALOG_P_H -#define QWIDGETPLATFORMDIALOG_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtCore/qnamespace.h> - -QT_BEGIN_NAMESPACE - -class QDialog; -class QWindow; - -class QWidgetPlatformDialog -{ -public: - static bool show(QDialog *dialog, Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent); -}; - -QT_END_NAMESPACE - -#endif // QWIDGETPLATFORMDIALOG_P_H diff --git a/src/labs/platform/widgets/qwidgetplatformfiledialog.cpp b/src/labs/platform/widgets/qwidgetplatformfiledialog.cpp deleted file mode 100644 index 21ac6527..00000000 --- a/src/labs/platform/widgets/qwidgetplatformfiledialog.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwidgetplatformfiledialog_p.h" -#include "qwidgetplatformdialog_p.h" - -#include <QtWidgets/qfiledialog.h> - -QT_BEGIN_NAMESPACE - -QWidgetPlatformFileDialog::QWidgetPlatformFileDialog(QObject *parent) - : m_dialog(new QFileDialog) -{ - setParent(parent); - - connect(m_dialog.data(), &QDialog::accepted, this, &QPlatformDialogHelper::accept); - connect(m_dialog.data(), &QDialog::rejected, this, &QPlatformDialogHelper::reject); - - connect(m_dialog.data(), &QFileDialog::fileSelected, [this](const QString &file) { - emit fileSelected(QUrl::fromLocalFile(file)); - }); - connect(m_dialog.data(), &QFileDialog::filesSelected, [this](const QList<QString> &files) { - QList<QUrl> urls; - urls.reserve(files.count()); - for (const QString &file : files) - urls += QUrl::fromLocalFile(file); - emit filesSelected(urls); - }); - connect(m_dialog.data(), &QFileDialog::currentChanged, [this](const QString &path) { - emit currentChanged(QUrl::fromLocalFile(path)); - }); - connect(m_dialog.data(), &QFileDialog::directoryEntered, this, &QWidgetPlatformFileDialog::directoryEntered); - connect(m_dialog.data(), &QFileDialog::filterSelected, this, &QWidgetPlatformFileDialog::filterSelected); -} - -QWidgetPlatformFileDialog::~QWidgetPlatformFileDialog() -{ -} - -bool QWidgetPlatformFileDialog::defaultNameFilterDisables() const -{ - return false; // TODO: ? -} - -void QWidgetPlatformFileDialog::setDirectory(const QUrl &directory) -{ - m_dialog->setDirectory(directory.toLocalFile()); -} - -QUrl QWidgetPlatformFileDialog::directory() const -{ - return m_dialog->directoryUrl(); -} - -void QWidgetPlatformFileDialog::selectFile(const QUrl &filename) -{ - m_dialog->selectUrl(filename); -} - -QList<QUrl> QWidgetPlatformFileDialog::selectedFiles() const -{ - return m_dialog->selectedUrls(); -} - -void QWidgetPlatformFileDialog::setFilter() -{ - // TODO: ? -} - -void QWidgetPlatformFileDialog::selectNameFilter(const QString &filter) -{ - m_dialog->selectNameFilter(filter); -} - -QString QWidgetPlatformFileDialog::selectedNameFilter() const -{ - return m_dialog->selectedNameFilter(); -} - -void QWidgetPlatformFileDialog::exec() -{ - m_dialog->exec(); -} - -bool QWidgetPlatformFileDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) -{ - QSharedPointer<QFileDialogOptions> options = QPlatformFileDialogHelper::options(); - m_dialog->setWindowTitle(options->windowTitle()); - m_dialog->setAcceptMode(static_cast<QFileDialog::AcceptMode>(options->acceptMode())); - m_dialog->setFileMode(static_cast<QFileDialog::FileMode>(options->fileMode())); - m_dialog->setOptions(static_cast<QFileDialog::Options>(int(options->options())) | QFileDialog::DontUseNativeDialog); - m_dialog->setNameFilters(options->nameFilters()); - m_dialog->setDefaultSuffix(options->defaultSuffix()); - if (options->isLabelExplicitlySet(QFileDialogOptions::Accept)) - m_dialog->setLabelText(QFileDialog::Accept, options->labelText(QFileDialogOptions::Accept)); - if (options->isLabelExplicitlySet(QFileDialogOptions::Reject)) - m_dialog->setLabelText(QFileDialog::Reject, options->labelText(QFileDialogOptions::Reject)); - - return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent); -} - -void QWidgetPlatformFileDialog::hide() -{ - m_dialog->hide(); -} - -QT_END_NAMESPACE diff --git a/src/labs/platform/widgets/qwidgetplatformfiledialog_p.h b/src/labs/platform/widgets/qwidgetplatformfiledialog_p.h deleted file mode 100644 index 3dba6038..00000000 --- a/src/labs/platform/widgets/qwidgetplatformfiledialog_p.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWIDGETPLATFORMFILEDIALOG_P_H -#define QWIDGETPLATFORMFILEDIALOG_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtGui/qpa/qplatformdialoghelper.h> - -QT_BEGIN_NAMESPACE - -class QFileDialog; - -class QWidgetPlatformFileDialog : public QPlatformFileDialogHelper -{ - Q_OBJECT - -public: - explicit QWidgetPlatformFileDialog(QObject *parent = nullptr); - ~QWidgetPlatformFileDialog(); - - bool defaultNameFilterDisables() const override; - void setDirectory(const QUrl &directory) override; - QUrl directory() const override; - void selectFile(const QUrl &filename) override; - QList<QUrl> selectedFiles() const override; - void setFilter() override; - void selectNameFilter(const QString &filter) override; - QString selectedNameFilter() const override; - - void exec() override; - bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override; - void hide() override; - -private: - QScopedPointer<QFileDialog> m_dialog; -}; - -QT_END_NAMESPACE - -#endif // QWIDGETPLATFORMFILEDIALOG_P_H diff --git a/src/labs/platform/widgets/qwidgetplatformfontdialog.cpp b/src/labs/platform/widgets/qwidgetplatformfontdialog.cpp deleted file mode 100644 index 315e7c73..00000000 --- a/src/labs/platform/widgets/qwidgetplatformfontdialog.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwidgetplatformfontdialog_p.h" -#include "qwidgetplatformdialog_p.h" - -#include <QtWidgets/qfontdialog.h> - -QT_BEGIN_NAMESPACE - -QWidgetPlatformFontDialog::QWidgetPlatformFontDialog(QObject *parent) - : m_dialog(new QFontDialog) -{ - setParent(parent); - - connect(m_dialog.data(), &QFontDialog::accepted, this, &QPlatformDialogHelper::accept); - connect(m_dialog.data(), &QFontDialog::rejected, this, &QPlatformDialogHelper::reject); - connect(m_dialog.data(), &QFontDialog::currentFontChanged, this, &QPlatformFontDialogHelper::currentFontChanged); -} - -QWidgetPlatformFontDialog::~QWidgetPlatformFontDialog() -{ -} - -QFont QWidgetPlatformFontDialog::currentFont() const -{ - return m_dialog->currentFont(); -} - -void QWidgetPlatformFontDialog::setCurrentFont(const QFont &font) -{ - m_dialog->setCurrentFont(font); -} - -void QWidgetPlatformFontDialog::exec() -{ - m_dialog->exec(); -} - -bool QWidgetPlatformFontDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) -{ - QSharedPointer<QFontDialogOptions> options = QPlatformFontDialogHelper::options(); - m_dialog->setWindowTitle(options->windowTitle()); - m_dialog->setOptions(static_cast<QFontDialog::FontDialogOptions>(int(options->options())) | QFontDialog::DontUseNativeDialog); - - return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent); -} - -void QWidgetPlatformFontDialog::hide() -{ - m_dialog->hide(); -} - -QT_END_NAMESPACE diff --git a/src/labs/platform/widgets/qwidgetplatformfontdialog_p.h b/src/labs/platform/widgets/qwidgetplatformfontdialog_p.h deleted file mode 100644 index e5d13b31..00000000 --- a/src/labs/platform/widgets/qwidgetplatformfontdialog_p.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWIDGETPLATFORMFONTDIALOG_P_H -#define QWIDGETPLATFORMFONTDIALOG_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtGui/qpa/qplatformdialoghelper.h> - -QT_BEGIN_NAMESPACE - -class QFontDialog; - -class QWidgetPlatformFontDialog : public QPlatformFontDialogHelper -{ - Q_OBJECT - -public: - explicit QWidgetPlatformFontDialog(QObject *parent = nullptr); - ~QWidgetPlatformFontDialog(); - - QFont currentFont() const override; - void setCurrentFont(const QFont &font) override; - - void exec() override; - bool show(Qt::WindowFlags windowFlags, Qt::WindowModality windowModality, QWindow *parent) override; - void hide() override; - -private: - QScopedPointer<QFontDialog> m_dialog; -}; - -QT_END_NAMESPACE - -#endif // QWIDGETPLATFORMFONTDIALOG_P_H diff --git a/src/labs/platform/widgets/qwidgetplatformmenu.cpp b/src/labs/platform/widgets/qwidgetplatformmenu.cpp deleted file mode 100644 index f04620a3..00000000 --- a/src/labs/platform/widgets/qwidgetplatformmenu.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwidgetplatformmenu_p.h" -#include "qwidgetplatformmenuitem_p.h" - -#include <QtGui/qaction.h> -#include <QtGui/qwindow.h> -#include <QtWidgets/qmenu.h> - -QT_BEGIN_NAMESPACE - -QWidgetPlatformMenu::QWidgetPlatformMenu(QObject *parent) - : m_menu(new QMenu) -{ - setParent(parent); - - connect(m_menu.data(), &QMenu::aboutToShow, this, &QPlatformMenu::aboutToShow); - connect(m_menu.data(), &QMenu::aboutToHide, this, &QPlatformMenu::aboutToHide); -} - -QWidgetPlatformMenu::~QWidgetPlatformMenu() -{ -} - -QMenu *QWidgetPlatformMenu::menu() const -{ - return m_menu.data(); -} - -void QWidgetPlatformMenu::insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *before) -{ - QWidgetPlatformMenuItem *widgetItem = qobject_cast<QWidgetPlatformMenuItem *>(item); - if (!widgetItem) - return; - - QWidgetPlatformMenuItem *widgetBefore = qobject_cast<QWidgetPlatformMenuItem *>(before); - m_menu->insertAction(widgetBefore ? widgetBefore->action() : nullptr, widgetItem->action()); - int index = m_items.indexOf(widgetBefore); - if (index < 0) - index = m_items.count(); - m_items.insert(index, widgetItem); -} - -void QWidgetPlatformMenu::removeMenuItem(QPlatformMenuItem *item) -{ - QWidgetPlatformMenuItem *widgetItem = qobject_cast<QWidgetPlatformMenuItem *>(item); - if (!widgetItem) - return; - - m_items.removeOne(widgetItem); - m_menu->removeAction(widgetItem->action()); -} - -void QWidgetPlatformMenu::syncMenuItem(QPlatformMenuItem *item) -{ - Q_UNUSED(item); -} - -void QWidgetPlatformMenu::syncSeparatorsCollapsible(bool enable) -{ - m_menu->setSeparatorsCollapsible(enable); -} - -void QWidgetPlatformMenu::setText(const QString &text) -{ - m_menu->setTitle(text); -} - -void QWidgetPlatformMenu::setIcon(const QIcon &icon) -{ - m_menu->setIcon(icon); -} - -void QWidgetPlatformMenu::setEnabled(bool enabled) -{ - m_menu->menuAction()->setEnabled(enabled); -} - -bool QWidgetPlatformMenu::isEnabled() const -{ - return m_menu->menuAction()->isEnabled(); -} - -void QWidgetPlatformMenu::setVisible(bool visible) -{ - m_menu->menuAction()->setVisible(visible); -} - -void QWidgetPlatformMenu::setMinimumWidth(int width) -{ - if (width > 0) - m_menu->setMinimumWidth(width); -} - -void QWidgetPlatformMenu::setFont(const QFont &font) -{ - m_menu->setFont(font); -} - -void QWidgetPlatformMenu::setMenuType(MenuType type) -{ - Q_UNUSED(type); -} - -void QWidgetPlatformMenu::showPopup(const QWindow *window, const QRect &targetRect, const QPlatformMenuItem *item) -{ - m_menu->createWinId(); - QWindow *handle = m_menu->windowHandle(); - Q_ASSERT(handle); - handle->setTransientParent(const_cast<QWindow *>(window)); - - QPoint targetPos = targetRect.bottomLeft(); - if (window) - targetPos = window->mapToGlobal(targetPos); - - const QWidgetPlatformMenuItem *widgetItem = qobject_cast<const QWidgetPlatformMenuItem *>(item); - m_menu->popup(targetPos, widgetItem ? widgetItem->action() : nullptr); -} - -void QWidgetPlatformMenu::dismiss() -{ - m_menu->close(); -} - -QPlatformMenuItem *QWidgetPlatformMenu::menuItemAt(int position) const -{ - return m_items.value(position); -} - -QPlatformMenuItem *QWidgetPlatformMenu::menuItemForTag(quintptr tag) const -{ - for (QWidgetPlatformMenuItem *item : m_items) { - if (item->tag() == tag) - return item; - } - return nullptr; -} - -QPlatformMenuItem *QWidgetPlatformMenu::createMenuItem() const -{ - return new QWidgetPlatformMenuItem; -} - -QPlatformMenu *QWidgetPlatformMenu::createSubMenu() const -{ - return new QWidgetPlatformMenu; -} - -QT_END_NAMESPACE diff --git a/src/labs/platform/widgets/qwidgetplatformmenu_p.h b/src/labs/platform/widgets/qwidgetplatformmenu_p.h deleted file mode 100644 index 9d1ef57e..00000000 --- a/src/labs/platform/widgets/qwidgetplatformmenu_p.h +++ /dev/null @@ -1,98 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWIDGETPLATFORMMENU_P_H -#define QWIDGETPLATFORMMENU_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtGui/qpa/qplatformmenu.h> - -QT_BEGIN_NAMESPACE - -class QMenu; -class QWidgetPlatformMenuItem; - -class QWidgetPlatformMenu : public QPlatformMenu -{ - Q_OBJECT - -public: - explicit QWidgetPlatformMenu(QObject *parent = nullptr); - ~QWidgetPlatformMenu(); - - QMenu *menu() const; - - void insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *before) override; - void removeMenuItem(QPlatformMenuItem *item) override; - void syncMenuItem(QPlatformMenuItem *item) override; - void syncSeparatorsCollapsible(bool enable) override; - - void setText(const QString &text) override; - void setIcon(const QIcon &icon) override; - void setEnabled(bool enabled) override; - bool isEnabled() const override; - void setVisible(bool visible) override; - void setMinimumWidth(int width) override; - void setFont(const QFont &font) override; - void setMenuType(MenuType type) override; - - void showPopup(const QWindow *window, const QRect &targetRect, const QPlatformMenuItem *item) override; - void dismiss() override; - - QPlatformMenuItem *menuItemAt(int position) const override; - QPlatformMenuItem *menuItemForTag(quintptr tag) const override; - - QPlatformMenuItem *createMenuItem() const override; - QPlatformMenu *createSubMenu() const override; - -private: - QScopedPointer<QMenu> m_menu; - QList<QWidgetPlatformMenuItem *> m_items; -}; - -QT_END_NAMESPACE - -#endif // QWIDGETPLATFORMMENU_P_H diff --git a/src/labs/platform/widgets/qwidgetplatformmenuitem.cpp b/src/labs/platform/widgets/qwidgetplatformmenuitem.cpp deleted file mode 100644 index ea4de57f..00000000 --- a/src/labs/platform/widgets/qwidgetplatformmenuitem.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwidgetplatformmenuitem_p.h" -#include "qwidgetplatformmenu_p.h" - -#include <QtGui/qaction.h> -#include <QtWidgets/qmenu.h> - -QT_BEGIN_NAMESPACE - -QWidgetPlatformMenuItem::QWidgetPlatformMenuItem(QObject *parent) - : m_action(new QAction) -{ - setParent(parent); - connect(m_action.data(), &QAction::hovered, this, &QPlatformMenuItem::hovered); - connect(m_action.data(), &QAction::triggered, this, &QPlatformMenuItem::activated); -} - -QWidgetPlatformMenuItem::~QWidgetPlatformMenuItem() -{ -} - -QAction *QWidgetPlatformMenuItem::action() const -{ - return m_action.data(); -} - -void QWidgetPlatformMenuItem::setText(const QString &text) -{ - m_action->setText(text); -} - -void QWidgetPlatformMenuItem::setIcon(const QIcon &icon) -{ - m_action->setIcon(icon); -} - -void QWidgetPlatformMenuItem::setMenu(QPlatformMenu *menu) -{ - QWidgetPlatformMenu *widgetMenu = qobject_cast<QWidgetPlatformMenu *>(menu); - m_action->setMenu(widgetMenu ? widgetMenu->menu() : nullptr); -} - -void QWidgetPlatformMenuItem::setVisible(bool visible) -{ - m_action->setVisible(visible); -} - -void QWidgetPlatformMenuItem::setIsSeparator(bool separator) -{ - m_action->setSeparator(separator); -} - -void QWidgetPlatformMenuItem::setFont(const QFont &font) -{ - m_action->setFont(font); -} - -void QWidgetPlatformMenuItem::setRole(MenuRole role) -{ - m_action->setMenuRole(static_cast<QAction::MenuRole>(role)); -} - -void QWidgetPlatformMenuItem::setCheckable(bool checkable) -{ - m_action->setCheckable(checkable); -} - -void QWidgetPlatformMenuItem::setChecked(bool checked) -{ - m_action->setChecked(checked); -} - -#if QT_CONFIG(shortcut) -void QWidgetPlatformMenuItem::setShortcut(const QKeySequence &shortcut) -{ - m_action->setShortcut(shortcut); -} -#endif - -void QWidgetPlatformMenuItem::setEnabled(bool enabled) -{ - m_action->setEnabled(enabled); -} - -void QWidgetPlatformMenuItem::setIconSize(int size) -{ - Q_UNUSED(size); -} - -QT_END_NAMESPACE diff --git a/src/labs/platform/widgets/qwidgetplatformmenuitem_p.h b/src/labs/platform/widgets/qwidgetplatformmenuitem_p.h deleted file mode 100644 index 43b3fc17..00000000 --- a/src/labs/platform/widgets/qwidgetplatformmenuitem_p.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWIDGETPLATFORMMENUITEM_P_H -#define QWIDGETPLATFORMMENUITEM_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtGui/qpa/qplatformmenu.h> - -QT_BEGIN_NAMESPACE - -class QAction; - -class QWidgetPlatformMenuItem : public QPlatformMenuItem -{ - Q_OBJECT - -public: - explicit QWidgetPlatformMenuItem(QObject *parent = nullptr); - ~QWidgetPlatformMenuItem(); - - QAction *action() const; - - void setText(const QString &text) override; - void setIcon(const QIcon &icon) override; - void setMenu(QPlatformMenu *menu) override; - void setVisible(bool visible) override; - void setIsSeparator(bool separator) override; - void setFont(const QFont &font) override; - void setRole(MenuRole role) override; - void setCheckable(bool checkable) override; - void setChecked(bool checked) override; -#if QT_CONFIG(shortcut) - void setShortcut(const QKeySequence& shortcut) override; -#endif - void setEnabled(bool enabled) override; - void setIconSize(int size) override; - -private: - QScopedPointer<QAction> m_action; -}; - -QT_END_NAMESPACE - -#endif // QWIDGETPLATFORMMENUITEM_P_H diff --git a/src/labs/platform/widgets/qwidgetplatformmessagedialog.cpp b/src/labs/platform/widgets/qwidgetplatformmessagedialog.cpp deleted file mode 100644 index 365692dc..00000000 --- a/src/labs/platform/widgets/qwidgetplatformmessagedialog.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwidgetplatformmessagedialog_p.h" -#include "qwidgetplatformdialog_p.h" - -#include <QtWidgets/qmessagebox.h> -#include <QtWidgets/qabstractbutton.h> - -QT_BEGIN_NAMESPACE - -QWidgetPlatformMessageDialog::QWidgetPlatformMessageDialog(QObject *parent) - : m_dialog(new QMessageBox) -{ - setParent(parent); - - connect(m_dialog.data(), &QMessageBox::accepted, this, &QPlatformDialogHelper::accept); - connect(m_dialog.data(), &QMessageBox::rejected, this, &QPlatformDialogHelper::reject); - connect(m_dialog.data(), &QMessageBox::buttonClicked, [this](QAbstractButton *button) { - QMessageBox::ButtonRole role = m_dialog->buttonRole(button); - QMessageBox::StandardButton standardButton = m_dialog->standardButton(button); - emit clicked(static_cast<StandardButton>(standardButton), static_cast<ButtonRole>(role)); - }); -} - -QWidgetPlatformMessageDialog::~QWidgetPlatformMessageDialog() -{ -} -void QWidgetPlatformMessageDialog::exec() -{ - m_dialog->exec(); -} - -bool QWidgetPlatformMessageDialog::show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) -{ - QSharedPointer<QMessageDialogOptions> options = QPlatformMessageDialogHelper::options(); - m_dialog->setWindowTitle(options->windowTitle()); - m_dialog->setIcon(static_cast<QMessageBox::Icon>(options->icon())); - m_dialog->setText(options->text()); - m_dialog->setInformativeText(options->informativeText()); -#if QT_CONFIG(textedit) - m_dialog->setDetailedText(options->detailedText()); -#endif - m_dialog->setStandardButtons(static_cast<QMessageBox::StandardButtons>(int(options->standardButtons()))); - - return QWidgetPlatformDialog::show(m_dialog.data(), flags, modality, parent); -} - -void QWidgetPlatformMessageDialog::hide() -{ - m_dialog->hide(); -} - -QT_END_NAMESPACE diff --git a/src/labs/platform/widgets/qwidgetplatformmessagedialog_p.h b/src/labs/platform/widgets/qwidgetplatformmessagedialog_p.h deleted file mode 100644 index 6581337a..00000000 --- a/src/labs/platform/widgets/qwidgetplatformmessagedialog_p.h +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWIDGETPLATFORMMESSAGEDIALOG_P_H -#define QWIDGETPLATFORMMESSAGEDIALOG_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtGui/qpa/qplatformdialoghelper.h> - -QT_BEGIN_NAMESPACE - -class QMessageBox; - -class QWidgetPlatformMessageDialog : public QPlatformMessageDialogHelper -{ - Q_OBJECT - -public: - explicit QWidgetPlatformMessageDialog(QObject *parent = nullptr); - ~QWidgetPlatformMessageDialog(); - - void exec() override; - bool show(Qt::WindowFlags flags, Qt::WindowModality modality, QWindow *parent) override; - void hide() override; - -private: - QScopedPointer<QMessageBox> m_dialog; -}; - -QT_END_NAMESPACE - -#endif // QWIDGETPLATFORMMESSAGEDIALOG_P_H diff --git a/src/labs/platform/widgets/qwidgetplatformsystemtrayicon.cpp b/src/labs/platform/widgets/qwidgetplatformsystemtrayicon.cpp deleted file mode 100644 index e406ff03..00000000 --- a/src/labs/platform/widgets/qwidgetplatformsystemtrayicon.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qwidgetplatformsystemtrayicon_p.h" -#include "qwidgetplatformmenu_p.h" - -#include <QtWidgets/qsystemtrayicon.h> - -QT_BEGIN_NAMESPACE - -QWidgetPlatformSystemTrayIcon::QWidgetPlatformSystemTrayIcon(QObject *parent) - : m_systray(new QSystemTrayIcon) -{ - setParent(parent); - - connect(m_systray.data(), &QSystemTrayIcon::messageClicked, this, &QPlatformSystemTrayIcon::messageClicked); - connect(m_systray.data(), &QSystemTrayIcon::activated, [this](QSystemTrayIcon::ActivationReason reason) { - emit activated(static_cast<ActivationReason>(reason)); - }); -} - -QWidgetPlatformSystemTrayIcon::~QWidgetPlatformSystemTrayIcon() -{ -} - -void QWidgetPlatformSystemTrayIcon::init() -{ - m_systray->show(); -} - -void QWidgetPlatformSystemTrayIcon::cleanup() -{ - m_systray->hide(); -} - -void QWidgetPlatformSystemTrayIcon::updateIcon(const QIcon &icon) -{ - m_systray->setIcon(icon); -} - -void QWidgetPlatformSystemTrayIcon::updateToolTip(const QString &tooltip) -{ - m_systray->setToolTip(tooltip); -} - -void QWidgetPlatformSystemTrayIcon::updateMenu(QPlatformMenu *menu) -{ -#if QT_CONFIG(menu) - QWidgetPlatformMenu *widgetMenu = qobject_cast<QWidgetPlatformMenu *>(menu); - if (!widgetMenu) - return; - - m_systray->setContextMenu(widgetMenu->menu()); -#else - Q_UNUSED(menu); -#endif -} - -QRect QWidgetPlatformSystemTrayIcon::geometry() const -{ - return m_systray->geometry(); -} - -void QWidgetPlatformSystemTrayIcon::showMessage(const QString &title, const QString &msg, const QIcon &icon, MessageIcon iconType, int msecs) -{ - Q_UNUSED(icon); - m_systray->showMessage(title, msg, static_cast<QSystemTrayIcon::MessageIcon>(iconType), msecs); -} - -bool QWidgetPlatformSystemTrayIcon::isSystemTrayAvailable() const -{ - return QSystemTrayIcon::isSystemTrayAvailable(); -} - -bool QWidgetPlatformSystemTrayIcon::supportsMessages() const -{ - return QSystemTrayIcon::supportsMessages(); -} - -QPlatformMenu *QWidgetPlatformSystemTrayIcon::createMenu() const -{ - return new QWidgetPlatformMenu; -} - -QT_END_NAMESPACE diff --git a/src/labs/platform/widgets/qwidgetplatformsystemtrayicon_p.h b/src/labs/platform/widgets/qwidgetplatformsystemtrayicon_p.h deleted file mode 100644 index 11ea5377..00000000 --- a/src/labs/platform/widgets/qwidgetplatformsystemtrayicon_p.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Labs Platform module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL3$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see http://www.qt.io/terms-conditions. For further -** information use the contact form at http://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPLv3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or later as published by the Free -** Software Foundation and appearing in the file LICENSE.GPL included in -** the packaging of this file. Please review the following information to -** ensure the GNU General Public License version 2.0 requirements will be -** met: http://www.gnu.org/licenses/gpl-2.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWIDGETPLATFORMSYSTEMTRAYICON_P_H -#define QWIDGETPLATFORMSYSTEMTRAYICON_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QtGui/qpa/qplatformsystemtrayicon.h> - -QT_REQUIRE_CONFIG(systemtrayicon); - -QT_BEGIN_NAMESPACE - -class QSystemTrayIcon; - -class QWidgetPlatformSystemTrayIcon : public QPlatformSystemTrayIcon -{ - Q_OBJECT - -public: - explicit QWidgetPlatformSystemTrayIcon(QObject *parent = nullptr); - ~QWidgetPlatformSystemTrayIcon(); - - void init() override; - void cleanup() override; - void updateIcon(const QIcon &icon) override; - void updateToolTip(const QString &tooltip) override; - void updateMenu(QPlatformMenu *menu) override; - QRect geometry() const override; - void showMessage(const QString &title, const QString &msg, - const QIcon &icon, MessageIcon iconType, int msecs) override; - - bool isSystemTrayAvailable() const override; - bool supportsMessages() const override; - - QPlatformMenu *createMenu() const override; - -private: - QScopedPointer<QSystemTrayIcon> m_systray; -}; - -QT_END_NAMESPACE - -#endif // QWIDGETPLATFORMSYSTEMTRAYICON_P_H diff --git a/src/labs/platform/widgets/widgets.pri b/src/labs/platform/widgets/widgets.pri deleted file mode 100644 index 54ad7187..00000000 --- a/src/labs/platform/widgets/widgets.pri +++ /dev/null @@ -1,56 +0,0 @@ -QT += widgets -DEPENDPATH += $$PWD - -HEADERS += \ - $$PWD/qwidgetplatform_p.h - -qtConfig(systemtrayicon) { - HEADERS += \ - $$PWD/qwidgetplatformsystemtrayicon_p.h - SOURCES += \ - $$PWD/qwidgetplatformsystemtrayicon.cpp -} - -qtConfig(colordialog) | qtConfig(filedialog) | qtConfig(fontdialog) | qtConfig(messagebox) { - HEADERS += \ - $$PWD/qwidgetplatformdialog_p.h - SOURCES += \ - $$PWD/qwidgetplatformdialog.cpp -} - -qtConfig(colordialog) { - HEADERS += \ - $$PWD/qwidgetplatformcolordialog_p.h - SOURCES += \ - $$PWD/qwidgetplatformcolordialog.cpp -} - -qtConfig(filedialog) { - HEADERS += \ - $$PWD/qwidgetplatformfiledialog_p.h - SOURCES += \ - $$PWD/qwidgetplatformfiledialog.cpp -} - -qtConfig(fontdialog) { - HEADERS += \ - $$PWD/qwidgetplatformfontdialog_p.h - SOURCES += \ - $$PWD/qwidgetplatformfontdialog.cpp -} - -qtConfig(menu) { - HEADERS += \ - $$PWD/qwidgetplatformmenu_p.h \ - $$PWD/qwidgetplatformmenuitem_p.h - SOURCES += \ - $$PWD/qwidgetplatformmenu.cpp \ - $$PWD/qwidgetplatformmenuitem.cpp -} - -qtConfig(messagebox) { - HEADERS += \ - $$PWD/qwidgetplatformmessagedialog_p.h - SOURCES += \ - $$PWD/qwidgetplatformmessagedialog.cpp -} |