QDockWidget Draggable Tabs

前端 未结 7 1807
执念已碎
执念已碎 2020-12-31 00:59

I am using QDockWidgets and placing two of them on the left side of my application so that tabs can be used to select between them. However, Qt\'s default behavior for this

7条回答
  •  抹茶落季
    2020-12-31 01:32

    If you are adding QTabWidgets to a main window derived from QMainWindow, you can try tabifyDockWidget. It tabifies two QDockWidgets just like you wanted and of course you are able to drag them.

    dockWidget1 = new QDockWidget("Tab1") ;
    dockWidget2 = new QDockWidget("Tab2") ;
    this->addDockWidget(Qt::LeftDockWidgetArea ,  dockWidget1 );
    this->addDockWidget(Qt::LeftDockWidgetArea ,  dockWidget2 );
    this->tabifyDockWidget(dockWidget1,dockWidget2);
    

提交回复
热议问题