1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qquicktoolbutton_p.h"
5#include "qquickcontrol_p_p.h"
6#include "qquickbutton_p_p.h"
7
8#include <QtGui/qpa/qplatformtheme.h>
9
10QT_BEGIN_NAMESPACE
11
12/*!
13 \qmltype ToolButton
14 \inherits Button
15//! \instantiates QQuickToolButton
16 \inqmlmodule QtQuick.Controls
17 \since 5.7
18 \ingroup qtquickcontrols-buttons
19 \brief Button with a look suitable for a ToolBar.
20
21 ToolButton is functionally similar to \l Button, but provides a look that
22 is more suitable within a \l ToolBar.
23
24 \image qtquickcontrols-toolbar.png
25
26 \snippet qtquickcontrols-toolbar.qml 1
27
28 ToolButton inherits its API from AbstractButton. For instance, you can set
29 \l {AbstractButton::text}{text}, display an \l {Icons in Qt Quick Controls}{icon},
30 and react to \l {AbstractButton::clicked}{clicks} using the AbstractButton API.
31
32 \sa ToolBar, {Customizing ToolButton}, {Button Controls}
33*/
34
35class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickToolPrivate : public QQuickButtonPrivate
36{
37 Q_DECLARE_PUBLIC(QQuickToolButton)
38
39public:
40 QPalette defaultPalette() const override { return QQuickTheme::palette(scope: QQuickTheme::ToolBar); }
41};
42
43QQuickToolButton::QQuickToolButton(QQuickItem *parent)
44 : QQuickButton(*(new QQuickToolPrivate), parent)
45{
46}
47
48QFont QQuickToolButton::defaultFont() const
49{
50 return QQuickTheme::font(scope: QQuickTheme::ToolBar);
51}
52
53QT_END_NAMESPACE
54
55#include "moc_qquicktoolbutton_p.cpp"
56

source code of qtdeclarative/src/quicktemplates/qquicktoolbutton.cpp