QWidget切换

 

QWidget切换,参考类:QstackedLayout,QStackedWidget,QTabWidget

 

一、Tab出现的位置
tabWidget.setTabPosition(QTabWidget.South);

enum QTabWidget::TabPosition

This enum type defines where QTabWidget draws the tab row:

	Constant		 Value			Description
QTabWidget::North		0		The tabs are drawn above the pages.
QTabWidget::South		1		The tabs are drawn below the pages.
QTabWidget::West		2		The tabs are drawn to the left of the pages.
QTabWidget::East		3		The tabs are drawn to the right of the pages.


二、Tab的形状
tabWidget.setTabShape(QTabWidget::Triangular)

enum QTabWidget::TabShape

This enum type defines the shape of the tabs:

	Constant				Value				Description
QTabWidget::Rounded		 	  0			The tabs are drawn with a rounded look. This is the default shape.
QTabWidget::Triangular	 	  1			The tabs are drawn with a triangular look.

 

QMainWindow的多个QDockWidget停靠在一起

在QMainWindow中

dock4=QDockWidget(self.tr("停靠窗口4"),self)  
        dock4.setFeatures(QDockWidget.DockWidgetFloatable|QDockWidget.DockWidgetClosable)  
# 可引入外部Qwidget
widget4 = QWidget()  
dock4.setWidget(widget4)  
self.addDockWidget(Qt.RightDockWidgetArea,dock4)  


#多个QDockWidget,每两两停靠在一起可以实现多个QDockWidget的停靠在一起
#两个停靠窗口叠加
self.tabifyDockWidget(dock4, dock5) 
self.tabifyDockWidget(dock2, dock4) 

 

你可能感兴趣的:(widget)