KDDockWidgets API Documentation  1.5
TitleBarQuick.cpp
Go to the documentation of this file.
1 /*
2  This file is part of KDDockWidgets.
3 
4  SPDX-FileCopyrightText: 2019-2022 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 #include "TitleBarQuick_p.h"
13 
14 #include "../DragController_p.h"
15 #include "../Frame_p.h"
16 #include "../FloatingWindow_p.h"
17 #include "../Logging_p.h"
18 #include "../WindowBeingDragged_p.h"
19 #include "../Utils_p.h"
20 
21 
22 using namespace KDDockWidgets;
23 
24 
25 TitleBarQuick::TitleBarQuick(Frame *parent)
26  : TitleBar(parent)
27 {
28  setFixedHeight(30);
29 }
30 
31 TitleBarQuick::TitleBarQuick(FloatingWindow *parent)
32  : TitleBar(parent)
33 {
34  setFixedHeight(30);
35 }
36 
37 TitleBarQuick::~TitleBarQuick()
38 {
39 }
40 
41 #ifdef DOCKS_DEVELOPER_MODE
42 bool TitleBarQuick::isCloseButtonEnabled() const
43 {
44  if (QQuickItem *button = closeButton())
45  return button->isEnabled();
46  return false;
47 }
48 
49 bool TitleBarQuick::isCloseButtonVisible() const
50 {
51  if (QQuickItem *button = closeButton())
52  return button->isVisible();
53 
54  return true;
55 }
56 
57 bool TitleBarQuick::isFloatButtonEnabled() const
58 {
59  if (QQuickItem *button = floatButton())
60  return button->isEnabled();
61 
62  return true;
63 }
64 
65 bool TitleBarQuick::isFloatButtonVisible() const
66 {
67  if (QQuickItem *button = floatButton())
68  return button->isVisible();
69 
70  return true;
71 }
72 #endif
73 
74 QQuickItem *TitleBarQuick::titleBarQmlItem() const
75 {
76  return m_titleBarQmlItem;
77 }
78 
79 QQuickItem *TitleBarQuick::titleBarMouseArea() const
80 {
81  if (m_titleBarQmlItem)
82  return m_titleBarQmlItem->property("mouseAreaForTests").value<QQuickItem *>();
83 
84  return nullptr;
85 }
86 
87 void TitleBarQuick::setTitleBarQmlItem(QQuickItem *item)
88 {
89  if (item != m_titleBarQmlItem) {
90  m_titleBarQmlItem = item;
91  Q_EMIT titleBarQmlItemChanged();
92  }
93 }
94 
95 QQuickItem *TitleBarQuick::floatButton() const
96 {
97  return m_titleBarQmlItem ? m_titleBarQmlItem->property("floatButton").value<QQuickItem *>()
98  : nullptr;
99 }
100 
101 QQuickItem *TitleBarQuick::closeButton() const
102 {
103  return m_titleBarQmlItem ? m_titleBarQmlItem->property("closeButton").value<QQuickItem *>()
104  : nullptr;
105 }
KDDockWidgets
Definition: Config.cpp:36

© 2019-2022 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 on Mon Mar 7 2022 02:01:21 for KDDockWidgets API Documentation by doxygen 1.8.20