v2.0.0
Loading...
Searching...
No Matches
multiviewlayout.h
Go to the documentation of this file.
1//=============================================================================================================
19
20#ifndef MULTIVIEWLAYOUT_H
21#define MULTIVIEWLAYOUT_H
22
23//=============================================================================================================
24// INCLUDES
25//=============================================================================================================
26
27#include "../disp3D_global.h"
28
29#include <QRect>
30#include <QSize>
31#include <QPoint>
32#include <QVector>
33#include <Qt>
34
35namespace DISP3DLIB
36{
37
38//=============================================================================================================
49
50//=============================================================================================================
70{
71public:
72 //=========================================================================================================
76 MultiViewLayout() = default;
77
78 // ── Split fractions ────────────────────────────────────────────────
79
80 float splitX() const
81 {
82 return m_splitX;
83 }
84 float splitY() const
85 {
86 return m_splitY;
87 }
88 void setSplitX(float x)
89 {
90 m_splitX = clampSplit(x);
91 }
92 void setSplitY(float y)
93 {
94 m_splitY = clampSplit(y);
95 }
97 {
98 m_splitX = 0.5f;
99 m_splitY = 0.5f;
100 }
101
102 // ── Tolerance / sizing constants ───────────────────────────────────
103
104 int hitTolerancePx() const
105 {
106 return m_hitTolerancePx;
107 }
108 int minPanePx() const
109 {
110 return m_minPanePx;
111 }
112 int separatorLinePx() const
113 {
114 return m_separatorLinePx;
115 }
116
117 //=========================================================================================================
126 QRect slotRect(int slot, int numEnabled, const QSize& outputSize) const;
127
128 //=========================================================================================================
137 SplitterHit hitTestSplitter(const QPoint& pos,
138 int numEnabled,
139 const QSize& outputSize) const;
140
141 //=========================================================================================================
148 static Qt::CursorShape cursorForHit(SplitterHit hit);
149
150 //=========================================================================================================
160 int viewportIndexAt(const QPoint& pos,
161 const QVector<int>& enabledViewports,
162 const QSize& outputSize) const;
163
164 //=========================================================================================================
175 QRect insetForSeparator(const QRect& paneRect,
176 int slot,
177 int numEnabled) const;
178
179 //=========================================================================================================
188 void separatorGeometries(int numEnabled,
189 const QSize& widgetSize,
190 QRect& verticalRect,
191 QRect& horizontalRect) const;
192
193 //=========================================================================================================
201 void dragSplitter(const QPoint& pos,
202 SplitterHit activeSplitter,
203 const QSize& widgetSize);
204
205private:
206 static float clampSplit(float v)
207 {
208 return std::clamp(v, 0.15f, 0.85f);
209 }
210
211 float m_splitX = 0.5f;
212 float m_splitY = 0.5f;
213 int m_hitTolerancePx = 6;
214 int m_minPanePx = 80;
215 int m_separatorLinePx = 2;
216};
217
218} // namespace DISP3DLIB
219
220#endif // MULTIVIEWLAYOUT_H
Library export/import macros and namespace marker for the disp3D library.
#define DISP3DSHARED_EXPORT
3-D brain visualisation using the Qt RHI rendering backend.