KDDockWidgets API Documentation 1.7
Loading...
Searching...
No Matches
FrameworkWidgetFactory.h
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2019-2023 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 KDDOCKWIDGETS_FRAMEWORKWIDGETFACTORY_H
13#define KDDOCKWIDGETS_FRAMEWORKWIDGETFACTORY_H
14
15#include "docks_export.h"
16#include "KDDockWidgets.h"
17#include "QWidgetAdapter.h"
18
19#include <QMap>
20
21#include <utility>
22
23// clazy:excludeall=ctor-missing-parent-argument
24
32QT_BEGIN_NAMESPACE
33class QAbstractButton;
35
36namespace Layouting {
37class Separator;
38class Widget;
39}
40
41namespace KDDockWidgets {
42
43class MainWindowBase;
44class DropIndicatorOverlayInterface;
45class FloatingWindow;
46class TabWidget;
47class TitleBar;
48class Frame;
49class DropArea;
50class SideBar;
51class TabBar;
52class TabWidgetQuick;
53
71class DOCKS_EXPORT FrameworkWidgetFactory : public QObject
72{
73 Q_OBJECT
74public:
76
80
87 virtual Frame *createFrame(QWidgetOrQuick *parent = nullptr, FrameOptions options = FrameOption_None) const = 0;
88
93 virtual TitleBar *createTitleBar(Frame *frame) const = 0;
94
99 virtual TitleBar *createTitleBar(FloatingWindow *floatingWindow) const = 0;
100
104 virtual TabWidget *createTabWidget(Frame *parent, TabWidgetOptions options = TabWidgetOption_None) const = 0;
105
109 virtual TabBar *createTabBar(TabWidget *parent = nullptr) const = 0;
110
115 virtual Layouting::Separator *createSeparator(Layouting::Widget *parent = nullptr) const = 0;
116
121 virtual FloatingWindow *createFloatingWindow(MainWindowBase *parent = nullptr,
122 FloatingWindowFlags = FloatingWindowFlag::FromGlobalConfig) const = 0;
123
129 virtual FloatingWindow *createFloatingWindow(Frame *frame, MainWindowBase *parent = nullptr, QRect suggestedGeometry = {}) const = 0;
130
134 virtual DropIndicatorOverlayInterface *createDropIndicatorOverlay(DropArea *dropArea) const = 0;
135
138 virtual QWidgetOrQuick *createRubberBand(QWidgetOrQuick *parent) const = 0;
139
143 virtual SideBar *createSideBar(SideBarLocation loc, MainWindowBase *parent) const = 0;
144
145#ifdef KDDOCKWIDGETS_QTWIDGETS
149#else
150 virtual QUrl titleBarFilename() const = 0;
151 virtual QUrl dockwidgetFilename() const = 0;
152 virtual QUrl frameFilename() const = 0;
153 virtual QUrl floatingWindowFilename() const = 0;
154#endif
155
158 virtual QIcon iconForButtonType(TitleBarButtonType type, qreal dpr) const = 0;
159
160private:
161 Q_DISABLE_COPY(FrameworkWidgetFactory)
162};
163
168{
169 Q_OBJECT
170public:
172 Frame *createFrame(QWidgetOrQuick *parent, FrameOptions) const override;
173 TitleBar *createTitleBar(Frame *) const override;
174 TitleBar *createTitleBar(FloatingWindow *) const override;
175 TabWidget *createTabWidget(Frame *parent, TabWidgetOptions = TabWidgetOption_None) const override;
176 TabBar *createTabBar(TabWidget *parent) const override;
177 Layouting::Separator *createSeparator(Layouting::Widget *parent = nullptr) const override;
178 FloatingWindow *createFloatingWindow(MainWindowBase *parent = nullptr, FloatingWindowFlags = FloatingWindowFlag::FromGlobalConfig) const override;
179 FloatingWindow *createFloatingWindow(Frame *frame, MainWindowBase *parent = nullptr, QRect suggestedGeometry = {}) const override;
180 DropIndicatorOverlayInterface *createDropIndicatorOverlay(DropArea *) const override;
181 QWidgetOrQuick *createRubberBand(QWidgetOrQuick *parent) const override;
182 SideBar *createSideBar(SideBarLocation loc, MainWindowBase *parent) const override;
183
184#ifdef KDDOCKWIDGETS_QTWIDGETS
185 QAbstractButton *createTitleBarButton(QWidget *parent, TitleBarButtonType) const override;
186#else
187 Q_INVOKABLE QUrl titleBarFilename() const override;
188 QUrl dockwidgetFilename() const override;
189 QUrl frameFilename() const override;
190 QUrl floatingWindowFilename() const override;
191#endif
192
193 QIcon iconForButtonType(TitleBarButtonType type, qreal dpr) const override;
194 void clearIconCache();
195
197
198private:
199 Q_DISABLE_COPY(DefaultWidgetFactory)
200 mutable QMap<std::pair<TitleBarButtonType, qreal>, QIcon> m_cachedIcons;
201};
202
203}
204
205#endif
File with KDDockWidgets namespace-level enums and methods.
Abstraction for supporting both QtWidgets and QtQuick.
The FrameworkWidgetFactory that's used if none is specified.
A factory class for allowing the user to customize some internal widgets. This is optional,...
virtual TitleBar * createTitleBar(FloatingWindow *floatingWindow) const =0
Called internally by the framework to create a TitleBar Override to provide your own TitleBar sub-cla...
virtual FloatingWindow * createFloatingWindow(MainWindowBase *parent=nullptr, FloatingWindowFlags=FloatingWindowFlag::FromGlobalConfig) const =0
Called internally by the framework to create a FloatingWindow Override to provide your own FloatingWi...
virtual QIcon iconForButtonType(TitleBarButtonType type, qreal dpr) const =0
Returns the icon to be used with the specified type.
virtual TitleBar * createTitleBar(Frame *frame) const =0
Called internally by the framework to create a TitleBar Override to provide your own TitleBar sub-cla...
virtual TabBar * createTabBar(TabWidget *parent=nullptr) const =0
Called internally by the framework to create a TabBar Override to provide your own TabBar sub-class.
virtual Frame * createFrame(QWidgetOrQuick *parent=nullptr, FrameOptions options=FrameOption_None) const =0
Called internally by the framework to create a Frame class Override to provide your own Frame sub-cla...
virtual QWidgetOrQuick * createRubberBand(QWidgetOrQuick *parent) const =0
Called internally by the framework to create a RubberBand to show as drop zone Returns a rubber band.
virtual SideBar * createSideBar(SideBarLocation loc, MainWindowBase *parent) const =0
Called internally by the framework to create a SideBar.
virtual Layouting::Separator * createSeparator(Layouting::Widget *parent=nullptr) const =0
Called internally by the framework to create a Separator Override to provide your own Separator sub-c...
virtual QAbstractButton * createTitleBarButton(QWidget *parent, TitleBarButtonType) const =0
Called internally by the framework to create a title bar button parent the button's parent.
virtual TabWidget * createTabWidget(Frame *parent, TabWidgetOptions options=TabWidgetOption_None) const =0
Called internally by the framework to create a TabWidget Override to provide your own TabWidget sub-c...
virtual DropIndicatorOverlayInterface * createDropIndicatorOverlay(DropArea *dropArea) const =0
Called internally by the framework to create a DropIndicatorOverlayInterface Override to provide your...
virtual FloatingWindow * createFloatingWindow(Frame *frame, MainWindowBase *parent=nullptr, QRect suggestedGeometry={}) const =0
Called internally by the framework to create a FloatingWindow Override to provide your own FloatingWi...
The MainWindow base-class. MainWindow and MainWindowBase are only split in two so we can share some c...
An abstraction/wrapper around QWidget, QtQuickItem or anything else.
Definition Widget.h:77
SideBarLocation
Each main window supports 4 sidebars.
TitleBarButtonType
describes a type of button you can have in the title bar
T qobject_cast(QObject *object)

© 2019-2023 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 Wed Nov 1 2023 00:02:31 for KDDockWidgets API Documentation by doxygen 1.9.8