diff options
-rw-r--r-- | src/controls/controls.pri | 6 | ||||
-rw-r--r-- | src/controls/qquicktoolbutton.cpp | 57 | ||||
-rw-r--r-- | src/controls/qquicktoolbutton_p.h | 65 | ||||
-rw-r--r-- | src/imports/controls/ToolButton.qml | 2 | ||||
-rw-r--r-- | src/imports/controls/qtquickcontrols2plugin.cpp | 2 |
5 files changed, 129 insertions, 3 deletions
diff --git a/src/controls/controls.pri b/src/controls/controls.pri index bf636066..743f2ee9 100644 --- a/src/controls/controls.pri +++ b/src/controls/controls.pri @@ -31,7 +31,8 @@ HEADERS += \ $$PWD/qquicktextarea_p.h \ $$PWD/qquicktextfield_p.h \ $$PWD/qquicktogglebutton_p.h \ - $$PWD/qquicktoolbar_p.h + $$PWD/qquicktoolbar_p.h \ + $$PWD/qquicktoolbutton_p.h SOURCES += \ $$PWD/qquickapplicationwindow.cpp \ @@ -59,4 +60,5 @@ SOURCES += \ $$PWD/qquicktextarea.cpp \ $$PWD/qquicktextfield.cpp \ $$PWD/qquicktogglebutton.cpp \ - $$PWD/qquicktoolbar.cpp + $$PWD/qquicktoolbar.cpp \ + $$PWD/qquicktoolbutton.cpp diff --git a/src/controls/qquicktoolbutton.cpp b/src/controls/qquicktoolbutton.cpp new file mode 100644 index 00000000..12a8f9f3 --- /dev/null +++ b/src/controls/qquicktoolbutton.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qquicktoolbutton_p.h" + +QT_BEGIN_NAMESPACE + +/*! + \qmltype ToolButton + \inherits Button + \instantiates QQuickToolButton + \inqmlmodule QtQuick.Controls + \ingroup buttons + \brief A tool button control. + + TODO +*/ + +QQuickToolButton::QQuickToolButton(QQuickItem *parent) : + QQuickButton(parent) +{ +} + +QT_END_NAMESPACE diff --git a/src/controls/qquicktoolbutton_p.h b/src/controls/qquicktoolbutton_p.h new file mode 100644 index 00000000..6a814755 --- /dev/null +++ b/src/controls/qquicktoolbutton_p.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QQUICKTOOLBUTTON_P_H +#define QQUICKTOOLBUTTON_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtQuickControls/private/qquickbutton_p.h> + +QT_BEGIN_NAMESPACE + +class Q_QUICKCONTROLS_EXPORT QQuickToolButton : public QQuickButton +{ + Q_OBJECT + +public: + explicit QQuickToolButton(QQuickItem *parent = Q_NULLPTR); +}; + +QT_END_NAMESPACE + +#endif // QQUICKTOOLBUTTON_P_H diff --git a/src/imports/controls/ToolButton.qml b/src/imports/controls/ToolButton.qml index 83d3eee2..9a700bda 100644 --- a/src/imports/controls/ToolButton.qml +++ b/src/imports/controls/ToolButton.qml @@ -37,7 +37,7 @@ import QtQuick 2.6 import QtQuick.Controls 2.0 -AbstractButton { +AbstractToolButton { id: control implicitWidth: Math.max(background ? background.implicitWidth : 0, diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index c3ff6bf1..bc01fd0d 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -58,6 +58,7 @@ #include <QtQuickControls/private/qquicktextfield_p.h> #include <QtQuickControls/private/qquicktogglebutton_p.h> #include <QtQuickControls/private/qquicktoolbar_p.h> +#include <QtQuickControls/private/qquicktoolbutton_p.h> #include <QtQuickControls/private/qquickcontrol_p.h> #include <QtQuickControls/private/qquickexclusivegroup_p.h> @@ -102,6 +103,7 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterType<QQuickTextField>(uri, 2, 0, "AbstractTextField"); qmlRegisterType<QQuickToggleButton>(uri, 2, 0, "AbstractToggleButton"); qmlRegisterType<QQuickToolBar>(uri, 2, 0, "AbstractToolBar"); + qmlRegisterType<QQuickToolButton>(uri, 2, 0, "AbstractToolButton"); qmlRegisterUncreatableType<QQuickExclusiveAttached>(uri, 2, 0, "Exclusive", "Exclusive is an attached property"); qmlRegisterUncreatableType<QQuickStackAttached>(uri, 2, 0, "Stack", "Stack is an attached property"); |