The QToolBar class, part of the Qt framework, provides a movable panel that acts as a container for a set of controls.
Questions tagged [qtoolbar]
108 questions
25
votes
4 answers
Is there a way to define a QToolbar with buttons and popup menus using Qt Designer?
I am wanting to have a toolbar in Qt that contains either QActions or QToolbarButtons that have popup menus attached to them. I have been able to do this perfectly in the code by creating a QMenu, adding it to a QToolbarButton and then adding that…

Eddie Loeffen
- 251
- 1
- 3
- 4
25
votes
6 answers
Is there a way to prevent the hide operation of a toolbar?
In Qt, if I right-click on a toolbar the menu will be shown that allows me to hide the toolbar. I need to disable this functionality because I don't want the toolbar to possible to hide. Is there a way to do this?

Sergey Skoblikov
- 5,811
- 6
- 40
- 49
9
votes
1 answer
Best way to make a QToolBar of "checkable" QToolButtons where only one of the buttons can be checked at a time?
I'm looking to make a QToolBar with a few actions in it, each of which is "checkable" (that is, I call setCheckable(true) on each action after creating it, which leaves the button in the down state after clicking it).
The only way I can think of…

Dan O
- 4,323
- 5
- 29
- 44
8
votes
4 answers
QToolBar background color only applies to actions
I am trying to set the bacground color of a QToolBar in Qt designer with the following in stylesheet background : rgb(30, 30, 30). For some reason the background color is only applied to the action's background as can be seen in the image. How can I…

user2563661
- 314
- 1
- 3
- 13
8
votes
3 answers
Label in a QToolbar
How would you suggest to add a label on a QToolbar ? Since it only accepts action or somethings like that.
Thx

Matthieu Riegler
- 31,918
- 20
- 95
- 134
6
votes
2 answers
Problem in restoring floating toolbar for QMainWindow
I am seeing a problem while restoring QMainWindow state having QCombobox in floating toolbar. After restoring floating toolbar, my QCombobox is not able to get focus until i click on toolbar handle and move it.
Following is gif showing problem,…

SaurabhS
- 633
- 1
- 7
- 18
6
votes
3 answers
How to create QToolBar in QWidget?
I am trying to add a QToolBar in a QWidget. But I want its functionality to work as if it was a QMainWindow.
Apparently I can not create QToolBar in a QWidget, and using setAllowedAreas does not work with QWidget : it only works with QMainWindow.…

njporwal
- 111
- 2
- 4
- 9
6
votes
1 answer
How to control QAction buttons spacing in QToolBar?
With four QAction buttons added to QToolBar what widgets properties need to be set and to what value to make no spacing between the buttons. So each button is placed side by side?
As it can be seen from the example posted below I've tried to…

alphanumeric
- 17,967
- 64
- 244
- 392
5
votes
1 answer
PyQt: Can I make a toolbar button with an icon and text?
I am learning PyQt by playing with examples. In this case, I'm playing with the webbrowser example that is located at \Python26\Lib\site-packages\PyQt4\examples\activeqt\webbrowser .
The demo does something really odd if you add one line to set the…

Warren P
- 65,725
- 40
- 181
- 316
5
votes
1 answer
Qt QToolBar get button added by addAction
In Qt when we use the function addAction of a QToolBar:
_LastBar->addAction(QtExtensions::Action(name, icon, func));
How could we retrieve the QToolButton generated for that action?
Or, if this is not possible, how to find the last button/widget of…

Sturm
- 3,968
- 10
- 48
- 78
5
votes
1 answer
Switching between one QToolButton to another in QT
I want to switch from one QToolButton to another in QToolBar. I have used QStackedWidget, their it is too simple to move from one widget to other but here I am not able to get how to move via using keyReleaseEvent.
mywindow::mywindow() :…

Suresh
- 745
- 4
- 11
- 25
5
votes
2 answers
Vertical QToolBar from MainWindow
What I want: http://puu.sh/3oUjh.jpg
What I have: http://puu.sh/3oUnI.png
The toolbar is made in mainwindow.ui, ive tried ui->_toolbar->setLayoutDirection(Qt::LeftToolBarArea);
But I get this error: no matching function for call to…

throwaway2013
- 440
- 8
- 19
4
votes
1 answer
How to change default position of toolbar?
I'm using PyQt5, QMainWindow and I want to change default position of toolbar to the right. How can I do it?
User can carry toolbar to the edges of the window using mouse, but how can I do it using program?
def initUI(self):
self.toolbar =…

Gunter-R
- 85
- 1
- 5
4
votes
1 answer
How to resize or scale a QIcon?
I'm attempting to scale up a QIcon, but its not working.
class Example(QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
exitIcon = QPixmap('./icons/outline-exit_to_app-24px.svg')
…

Enrico Tuvera Jr
- 2,739
- 6
- 35
- 51
3
votes
3 answers
Why cant a QToolButton be hidden after it is added to a QToolBar?
This works...
QToolButton * toolbutton = new QToolButton(this);
//hide before addWidget
toolbutton->hide();
addWidget(toolbutton);
But this doesn't
QToolButton * toolbutton = new QToolButton(this)
addWidget(toolbutton);
//hide after…

Geore Shg
- 1,299
- 5
- 23
- 38