Please provide a minimal, compilable example of your problem. Check it with a recent Qt6 version and if the issue still exists, create a bug report (or post it here and I'll take a look on it).
@mrjj I'm using aliases, but your code does not specivy hover action ?
Darn sorry, I didnt specify question well :/
I cant change hover action. Not icon itself.
QDockWidget::float-button:hover does not quite work.
Also any idea where I can find other "button types?" Maximize, Minimize, etc etc?
@VRonin I want to do some heavy changes/customisations... stuff I cant do in CSS...
Like moving expand button to opposite of tree, changing location of checkbox, changing indentation of child items.
How can I control indentation of child items? I need it now :/ I keep getting "invisible" hitboxes as my child item is moved to left visually but hitboxes are drawn in original places :///
Ideas?
I just realized there is "setIndentation"... sigh............ Ok that kinda works, how can I set indentation per row? :D
@Dariusz said in How to get this style on a button:
@JKSH AH yes, could do... but I'm trying to css entire app with hundreds of buttons/etc..
I think you could inherit from the QPushButton then:
class MyButton : public QPushButton
{
MyButton( ... ) :
...
{
setMinimumSize( ... );
}
};
@Ketan__Patel__0011 said in QTabWidget style the top buttons...:
@Dariusz said in QTabWidget style the top buttons...:
FUSION
If you want to set "FUSION" Style for your application
add this line in your main function
qApp->setStyle(QStyleFactory::create("Fusion"));
Hey
Yeah that's the style im using. I'm trying to reproduce in css the button style now with black outline, then the white "ping" of border and gradient background.
Are there any more style presets I can download? I know there is also windows/windowvista ones but... more ?
There seem to be a large preset/plugin system build for styles but I dont see any on web available for use... mhmm ?
@JonB said in How to change background-color of widget, but not items:
[Looks like @J-Hilk types faster than I can... :) ]
Sometimes, but I imagine I write with more errors as well :)
I had to replace this :
style = """
{
background-color : rgba(64,64,64,255);
};
With either:
style = """
*{
background-color : rgba(64,64,64,255);
};
Or
style = """
QWidget {
background-color : rgba(64,64,64,255);
};
And then it works :- )
which style parameter do I have to edit to control the color of item when the widget loses focus?
QTreeView::item:active { color: red; } /* When widget has focus*/
QTreeView::item:!active { color: blue; } /* When widget doesn't have focus*/
if I do show-decoration-selected: 1; How do I control decoration color ?
It depends on the platform styling. For example on Windows it only colors on hover the little arrow that expands/collapses the branch and that arrow is painted by a system style call so you can't control its color. You can however replace the system styling and change the branch images to your own with any color you like. See Customizing QTreeView for examples.
@Gojir4 said in Styling the QMdiArea using the the fusion style and QPalette (dark theme):
darkPalette.setColor(QPalette::Disabled, QPalette::Shadow, QColor(r, g, b));
(Edited)
tried, but it didn't work. I suspect that underneath it's a QLabel with a raised text but I don't know how to set the color of those using QPalette
@J.Hilk
ok then you can follow the suggestion from @mrjj (in case you would have set a custom model you would have need to handle the Qt::SizeHintRole in your data() method)
or try to set a QStyledItemDelegate to the view and use your stylesheet.
@Chris-Kawa turns out, you were spot on! I had some difficulties to compile my "fix" in release configuration.
So I went and rewrote the class, with your comment in mind. I intoduced a new signal and changed the overrides accordingly.
void signalEvent(QMouseEvent::Type t, QPoint p);
now, I don't need the timer, it also works in debug as well as in release mode...
virtual void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE{
emit signalEvent(QMouseEvent::MouseButtonPress, e->pos());
QPushButton::mousePressEvent(e);
}
works like a charm. Thanks!