Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquicksplitview_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2018 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// Qt-Security score:significant reason:default
4
5#ifndef QQUICKSPLITVIEW_P_P_H
6#define QQUICKSPLITVIEW_P_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTemplates2/private/qquickcontainer_p_p.h>
20
22
23class QQuickSplitView;
24class QQuickSplitViewAttached;
25class QQuickSplitHandleAttached;
26
27class Q_QUICKTEMPLATES2_EXPORT QQuickSplitViewPrivate : public QQuickContainerPrivate
28{
29 Q_DECLARE_PUBLIC(QQuickSplitView)
30
31public:
32 void updateFillIndex();
33 void layoutResizeSplitItems(qreal &usedWidth, qreal &usedHeight, int &indexBeingResizedDueToDrag);
34 void layoutResizeFillItem(QQuickItem *fillItem, qreal &usedWidth, qreal &usedHeight, int indexBeingResizedDueToDrag);
35 void limitAndApplySizes(qreal usedWidth, qreal usedHeight);
36 void layoutPositionItems(const QQuickItem *fillItem);
37 void requestLayout();
38 void layout();
39 void createHandles();
40 void createHandleItem(int index);
41 void removeExcessHandles();
42 void destroyHandles();
43 void resizeHandle(QQuickItem *handleItem);
44 void resizeHandles();
45#if QT_CONFIG(cursor)
46 void updateCursorHandle(QQuickItem *handleItem);
47#endif
48 void updateHandleVisibilities();
49 void updateHoveredHandle(QQuickItem *hoveredItem);
50 void setResizing(bool resizing);
51
52 bool isHorizontal() const;
53 qreal accumulatedSize(int firstIndex, int lastIndex) const;
54
55 struct EffectiveSizeData {
56 qreal effectiveMinimumWidth;
57 qreal effectiveMinimumHeight;
58 qreal effectivePreferredWidth;
59 qreal effectivePreferredHeight;
60 qreal effectiveMaximumWidth;
61 qreal effectiveMaximumHeight;
62 };
63
64 // Used during the layout
65 struct LayoutData {
66 qreal width = 0;
67 qreal height = 0;
68 bool wasResizedByHandle = false;
69 };
70
71 EffectiveSizeData effectiveSizeData(const QQuickItemPrivate *itemPrivate,
72 const QQuickSplitViewAttached *attached) const;
73
74 int handleIndexForSplitIndex(int splitIndex) const;
75
76 QQuickItem *getContentItem() override;
77 bool handlePress(const QPointF &point, ulong timestamp) override;
78 bool handleMove(const QPointF &point, ulong timestamp) override;
79 bool handleRelease(const QPointF &point, ulong timestamp) override;
80
81 void itemVisibilityChanged(QQuickItem *item) override;
82 void itemImplicitWidthChanged(QQuickItem *item) override;
83 void itemImplicitHeightChanged(QQuickItem *item) override;
84
85 void updatePolish() override;
86
87 static QQuickSplitViewPrivate *get(QQuickSplitView *splitView);
88
89 Qt::Orientation m_orientation = Qt::Horizontal;
90 QQmlComponent *m_handle = nullptr;
91 QList<QQuickItem*> m_handleItems;
92 QHash<QQuickItem*, LayoutData> m_layoutData;
93 int m_hoveredHandleIndex = -1;
94 int m_pressedHandleIndex = -1;
95 int m_nextVisibleIndexAfterPressedHandle = -1;
96 QPointF m_pressPos;
97 QPointF m_mousePos;
98 QPointF m_handlePosBeforePress;
99 qreal m_leftOrTopItemSizeBeforePress = 0.0;
100 qreal m_rightOrBottomItemSizeBeforePress = 0.0;
101 int m_fillIndex = -1;
102 bool m_layingOut = false;
103 bool m_ignoreNextLayoutRequest = false;
104 bool m_resizing = false;
105};
106
108{
109 Q_DECLARE_PUBLIC(QQuickSplitViewAttached)
110
111public:
113
114 void setView(QQuickSplitView *newView);
115 void requestLayoutView();
116
117 static QQuickSplitViewAttachedPrivate *get(QQuickSplitViewAttached *attached);
118 static const QQuickSplitViewAttachedPrivate *get(const QQuickSplitViewAttached *attached);
119
121 QQuickSplitView *m_splitView = nullptr;
122
123 unsigned m_fillWidth : 1;
124 unsigned m_fillHeight : 1;
125 unsigned m_isFillWidthSet : 1;
126 unsigned m_isFillHeightSet : 1;
139};
140
142{
143 Q_DECLARE_PUBLIC(QQuickSplitHandleAttached)
144
145public:
147
148 void setHovered(bool hovered);
149 void setPressed(bool pressed);
150
151 static QQuickSplitHandleAttachedPrivate *get(QQuickSplitHandleAttached *attached);
152 static const QQuickSplitHandleAttachedPrivate *get(const QQuickSplitHandleAttached *attached);
153
154 unsigned m_hovered : 1;
155 unsigned m_pressed : 1;
156};
157
158QT_END_NAMESPACE
159
160#endif // QQUICKSPLITVIEW_P_P_H
static QQuickSplitHandleAttachedPrivate * get(QQuickSplitHandleAttached *attached)
static const QQuickSplitHandleAttachedPrivate * get(const QQuickSplitHandleAttached *attached)
void setView(QQuickSplitView *newView)
static QQuickSplitViewAttachedPrivate * get(QQuickSplitViewAttached *attached)
static const QQuickSplitViewAttachedPrivate * get(const QQuickSplitViewAttached *attached)
QT_REQUIRE_CONFIG(quicktemplates2_container)
qreal effectiveMaximumHeight(const QQuickSplitViewAttachedPrivate *attachedPrivate)
qreal effectivePreferredHeight(const QQuickSplitViewAttachedPrivate *attachedPrivate, const QQuickItemPrivate *itemPrivate)
qreal effectivePreferredWidth(const QQuickSplitViewAttachedPrivate *attachedPrivate, const QQuickItemPrivate *itemPrivate)
qreal effectiveMinimumWidth(const QQuickSplitViewAttachedPrivate *attachedPrivate)
qreal effectiveMaximumWidth(const QQuickSplitViewAttachedPrivate *attachedPrivate)
qreal effectiveMinimumHeight(const QQuickSplitViewAttachedPrivate *attachedPrivate)