Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/QtWidgets/qsplitter.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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