-
Notifications
You must be signed in to change notification settings - Fork 731
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QToolbar background #296
Comments
Hi, QWidget * expander3 = new QWidget(this);
expander3->setObjectName("expander3");
expander3->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
expander3->setStyleSheet("background-color:transparent");
ui->mainToolBar->insertWidget(ui->actionSettings, expander3); |
I ended up doing the same, but I hope this is changed in the theme. |
Found this old post. And the work around worked for me. In my project, I too divided the QToolBar with buttons on the left and a couple on the right, with a spacer between. This spacer inherits the wrong background color. Because it's just a QWidget. The style sheet can't change QWidget as it would change more than just the QToolBar. The only solution I see is if Qt introduced a new object called QToolBarSpacer. StyleSheets can then provide a style for that object that then matches QToolBar. However, I can't see it happening. |
Not necessarily, in fact I recently styled some QToolButtons in my interface that needed a custom background by applying them a specific CSS class like this:
And then appending this to the stylesheet (loaded in the
|
It's not the styling of the QToolButton's themselves. It's the lack of styling on the spacer widget between them. As in @huseyinkozan workaround example.
I don't know how this (or any style) can handle this. I could be wrong, though. Anyway, I'm happy with @huseyinkozan workaround. |
I am working on a Qt\C++ desktop application, and having a bit of a trouble with the dark theme in a QToolbar I am using to display additional controls over another widget. Basically, while the stock theme has a transparent background, here there is a solid one so the result is cumbersome.
This is the default theme:
While this is what happens switching to dark theme:
The toolbar is composed by 4 icons and a spacer on the left side (that is used to right align the icons). Icons are trasparent too, so I think a correct styling is also missing on QAction.
The text was updated successfully, but these errors were encountered: