KDDockWidgets API Documentation 2.1
Loading...
Searching...
No Matches
qtquick/views/TitleBar.h
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2019 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: SĂ©rgio Martins <sergio.martins@kdab.com>
6
7 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
8
9 Contact KDAB at <info@kdab.com> for commercial licensing options.
10*/
11
12#ifndef KD_TITLEBARQUICK_P_H
13#define KD_TITLEBARQUICK_P_H
14#pragma once
15
16#include "kddockwidgets/docks_export.h"
17#include "kddockwidgets/core/views/TitleBarViewInterface.h"
18#include "View.h"
19
20namespace KDDockWidgets {
21
22
23namespace Core {
24class TitleBar;
25}
26
27namespace QtQuick {
28
29class DOCKS_EXPORT TitleBar : public QtQuick::View, public Core::TitleBarViewInterface
30{
31 Q_OBJECT
32 // These properties is just for the unit-tests
33 Q_PROPERTY(QQuickItem *titleBarQmlItem READ titleBarQmlItem WRITE setTitleBarQmlItem NOTIFY
34 titleBarQmlItemChanged)
35 Q_PROPERTY(QQuickItem *titleBarMouseArea READ titleBarMouseArea CONSTANT)
36 Q_PROPERTY(QString title READ title NOTIFY titleChanged)
37 Q_PROPERTY(bool hasIcon READ hasIcon NOTIFY iconChanged)
38 Q_PROPERTY(bool closeButtonEnabled READ closeButtonEnabled WRITE setCloseButtonEnabled NOTIFY
39 closeButtonEnabledChanged)
40 Q_PROPERTY(bool floatButtonVisible READ floatButtonVisible WRITE setFloatButtonVisible NOTIFY
41 floatButtonVisibleChanged)
42 Q_PROPERTY(bool maximizeButtonVisible READ maximizeButtonVisible NOTIFY
43 maximizeButtonVisibleChanged)
44 Q_PROPERTY(bool minimizeButtonVisible READ minimizeButtonVisible NOTIFY
45 minimizeButtonVisibleChanged)
46 Q_PROPERTY(QString floatButtonToolTip READ floatButtonToolTip NOTIFY floatButtonToolTipChanged)
47 Q_PROPERTY(bool isFocused READ isFocused NOTIFY isFocusedChanged)
48 Q_PROPERTY(bool maximizeUsesRestoreIcon READ maximizeUsesRestoreIcon NOTIFY maximizeButtonVisibleChanged)
49
50
51public:
52 explicit TitleBar(Core::TitleBar *controller, QQuickItem *parent = nullptr);
53 ~TitleBar() override;
54
55protected:
56#ifdef DOCKS_DEVELOPER_MODE
57 // These 3 just for unit-tests
58 bool isCloseButtonEnabled() const override;
59 bool isCloseButtonVisible() const override;
60 bool isFloatButtonVisible() const override;
61#endif
62
63 QQuickItem *titleBarQmlItem() const;
64 QQuickItem *titleBarMouseArea() const;
65 void setTitleBarQmlItem(QQuickItem *);
66
67 // QML interface
68 bool isFocused() const;
69 bool floatButtonVisible() const;
70 bool minimizeButtonVisible() const;
71 bool maximizeButtonVisible() const;
72 bool maximizeUsesRestoreIcon() const;
73 bool closeButtonEnabled() const;
74 QString floatButtonToolTip() const;
75 bool hasIcon() const;
76 QString title() const;
77 void setCloseButtonEnabled(bool);
78 void setFloatButtonVisible(bool);
79
80 Q_INVOKABLE bool onDoubleClicked();
81 Q_INVOKABLE void onCloseClicked();
82 Q_INVOKABLE void onFloatClicked();
83
84 Q_INVOKABLE void onMinimizeClicked();
85 Q_INVOKABLE void onAutoHideClicked();
86 Q_INVOKABLE bool isFloating() const;
87 Q_INVOKABLE bool isMaximized() const override;
88
90 Q_INVOKABLE void toggleMaximized();
91 Q_INVOKABLE void onMaximizeClicked();
92
93Q_SIGNALS:
103
106
107protected:
108 void init() override;
109 bool event(QEvent *) override;
110
111private:
112 QQuickItem *floatButton() const;
113 QQuickItem *closeButton() const;
114
115 QPointer<QQuickItem> m_titleBarQmlItem;
116};
117
118}
119
120}
121
122#endif
The interface that TitleBar views should implement.
void floatButtonToolTipChanged(const QString &)
void numDockWidgetsChanged()
Emitted when the number of dock widgets under this titlebar changes.
Class to abstract QAction, so code still works with QtQuick and Flutter.

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated by doxygen 1.9.8