KDDockWidgets API Documentation 2.1
Loading...
Searching...
No Matches
flutter/views/View.h
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2020 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#pragma once
13
14#include "kddockwidgets/core/Controller.h"
15#include "kddockwidgets/core/View.h"
16
17#include <memory>
18#include <optional>
19
20namespace KDDockWidgets::flutter {
21
22class DOCKS_EXPORT View : public Core::View
23{
24public:
25 using Core::View::close;
26 using Core::View::resize;
27
28 explicit View(Core::Controller *controller, Core::ViewType type, Core::View *,
29 Qt::WindowFlags windowFlags = {});
30
31 ~View() override;
32
33 Size minSize() const override;
34 Size maxSizeHint() const override;
35 Rect geometry() const override;
36 Rect normalGeometry() const override;
37 void setNormalGeometry(Rect geo);
38 void setGeometry(Rect geometry) override;
39 void setMaximumSize(Size sz) override;
40
41 bool isVisible() const override;
42 void setVisible(bool visible) override;
43 bool isExplicitlyHidden() const override;
44
45 void move(int x, int y) override;
46 void setSize(int w, int h) override;
47
48 void setWidth(int w) override;
49 void setHeight(int h) override;
50 void setFixedWidth(int w) override;
51 void setFixedHeight(int h) override;
52 void show() override;
53 void hide() override;
54 void updateGeometry();
55 void update() override;
56 void setParent(Core::View *parent) override;
57 void raiseAndActivate() override;
58 void activateWindow() override;
59 void raise() override;
60 bool isRootView() const override;
61 Point mapToGlobal(Point localPt) const override;
62 Point mapFromGlobal(Point globalPt) const override;
63 Point mapTo(Core::View *parent, Point pos) const override;
64 void setWindowOpacity(double v) override;
65
70 bool onFlutterWidgetResized(int w, int h);
71
72 bool close() override;
73 void setFlag(Qt::WindowType f, bool on = true) override;
74 void enableAttribute(Qt::WidgetAttribute attr, bool enable = true) override;
75 bool hasAttribute(Qt::WidgetAttribute attr) const override;
76 Qt::WindowFlags flags() const override;
77
78 void setWindowTitle(const QString &title) override;
79 void setWindowIcon(const Icon &icon) override;
80 bool isActiveWindow() const override;
81
82 void showNormal() override;
83 void showMinimized() override;
84 void showMaximized() override;
85
86 bool isMinimized() const override;
87 bool isMaximized() const override;
88
89 std::shared_ptr<Core::Window> window() const override;
90 std::shared_ptr<Core::View> childViewAt(Point p) const override;
91 std::shared_ptr<Core::View> rootView() const override;
92 std::shared_ptr<Core::View> parentView() const override;
93 std::shared_ptr<Core::View> asWrapper() override;
94
95 void setViewName(const QString &name) override;
96 void grabMouse() override;
97 void releaseMouse() override;
98 void releaseKeyboard() override;
99 void setFocus(Qt::FocusReason reason) override;
100 Qt::FocusPolicy focusPolicy() const override;
101 bool hasFocus() const override;
102 void setFocusPolicy(Qt::FocusPolicy policy) override;
103 QString viewName() const override;
104 void setMinimumSize(Size sz) override;
105 void render(QPainter *) override;
106 void setCursor(Qt::CursorShape shape) override;
107 void setMouseTracking(bool enable) override;
108 Vector<std::shared_ptr<Core::View>> childViews() const override;
109 void setZOrder(int z) override;
110 Core::HANDLE handle() const override;
111
112 virtual void onChildAdded(Core::View *childView);
113 virtual void onChildRemoved(Core::View *childView);
114 virtual void onChildVisibilityChanged(Core::View *childView);
115 virtual void raiseChild(Core::View *childView);
116 virtual void raiseWindow(Core::View *rootView);
117 virtual void onGeometryChanged();
118
121 virtual bool isMounted() const;
122
124 void onMouseEvent(Event::Type eventType, Point localPos, Point globalPos, bool leftIsPressed);
125
127 virtual void onMousePress(MouseEvent *)
128 {
129 }
130
132 virtual void onRebuildRequested();
133
134private:
135 View *m_parentView = nullptr;
136 QString m_name;
137 Size m_minSize;
138 Size m_maxSize;
139 Rect m_geometry;
140 std::optional<bool> m_visible;
141 bool m_inCtor = true;
143};
144
146{
147 if (!view)
148 return nullptr;
149 return static_cast<View *>(view);
150}
151
153{
154 if (!controller)
155 return nullptr;
156
157 return static_cast<View *>(controller->view());
158}
159
160} // namespace KDDockWidgets::flutter
#define KDDW_DELETE_COPY_CTOR(NAME)
View * view() const
Returns the view associated with this controller, if any.
virtual void onMousePress(MouseEvent *)
View can override if it's interested in events which the event filter rejected.
ViewType
Each View type also has a specific Controller associated with, except for ViewType::None.
Definition Controller.h:26
const void * HANDLE
Definition core/View.h:28
View * asView_flutter(Core::View *view)
CursorShape
FocusPolicy
FocusReason
WidgetAttribute
typedef WindowFlags

© 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