Search code examples
qtqtstylesheetsqtoolbar

QToolBar: styling 'show more' button


Does anyone have idea on how to style this rectangular button -which is a default child of a QToolbar?

enter image description here enter image description here enter image description here

First two images show the button when the graphical interface is on normal screen mode. It appears; since toolbar icons don't have enough space. Third picture shows fullscreen mode, in which my icons have space.

I want to style its shape, so that it has a radial border, without a corner. This will cancel its ugly look, in second image.

I want to let users use the interface in normal view, so locking application to fullscreen is not an option. I do want to use the button, so removing is not acceptable. Styling its position to 5 pixels left or replacing it with another stylable button could be possible solutions, but I couldn't manage to do them.

I played a lot with toolbutton and pushbutton stylesheets, but had no luck on styling this small button. I am pretty obsessed about my graphical design, but don't want to waste too much time (if solution is not trivial, I will change my toolbar to a rectangular one).

Thanks in advance.


Solution

  • I found the solution by listing the children object names of my toolbar.

    QStringList list;
    for(int i=0; i<toolBar->children()->size(); i++)
    list.append(toolBar->children()[i]->objectName();
    

    Inside the list, there is only one object that has a default name (not " "). It is qt_toolbar_ext_button

    Then I was able to style it as:

    "#qt_toolbar_ext_button { //... }"