How to create a toolbar like in Qt Creator?
-
In Windows, when we use Dark mode, Qt Creator creates a toolbar that looks like this:
But if we create a QToolBar ourselves using C++/Qt (dark mode, fusion style), the toolbar looks slightly different:
- How to remove the button that is on the left (I don't know what it's called, but it can be used to drag the toolbar along the edges of the window)
- How to make the toolbar look the same as in Qt Creator? Maybe I should use another widget instead of QToolBar?
-
@Jo-Jo If you don't want the tool bar to be movable then use https://doc.qt.io/qt-6/qtoolbar.html#movable-prop
You can also try https://doc.qt.io/qt-6/qtoolbar.html#floatable-prop -
@Jo-Jo said in How to create a toolbar like in Qt Creator?:
But how to make the toolbar look like in Qt Creator?
By adding widgets you need to the tool bar I guess? Or do you mean the color? In that case it's style sheet.
QtCreator is open source you can check how it is implemented and styled. -
@Jo-Jo said in How to create a toolbar like in Qt Creator?:
Works fine, thank you! But how to make the toolbar look like in Qt Creator?
The tool bar you are showing has a QComboBox (this is just adding any widget to the toolbar which is possible). Next to that are most likely QToolButtons. These can also be changed to have a toggle state or a drop down menu. Tool buttons are especially designed to be used inside tool bars. They have a picture/symbol but usually no text.
-
@SimonSchroeder said in How to create a toolbar like in Qt Creator?:
The tool bar you are showing has a QComboBox (this is just adding any widget to the toolbar which is possible). Next to that are most likely QToolButtons. These can also be changed to have a toggle state or a drop down menu. Tool buttons are especially designed to be used inside tool bars. They have a picture/symbol but usually no text.
Thank you!