一、效果图
二、代码
#ifndef SPLITERWIDGET_H #define SPLITERWIDGET_H #include <QObject> #include <QTextEdit> #include <QWidget> #include <QDebug> #include <QSplitter> #include <QSplitterHandle> #include <QHBoxLayout> #include <QVBoxLayout> class HspliterHandler : public QSplitterHandle { Q_OBJECT public: explicit HspliterHandler(Qt::Orientation o, QSplitter *parent); }; class Hspliter : public QSplitter { Q_OBJECT public: explicit Hspliter(Qt::Orientation o, QWidget* parent = nullptr); protected: virtual HspliterHandler *createHandle(); }; class SpliterWidget : public QWidget { Q_OBJECT public: SpliterWidget(); }; #endif // SPLITERWIDGET_H
1234567891011121314151617181920212223242526272829303132333435363738#include "spliterwidget.h" SpliterWidget::SpliterWidget() { QTextEdit *pLeftEdit = new QTextEdi1234