Skip to content
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

Document setStyleSheet for script Dialog widgets #3605

Merged
merged 4 commits into from
Mar 9, 2023

Conversation

dogboydog
Copy link
Contributor

I didn't realize that this method existed but it seems you can do a lot with this

Example:

 var style = `
    background-color : #0f1314;
    color : #a9a0f5;
    `;
    dialog.setStyleSheet(style);

Can produce:
image

I found this because a user was asking if the foreground and background colors could be changed for dialogs.
I added links to the documentation but I am not sure if there are limitations of what stylesheet features can be used versus what is documented in the Qt doc.

@dogboydog dogboydog force-pushed the doc_dialog_widgets_setStyleSheet branch from 25bdc0f to ce9b89d Compare March 8, 2023 00:44
@eishiya
Copy link
Contributor

eishiya commented Mar 8, 2023

Rather than "adjust the stylesheet", I think better wording would be "set the stylesheet", since the entire stylesheet is replaced.

* Set the style sheet for the entire dialog.
* @param styleSheet The text of your style sheet. See https://doc.qt.io/qt-6/stylesheet.html and https://doc.qt.io/qt-6/stylesheet-examples.html for more information
*/
setStyleSheet(styleSheet: string) : void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than documenting setStyleSheet here, I think we could derive Dialog from Qt.QWidget. The minimumWidth and minimumHeight properties could be moved there as well, since they're QWidget properties after all and should work on all widgets you can add to the dialog as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, btw, I think this should just be documented as a styleSheet : string property.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done thanks

@bjorn
Copy link
Member

bjorn commented Mar 8, 2023

I added links to the documentation but I am not sure if there are limitations of what stylesheet features can be used versus what is documented in the Qt doc.

Most of that stuff should be supported. However, I'm in the process of implementing a custom style for Tiled (#3597), and unfortunately the QStyle documentation notes:

Warning: Qt style sheets are currently not supported for custom QStyle subclasses. We plan to address this in some future release.

(and I think this warning has been there for many years, since QStyle barely changed since Qt 4)

@bjorn bjorn merged commit b9e9e3f into mapeditor:master Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants