Answer the question
In order to leave comments, you need to log in
How to add a QAction to the very end of the toolbar (PyQt5)?
I created a toolbar where I add objects of the QAction class. However, the addition occurs at the very beginning, that is, to the left side. And I would like the last object, on the contrary, to be pressed to the right side.
self.file_action = QAction(QIcon('files.png'),
'Change files (Ctrl + F)')
self.file_action.setShortcut('Ctrl+F')
self.settings_action = QAction(QIcon('settings.png'),
'Settings menu (Ctrl + S)')
self.settings_action.setShortcut('Ctrl + S')
self.volume_action = QAction(QIcon('volume.png'),
'Open settings window (Ctrl + V)')
self.volume_action.setShortcut('Ctrl + V')
self.file_action.triggered.connect(self.ask_file_names)
self.toolbar = self.root_window.addToolBar('Show menu')
self.toolbar.setStyleSheet('background-color: %s'
% self.gray_blue)
self.toolbar.setMovable(False)
self.toolbar.addAction(self.file_action)
self.toolbar.addAction(self.settings_action)
self.toolbar.addActions([self.volume_action])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question