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
qsplitter_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 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 QSPLITTER_P_H
6#define QSPLITTER_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 <QtWidgets/private/qtwidgetsglobal_p.h>
20#include "private/qframe_p.h"
21
22#include <QtCore/qpointer.h>
23
25
26QT_BEGIN_NAMESPACE
27
28static const uint Default = 2;
29
31{
32public:
34 int sizer;
39
40 QSplitterLayoutStruct() : sizer(-1), collapsed(false), collapsible(Default), widget(nullptr), handle(nullptr) {}
41 ~QSplitterLayoutStruct() { delete handle; }
42 int getWidgetSize(Qt::Orientation orient);
43 int getHandleSize(Qt::Orientation orient);
44 int pick(const QSize &size, Qt::Orientation orient)
45 { return (orient == Qt::Horizontal) ? size.width() : size.height(); }
46};
47
49{
50 Q_DECLARE_PUBLIC(QSplitter)
51public:
53#if QT_CONFIG(rubberband)
54 rubberBand(nullptr),
55#endif
56 opaque(true), firstShow(true),
57 childrenCollapsible(true), compatMode(false), handleWidth(-1), blockChildAdd(false), opaqueResizeSet(false) {}
59
60#if QT_CONFIG(rubberband)
62#endif
65 bool opaque : 8;
66 bool firstShow : 8;
68 bool compatMode : 8;
72
73 inline int pick(const QPoint &pos) const
74 { return orient == Qt::Horizontal ? pos.x() : pos.y(); }
75 inline int pick(const QSize &s) const
76 { return orient == Qt::Horizontal ? s.width() : s.height(); }
77
78 inline int trans(const QPoint &pos) const
79 { return orient == Qt::Vertical ? pos.x() : pos.y(); }
80 inline int trans(const QSize &s) const
81 { return orient == Qt::Vertical ? s.width() : s.height(); }
82
83 void init();
84 void recalc(bool update = false);
85 void doResize();
86 void storeSizes();
87 void getRange(int index, int *, int *, int *, int *) const;
88 void addContribution(int, int *, int *, bool) const;
89 int adjustPos(int, int, int *, int *, int *, int *) const;
91 bool collapsible(int index) const
92 { return (index < 0 || index >= list.size()) ? true : collapsible(list.at(index)); }
93 QSplitterLayoutStruct *findWidget(QWidget *) const;
94 void insertWidget_helper(int index, QWidget *widget, bool show);
95 QSplitterLayoutStruct *insertWidget(int index, QWidget *);
96 void doMove(bool backwards, int pos, int index, int delta,
97 bool mayCollapse, int *positions, int *widths);
98 void setGeo(QSplitterLayoutStruct *s, int pos, int size, bool allowCollapse);
99 int findWidgetJustBeforeOrJustAfter(int index, int delta, int &collapsibleSize) const;
100 void updateHandles();
101 void setSizes_helper(const QList<int> &sizes, bool clampNegativeSize = false);
102 bool shouldShowWidget(const QWidget *w) const;
103
104};
105
107{
108 Q_DECLARE_PUBLIC(QSplitterHandle)
109public:
110 QSplitterHandlePrivate() : s(nullptr), orient(Qt::Horizontal), mouseOffset(0), opaq(false), hover(false), pressed(false) {}
111
112 inline int pick(const QPoint &pos) const
113 { return orient == Qt::Horizontal ? pos.x() : pos.y(); }
114
118 bool opaq : 1;
119 bool hover : 1;
120 bool pressed : 1;
121};
122
123QT_END_NAMESPACE
124
125#endif
Qt::Orientation orient
int getWidgetSize(Qt::Orientation orient)
int getHandleSize(Qt::Orientation orient)
int pick(const QSize &size, Qt::Orientation orient)
Definition qsplitter_p.h:44
QSplitterHandle * handle
Definition qsplitter_p.h:38
Qt::Orientation orient
Definition qsplitter_p.h:64
int trans(const QPoint &pos) const
Definition qsplitter_p.h:78
int pick(const QPoint &pos) const
Definition qsplitter_p.h:73
void getRange(int index, int *, int *, int *, int *) const
void recalc(bool update=false)
void doMove(bool backwards, int pos, int index, int delta, bool mayCollapse, int *positions, int *widths)
QSplitterLayoutStruct * findWidget(QWidget *) const
bool collapsible(int index) const
Definition qsplitter_p.h:91
bool collapsible(QSplitterLayoutStruct *) const
bool shouldShowWidget(const QWidget *w) const
void addContribution(int, int *, int *, bool) const
QSplitterLayoutStruct * insertWidget(int index, QWidget *)
int adjustPos(int, int, int *, int *, int *, int *) const
QList< QSplitterLayoutStruct * > list
Definition qsplitter_p.h:63
void setSizes_helper(const QList< int > &sizes, bool clampNegativeSize=false)
void insertWidget_helper(int index, QWidget *widget, bool show)
void setGeo(QSplitterLayoutStruct *s, int pos, int size, bool allowCollapse)
int findWidgetJustBeforeOrJustAfter(int index, int delta, int &collapsibleSize) const
QT_REQUIRE_CONFIG(splitter)