def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = BodePlot(self) self.plot.setContentsMargins(5, 5, 5, 0) self.setContextMenuPolicy(Qt.NoContextMenu) self.setCentralWidget(self.plot) toolBar = QToolBar(self) self.addToolBar(toolBar) btnPrint = QToolButton(toolBar) btnPrint.setText("Print") btnPrint.setIcon(QIcon(QPixmap(print_xpm))) btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnPrint) btnPrint.clicked.connect(self.print_) btnExport = QToolButton(toolBar) btnExport.setText("Export") btnExport.setIcon(QIcon(QPixmap(print_xpm))) btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnExport) btnExport.clicked.connect(self.exportDocument) btnSet = QToolButton(toolBar) btnSet.setText("Set") btnSet.setIcon(QIcon(QPixmap(print_xpm))) btnSet.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnSet) btnSet.clicked.connect(self.exportDocument) toolBar.addSeparator() dampBox = QWidget(toolBar) dampLayout = QHBoxLayout(dampBox) dampLayout.setSpacing(0) dampLayout.addWidget(QWidget(dampBox), 10) # spacer dampLayout.addWidget(QLabel("Damping Factor", dampBox), 0) dampLayout.addSpacing(10) toolBar.addWidget(dampBox) self.statusBar() self.showInfo()
def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = BodePlot(self) self.plot.setContentsMargins(5, 5, 5, 0) self.setContextMenuPolicy(Qt.NoContextMenu) self.setCentralWidget(self.plot) toolBar = QToolBar(self) self.addToolBar(toolBar) btnPrint = QToolButton(toolBar) btnPrint.setText("Print") btnPrint.setIcon(QIcon(QPixmap(print_xpm))) btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnPrint) btnPrint.clicked.connect(self.print_) btnExport = QToolButton(toolBar) btnExport.setText("Export") btnExport.setIcon(QIcon(QPixmap(print_xpm))) btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnExport) btnExport.clicked.connect(self.exportDocument) toolBar.addSeparator() dampBox = QWidget(toolBar) dampLayout = QHBoxLayout(dampBox) dampLayout.setSpacing(0) dampLayout.addWidget(QWidget(dampBox), 10) # spacer dampLayout.addWidget(QLabel("Damping Factor", dampBox), 0) dampLayout.addSpacing(10) toolBar.addWidget(dampBox) self.statusBar() self.showInfo()
def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = DataPlot(self) self.plot.setContentsMargins(5, 5, 5, 0) self.setCentralWidget(self.plot) # signal slot connect self.plot.signal_showinfo.connect(self.showInfo) font = QFont() font.setFamily("Calibri") #,Consolas font.setPointSize(16) font2 = QFont() font2.setFamily("Calibri") font2.setPointSize(12) self.plot.setFont(font2) # add toolbar toolBar = QToolBar(self) toolBar.setOrientation(Qt.Vertical) self.addToolBar(toolBar) # label COM lbl_COM = QLabel("COM:", toolBar) lbl_COM.setFont(font2) lbl_COM.setStyleSheet("") toolBar.addWidget(lbl_COM) #lineEdit_COM self.lineEdit_COM = QLineEdit(str(config.Port)) self.lineEdit_COM.setFont(font2) #self.lineEdit_COM.setMinimumWidth(100) toolBar.addWidget(self.lineEdit_COM) # label baudrate lbl_baud = QLabel("BAUD Rate:", toolBar) lbl_baud.setFont(font2) lbl_baud.setStyleSheet("") toolBar.addWidget(lbl_baud) #lineEdit_baud self.lineEdit_baud = QLineEdit(str(config.BaudRate)) #self.lineEdit_baud.setMinimumWidth(100) self.lineEdit_baud.setFont(font2) toolBar.addWidget(self.lineEdit_baud) # Connect device, QIcon(const QString &filename); // 从图像文件构造图标 btnConnect = QToolButton(toolBar) btnConnect.setText("Connect") btnConnect.setFont(font2) btnConnect.setIcon(QIcon('./icon/Connect.png')) btnConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnConnect) btnConnect.clicked.connect(self.GetComSettings_Connect) # disConnect device btnDisConnect = QToolButton(toolBar) btnDisConnect.setText("DisConnect") btnDisConnect.setFont(font2) btnDisConnect.setIcon(QIcon('./icon/Disconnect.jfif')) btnDisConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnDisConnect) btnDisConnect.clicked.connect(self.plot.DisConnect) toolBar.addSeparator() # Start timer btnStartTimer = QToolButton(toolBar) btnStartTimer.setText("Start Timer") btnStartTimer.setFont(font2) btnStartTimer.setIcon(QIcon('./icon/start.jfif')) btnStartTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStartTimer) btnStartTimer.clicked.connect(self.plot.StartTimer) # Stop timer btnStopTimer = QToolButton(toolBar) btnStopTimer.setText("Stop Timer") btnStopTimer.setFont(font2) btnStopTimer.setIcon(QIcon('./icon/stop.jfif')) btnStopTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStopTimer) btnStopTimer.clicked.connect(self.plot.StopTimer) toolBar.addSeparator() #X_LOWER lbl_x_lower = QLabel("X-Lower:", toolBar) lbl_x_lower.setFont(font2) toolBar.addWidget(lbl_x_lower) self.LineEdit_x_lower = QLineEdit(str(config.X_lower), toolBar) self.LineEdit_x_lower.setFont(font2) toolBar.addWidget(self.LineEdit_x_lower) #X_Upper lbl_x_upper = QLabel("X-Upper:", toolBar) lbl_x_upper.setFont(font2) toolBar.addWidget(lbl_x_upper) self.LineEdit_x_upper = QLineEdit(str(config.X_upper), toolBar) self.LineEdit_x_upper.setFont(font2) toolBar.addWidget(self.LineEdit_x_upper) #X_interval lbl_x_inteval = QLabel("X-Interval(s):", toolBar) lbl_x_inteval.setFont(font2) toolBar.addWidget(lbl_x_inteval) self.LineEdit_x_interval = QLineEdit(str(config.X_grid_interval), toolBar) self.LineEdit_x_interval.setFont(font2) toolBar.addWidget(self.LineEdit_x_interval) # Y_Lower lbl_y_lower = QLabel("Y-Lower:", toolBar) lbl_y_lower.setFont(font2) toolBar.addWidget(lbl_y_lower) self.LineEdit_y_Lower = QLineEdit(str(config.Y_lower), toolBar) self.LineEdit_y_Lower.setFont(font2) toolBar.addWidget(self.LineEdit_y_Lower) # Y_Upper lbl_y_uppwer = QLabel("Y-Upper:", toolBar) lbl_y_uppwer.setFont(font2) toolBar.addWidget(lbl_y_uppwer) self.LineEdit_Y_Upper = QLineEdit(str(config.Y_upper), toolBar) self.LineEdit_Y_Upper.setFont(font2) toolBar.addWidget(self.LineEdit_Y_Upper) # Y-Interval lbl_Y_Interval = QLabel("Y-Interval:", toolBar) lbl_Y_Interval.setFont(font2) toolBar.addWidget(lbl_Y_Interval) self.LineEdit_y_interval = QLineEdit(str(config.Y_grid_interval), toolBar) self.LineEdit_y_interval.setFont(font2) toolBar.addWidget(self.LineEdit_y_interval) # Set axis para btnSet = QToolButton(toolBar) btnSet.setText("Set Paras") btnSet.setFont(font2) btnSet.setIcon(QIcon('./icon/Settings.jfif')) btnSet.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnSet) btnSet.clicked.connect(self.SetParas) toolBar.addSeparator() # add print btn to toolbar btnPrint = QToolButton(toolBar) btnPrint.setText("Print") btnPrint.setFont(font2) btnPrint.setIcon(QIcon('./icon/print.jfif')) btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnPrint) btnPrint.clicked.connect(self.print_) # add Export btn to toolbar btnExport = QToolButton(toolBar) btnExport.setText("Export") btnExport.setFont(font2) btnExport.setIcon(QIcon('./icon/snapshot.jfif')) btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnExport) btnExport.clicked.connect(self.exportDocument) toolBar.addSeparator() # add About btn to toolbar btnAbout = QToolButton(toolBar) btnAbout.setText("About") btnAbout.setFont(font2) btnAbout.setIcon(QIcon('./icon/about.png')) btnAbout.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnAbout) btnAbout.clicked.connect(self.About) #self.statusBar().setStyleSheet("QStatusBar::item{border: 5px}") self.statusBar().setStyleSheet("color:green") #self.statusBar().addPermanentWidget(VLine()) self.statusBar().addPermanentWidget(QLabel("X = ")) #self.statusBar().addPermanentWidget(VLine()) self.statusBar().addPermanentWidget(QLabel("Y = ")) #self.statusBar().addPermanentWidget(VLine()) PermanentLabel = QLabel("Version:" + kProgVersion + " Developed by " + kProgramDeveloperName + " Python. Running with " + kPythonVersion) font3 = QFont() font3.setFamily("Calibri") font3.setPointSize(12) PermanentLabel.setFont(font3) self.statusBar().setFont(font3) self.statusBar().addPermanentWidget(PermanentLabel) self.showInfo("Show info here ......")
def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = DataPlot(self) self.plot.setContentsMargins(5, 5, 5, 0) self.setCentralWidget(self.plot) print(type(self.plot.signal_showinfo)) # signal slot connect self.plot.signal_showinfo.connect(self.showInfo) font = QFont() font.setFamily("Calibri") #,Consolas font.setPointSize(16) font2 = QFont() font2.setFamily("Calibri") font2.setPointSize(14) self.plot.setFont(font2) # add toolbar toolBar = QToolBar(self) self.addToolBar(toolBar) # label COM lbl_COM = QLabel("COM:", toolBar) lbl_COM.setFont(font) lbl_COM.setStyleSheet("") toolBar.addWidget(lbl_COM) #lineEdit_COM self.lineEdit_COM = QLineEdit(str(config.Port)) self.lineEdit_COM.setFont(font2) self.lineEdit_COM.setMinimumWidth(50) toolBar.addWidget(self.lineEdit_COM) # label baudrate lbl_baud = QLabel("BAUD Rate:", toolBar) lbl_baud.setFont(font) lbl_baud.setStyleSheet("") toolBar.addWidget(lbl_baud) #lineEdit_baud self.lineEdit_baud = QLineEdit(str(config.BaudRate)) self.lineEdit_baud.setMinimumWidth(100) self.lineEdit_baud.setFont(font2) toolBar.addWidget(self.lineEdit_baud) # Connect device, QIcon(const QString &filename); // 从图像文件构造图标 btnConnect = QToolButton(toolBar) btnConnect.setText("Connect") btnConnect.setFont(font2) btnConnect.setIcon(QIcon('./icon/Connect.png')) btnConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnConnect) btnConnect.clicked.connect(self.GetComSettings_Connect) # disConnect device btnDisConnect = QToolButton(toolBar) btnDisConnect.setText("DisConnect") btnDisConnect.setFont(font2) btnDisConnect.setIcon(QIcon('./icon/Disconnect.jfif')) btnDisConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnDisConnect) btnDisConnect.clicked.connect(self.plot.DisConnect) toolBar.addSeparator() # Start timer btnStartTimer = QToolButton(toolBar) btnStartTimer.setText("Start Timer") btnStartTimer.setFont(font2) btnStartTimer.setIcon(QIcon('./icon/start.jfif')) btnStartTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStartTimer) btnStartTimer.clicked.connect(self.plot.StartTimer) # Stop timer btnStopTimer = QToolButton(toolBar) btnStopTimer.setText("Stop Timer") btnStopTimer.setFont(font2) btnStopTimer.setIcon(QIcon('./icon/stop.jfif')) btnStopTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStopTimer) btnStopTimer.clicked.connect(self.plot.StopTimer) toolBar.addSeparator() #X_LOWER lbl_x_lower = QLabel("X-Lower:", toolBar) lbl_x_lower.setFont(font) toolBar.addWidget(lbl_x_lower) self.LineEdit_x_lower = QLineEdit(str(0), toolBar) self.LineEdit_x_lower.setFont(font2) toolBar.addWidget(self.LineEdit_x_lower) #X_Upper lbl_x_upper = QLabel("X-Upper:", toolBar) lbl_x_upper.setFont(font) toolBar.addWidget(lbl_x_upper) self.LineEdit_x_upper = QLineEdit(str(config.X_upper), toolBar) self.LineEdit_x_upper.setFont(font2) toolBar.addWidget(self.LineEdit_x_upper) #X_interval lbl_x_inteval = QLabel("X-Interval(s):", toolBar) lbl_x_inteval.setFont(font) toolBar.addWidget(lbl_x_inteval) self.LineEdit_x_interval = QLineEdit(str(config.X_grid_interval), toolBar) self.LineEdit_x_interval.setFont(font2) toolBar.addWidget(self.LineEdit_x_interval) # Y_Lower lbl_y_lower = QLabel("Y-Lower:", toolBar) lbl_y_lower.setFont(font) toolBar.addWidget(lbl_y_lower) self.LineEdit_y_Lower = QLineEdit(str(config.Y_lower), toolBar) self.LineEdit_y_Lower.setFont(font2) toolBar.addWidget(self.LineEdit_y_Lower) # Y_Upper lbl_y_uppwer = QLabel("Y-Upper:", toolBar) lbl_y_uppwer.setFont(font) toolBar.addWidget(lbl_y_uppwer) self.LineEdit_Y_Upper = QLineEdit(str(config.Y_upper), toolBar) self.LineEdit_Y_Upper.setFont(font2) toolBar.addWidget(self.LineEdit_Y_Upper) # Y-Interval lbl_Y_Interval = QLabel("Y-Interval:", toolBar) lbl_Y_Interval.setFont(font) toolBar.addWidget(lbl_Y_Interval) self.LineEdit_y_interval = QLineEdit(str(config.Y_grid_interval), toolBar) self.LineEdit_y_interval.setFont(font2) toolBar.addWidget(self.LineEdit_y_interval) # Set axis para btnSet = QToolButton(toolBar) btnSet.setText("Set Paras") btnSet.setFont(font2) btnSet.setIcon(QIcon('./icon/Settings.jfif')) btnSet.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnSet) btnSet.clicked.connect(self.SetParas) toolBar.addSeparator() # add print btn to toolbar btnPrint = QToolButton(toolBar) btnPrint.setText("Print") btnPrint.setFont(font2) btnPrint.setIcon(QIcon('./icon/print.jfif')) btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnPrint) btnPrint.clicked.connect(self.print_) # add Export btn to toolbar btnExport = QToolButton(toolBar) btnExport.setText("Export") btnExport.setFont(font2) btnExport.setIcon(QIcon('./icon/snapshot.jfif')) btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnExport) btnExport.clicked.connect(self.exportDocument) toolBar.addSeparator() self.statusBar() self.showInfo("Show info here ......")
def __init__(self, *args): QMainWindow.__init__(self, *args) self.plot = DataPlot(self) #self.plot.resize(540,760) self.plot.setContentsMargins(5, 5, 5, 0) self.setCentralWidget(self.plot) print(type(self.plot.signal_showinfo)) # signal slot connect self.plot.signal_showinfo.connect(self.showInfo) font = QFont() font.setFamily("Calibri") #,Consolas font.setPointSize(16) font2 = QFont() font2.setFamily("Calibri") font2.setPointSize(14) self.plot.setFont(font2) # add toolbar toolBar = QToolBar(self) self.addToolBar(toolBar) # label COM lbl_COM = QLabel("COM:",toolBar) lbl_COM.setFont(font) lbl_COM.setStyleSheet("") toolBar.addWidget(lbl_COM) #lineEdit_COM self.lineEdit_COM = QLineEdit('COM37') self.lineEdit_COM.setFont(font2) self.lineEdit_COM.setMinimumWidth(50) toolBar.addWidget(self.lineEdit_COM) # label baudrate lbl_baud = QLabel("BAUD Rate:",toolBar) lbl_baud.setFont(font) lbl_baud.setStyleSheet("") toolBar.addWidget(lbl_baud) #lineEdit_baud self.lineEdit_baud = QLineEdit('9600') self.lineEdit_baud.setMinimumWidth(100) self.lineEdit_baud.setFont(font2) toolBar.addWidget(self.lineEdit_baud) # label command lbl_command = QLabel("Command:",toolBar) lbl_command.setFont(font) lbl_command.setStyleSheet("") toolBar.addWidget(lbl_command) #lineEdit_command self.lineEdit_command = QLineEdit(r'UPPER_VAL?\r\n') self.lineEdit_command.setFont(font2) #self.lineEdit_command.resize(200,12) #self.lineEdit_command.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) self.lineEdit_command.setMinimumWidth(300) toolBar.addWidget(self.lineEdit_command) # label response_rex lbl_response_rex = QLabel("response_rex:",toolBar) lbl_response_rex.setFont(font) lbl_response_rex.setStyleSheet("") toolBar.addWidget(lbl_response_rex) #lineEdit_response_rex self.lineEdit_response_rex = QLineEdit(r'^[-]?([0-9]{1,}[.]?[0-9]*)') self.lineEdit_response_rex.setFont(font2) #self.lineEdit_command.resize(200,12) #self.lineEdit_command.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) self.lineEdit_response_rex.setMinimumWidth(300) toolBar.addWidget(self.lineEdit_response_rex) # Connect device, QIcon(const QString &filename); // 从图像文件构造图标 btnConnect = QToolButton(toolBar) btnConnect.setText("Connect") btnConnect.setFont(font2) btnConnect.setIcon(QIcon('./icon/Connect.png')) btnConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnConnect) btnConnect.clicked.connect(self.GetComSettings_Connect) # disConnect device btnDisConnect = QToolButton(toolBar) btnDisConnect.setText("DisConnect") btnDisConnect.setFont(font2) btnDisConnect.setIcon(QIcon('./icon/Disconnect.jfif')) btnDisConnect.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnDisConnect) btnDisConnect.clicked.connect(self.plot.DisConnect) toolBar.addSeparator() # Label sample interval lbl_timer_interval = QLabel("Timer(ms):",toolBar) lbl_timer_interval.setFont(font) lbl_timer_interval.setStyleSheet("") toolBar.addWidget(lbl_timer_interval) # lineEdit sample interval self.lineEdit_timer_interval = QLineEdit('250') self.lineEdit_timer_interval.setFont(font2) self.lineEdit_timer_interval.setStyleSheet("") toolBar.addWidget(self.lineEdit_timer_interval) # Start timer btnStartTimer = QToolButton(toolBar) btnStartTimer.setText("Start Timer") btnStartTimer.setFont(font2) btnStartTimer.setIcon(QIcon('./icon/start.jfif')) btnStartTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStartTimer) btnStartTimer.clicked.connect(self.plot.StartTimer) # Stop timer btnStopTimer = QToolButton(toolBar) btnStopTimer.setText("Stop Timer") btnStopTimer.setFont(font2) btnStopTimer.setIcon(QIcon('./icon/stop.jfif')) btnStopTimer.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnStopTimer) btnStopTimer.clicked.connect(self.plot.StopTimer) toolBar.addSeparator() # dampBox = QWidget(toolBar) # dampLayout = QHBoxLayout(dampBox) # dampLayout.setSpacing(0) # dampLayout.addWidget(QWidget(dampBox), 0) # spacer #X_interval lbl_x_inteval = QLabel("X-Interval(s):", toolBar) lbl_x_inteval.setFont(font) #dampLayout.addWidget(lbl_x_inteval, 0) toolBar.addWidget(lbl_x_inteval) self.LineEdit_x_interval= QLineEdit('30',toolBar) self.LineEdit_x_interval.setFont(font2) #dampLayout.addWidget(self.LineEdit_x_interval,0) #dampLayout.addSpacing(10) toolBar.addWidget(self.LineEdit_x_interval) # Y_Lower lbl_y_lower = QLabel("Y-Lower:", toolBar) lbl_y_lower.setFont(font) #dampLayout.addWidget(lbl_y_lower, 0) toolBar.addWidget(lbl_y_lower) self.LineEdit_y_Lower = QLineEdit('-90', toolBar) self.LineEdit_y_Lower.setFont(font2) #dampLayout.addWidget(self.LineEdit_y_Lower, 0) #dampLayout.addSpacing(10) toolBar.addWidget(self.LineEdit_y_Lower) # Y_Upper lbl_y_uppwer = QLabel("Y-Upper:", toolBar) lbl_y_uppwer.setFont(font) #dampLayout.addWidget(lbl_y_uppwer, 0) toolBar.addWidget(lbl_y_uppwer) self.LineEdit_Y_Upper = QLineEdit('210', toolBar) self.LineEdit_Y_Upper.setFont(font2) #dampLayout.addWidget(self.LineEdit_Y_Upper, 0) #dampLayout.addSpacing(10) toolBar.addWidget(self.LineEdit_Y_Upper) # Y-Interval lbl_Y_Interval = QLabel("Y-Interval:", toolBar) lbl_Y_Interval.setFont(font) #dampLayout.addWidget(lbl_Y_Interval, 0) toolBar.addWidget(lbl_Y_Interval) self.LineEdit_y_interval= QLineEdit('50', toolBar) self.LineEdit_y_interval.setFont(font2) #dampLayout.addWidget(self.LineEdit_y_interval, 0) #dampLayout.addSpacing(10) toolBar.addWidget(self.LineEdit_y_interval) #toolBar.addWidget(dampBox) # Set axis para btnSet = QToolButton(toolBar) btnSet.setText("Set Paras") btnSet.setFont(font2) btnSet.setIcon(QIcon('./icon/Settings.jfif')) btnSet.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnSet) btnSet.clicked.connect(self.SetParas) toolBar.addSeparator() # add print btn to toolbar btnPrint = QToolButton(toolBar) btnPrint.setText("Print") btnPrint.setFont(font2) btnPrint.setIcon(QIcon('./icon/print.jfif')) btnPrint.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnPrint) btnPrint.clicked.connect(self.print_) # add Export btn to toolbar btnExport = QToolButton(toolBar) btnExport.setText("Export") btnExport.setFont(font2) btnExport.setIcon(QIcon('./icon/snapshot.jfif')) btnExport.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) toolBar.addWidget(btnExport) btnExport.clicked.connect(self.exportDocument) toolBar.addSeparator() self.statusBar() self.showInfo("Show info here ......")