C++ (Qt)QSplitter s;QPushButton *b1 = new QPushButton("b1", &s), *b2 = new QPushButton("b2", &s);s.show();
C++ (Qt)#include <QtGui>#include <QtCore> #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)#include <QtWidgets/QtWidgets>#endif class SplitterHandle : public QSplitterHandle{public: SplitterHandle(Qt::Orientation orientation, QSplitter *parent) : QSplitterHandle(orientation, parent) { QPushButton *right = new QPushButton(QChar(0x2192), this); right->setCursor(Qt::ArrowCursor); QPushButton *left = new QPushButton(QChar(0x2190), this); left->setCursor(Qt::ArrowCursor); w = new QWidget(this); QVBoxLayout *layout = new QVBoxLayout(w); layout->addStretch(); layout->addWidget(right); layout->addWidget(left); layout->addStretch(); } QSize sizeHint() const { return QSize(w->width(), QSplitterHandle::sizeHint().height()); } protected: void showEvent(QShowEvent *e) { w->resize(size()); } private: QWidget *w;}; class Splitter : public QSplitter{public: Splitter(Qt::Orientation orientation, QWidget *parent = 0) : QSplitter(orientation, parent) {} protected: QSplitterHandle *createHandle() { return new SplitterHandle(orientation(), this); }}; int main(int argc, char *argv[]){ QApplication app(argc, argv); Splitter splitter(Qt::Horizontal); QTextEdit *t1 = new QTextEdit(&splitter), *t2 = new QTextEdit(&splitter); splitter.show(); return app.exec();}