Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:09:38

0001 // Copyright (C) 2016 The Qt Company Ltd.
0002 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
0003 
0004 #ifndef QSPLITTER_H
0005 #define QSPLITTER_H
0006 
0007 #include <QtWidgets/qtwidgetsglobal.h>
0008 #include <QtWidgets/qframe.h>
0009 #include <QtWidgets/qsizepolicy.h>
0010 
0011 QT_REQUIRE_CONFIG(splitter);
0012 
0013 QT_BEGIN_NAMESPACE
0014 
0015 class QSplitterPrivate;
0016 class QTextStream;
0017 
0018 class QSplitterHandle;
0019 
0020 class Q_WIDGETS_EXPORT QSplitter : public QFrame
0021 {
0022     Q_OBJECT
0023 
0024     Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
0025     Q_PROPERTY(bool opaqueResize READ opaqueResize WRITE setOpaqueResize)
0026     Q_PROPERTY(int handleWidth READ handleWidth WRITE setHandleWidth)
0027     Q_PROPERTY(bool childrenCollapsible READ childrenCollapsible WRITE setChildrenCollapsible)
0028 
0029 public:
0030     explicit QSplitter(QWidget* parent = nullptr);
0031     explicit QSplitter(Qt::Orientation, QWidget* parent = nullptr);
0032     ~QSplitter();
0033 
0034     void addWidget(QWidget *widget);
0035     void insertWidget(int index, QWidget *widget);
0036     QWidget *replaceWidget(int index, QWidget *widget);
0037 
0038     void setOrientation(Qt::Orientation);
0039     Qt::Orientation orientation() const;
0040 
0041     void setChildrenCollapsible(bool);
0042     bool childrenCollapsible() const;
0043 
0044     void setCollapsible(int index, bool);
0045     bool isCollapsible(int index) const;
0046     void setOpaqueResize(bool opaque = true);
0047     bool opaqueResize() const;
0048     void refresh();
0049 
0050     QSize sizeHint() const override;
0051     QSize minimumSizeHint() const override;
0052 
0053     QList<int> sizes() const;
0054     void setSizes(const QList<int> &list);
0055 
0056     QByteArray saveState() const;
0057     bool restoreState(const QByteArray &state);
0058 
0059     int handleWidth() const;
0060     void setHandleWidth(int);
0061 
0062     int indexOf(QWidget *w) const;
0063     QWidget *widget(int index) const;
0064     int count() const;
0065 
0066     void getRange(int index, int *, int *) const;
0067     QSplitterHandle *handle(int index) const;
0068 
0069     void setStretchFactor(int index, int stretch);
0070 
0071 Q_SIGNALS:
0072     void splitterMoved(int pos, int index);
0073 
0074 protected:
0075     virtual QSplitterHandle *createHandle();
0076 
0077     void childEvent(QChildEvent *) override;
0078 
0079     bool event(QEvent *) override;
0080     void resizeEvent(QResizeEvent *) override;
0081 
0082     void changeEvent(QEvent *) override;
0083     void moveSplitter(int pos, int index);
0084     void setRubberBand(int position);
0085     int closestLegalPosition(int, int);
0086 
0087 
0088 private:
0089     Q_DISABLE_COPY(QSplitter)
0090     Q_DECLARE_PRIVATE(QSplitter)
0091 private:
0092     friend class QSplitterHandle;
0093 };
0094 
0095 
0096 class QSplitterHandlePrivate;
0097 class Q_WIDGETS_EXPORT QSplitterHandle : public QWidget
0098 {
0099     Q_OBJECT
0100 public:
0101     explicit QSplitterHandle(Qt::Orientation o, QSplitter *parent);
0102     ~QSplitterHandle();
0103 
0104     void setOrientation(Qt::Orientation o);
0105     Qt::Orientation orientation() const;
0106     bool opaqueResize() const;
0107     QSplitter *splitter() const;
0108 
0109     QSize sizeHint() const override;
0110 
0111 protected:
0112     void paintEvent(QPaintEvent *) override;
0113     void mouseMoveEvent(QMouseEvent *) override;
0114     void mousePressEvent(QMouseEvent *) override;
0115     void mouseReleaseEvent(QMouseEvent *) override;
0116     void resizeEvent(QResizeEvent *) override;
0117     bool event(QEvent *) override;
0118 
0119     void moveSplitter(int p);
0120     int closestLegalPosition(int p);
0121 
0122 private:
0123     Q_DISABLE_COPY(QSplitterHandle)
0124     Q_DECLARE_PRIVATE(QSplitterHandle)
0125 };
0126 
0127 QT_END_NAMESPACE
0128 
0129 #endif // QSPLITTER_H