qtstylesheets

Should I really use a single qss file for my application instead of having one for each (UI) class?

ぃ、小莉子 提交于 2020-01-06 01:32:16
问题 Some posts (namely, these two: Set CSS in QPushButton's subclass's constructor and Does the use of styleSheets in a dynamic manner add a lot of computation) suggest that I should use a single qss file for my Qt application. However, imagine I have a QLabel subclass whose purpose is (using stylesheets) to provide a particular look/behavior (say BlinkingLabel , however horrendous it would look). In that case, doesn't it make sense to prepare a separate stylesheet and load it in the class

PyQt application: Restore the original look & feel after changing some QSS elements

守給你的承諾、 提交于 2020-01-05 03:35:45
问题 I'm changing the look of some elements in my pyQt application using a QSS style sheet. This has the effect of overriding many other properties of those elements as well (as noted in the documentation and many tutorials). Now, I would like to restore these overridden properties, but I haven't managed to find the "original" style sheets on my system where the default themes are defined. Using the information from these style sheets I could restore the rest of the original look. Could somebody

Qt QSS Tutorials

杀马特。学长 韩版系。学妹 提交于 2020-01-04 04:37:08
问题 Are there any good Qt QSS tutorials or is there some place where I can see examples of styling widgets? I'd like some complete reference if is there available somewhere. I couldn't find anything but small tutorials on how to style a button or some tabs. Thanks! 回答1: Qt Style Sheets Topics: Overview The Style Sheet Syntax Qt Designer Integration Customizing Qt Widgets Using Style Sheets Qt Style Sheets Reference Qt Style Sheets Examples 来源: https://stackoverflow.com/questions/11165177/qt-qss

Is it possible to use Qt Style Sheets with promoted widgets in Qt Creator?

穿精又带淫゛_ 提交于 2020-01-03 11:48:14
问题 I'm trying to do some heavy redeisgning of standard widgets using Qt Style Sheets. So after doing most of it manually for different widgets by #objectName selectors I've decided to group similar widgets in some way. For example, I have multiple QFrames which act like headers in inner forms. And I want all of them to have the same stylesheet. One way of doing that is using naming convention (this is my fallback variant), i.e. QFrame[objectName|="prefix_"] . But I wanted to group my widgets by

How to add an icon to a QTabWidget (not for each tab)?

喜欢而已 提交于 2019-12-25 18:46:10
问题 I would like to add an icon at the top left of the QTabWidget . I don't want to add an icon for each tab. How to do that using a stylesheet or programmatically in C++? 回答1: Stylesheet below will add an image to the left of all tabs, but not to individual tabs. However, it is very likely that you'll need to tweak other attributes in the CSS to polish the final result. QTabWidget > QTabBar { background: url(url-to-your-corner-image); background-repeat: norepeat; margin-top: 10px; /* whatever

Style button background keeping rounded corners

倾然丶 夕夏残阳落幕 提交于 2019-12-25 08:17:27
问题 I want to make a green button. I did this: self.detectButton.setStyleSheet("background: #00ff00") Here it was before the styling: And after: As you can see, the color changed, but the rounded corners were lost. What's the proper way to style the color so the corners are not lost? Secondarily, is there any way to get a theme-generic "ok" button color? This won't look the same on other platforms. 回答1: Do not use stylesheets if you want completely consistent results on all platforms. The reasons

Use “Less” or something similar to generate a Qt Stylesheets

女生的网名这么多〃 提交于 2019-12-25 04:36:20
问题 I'm creating a stylesheet for my Qt application to customize the look and feel. I'd love to take advantage of a CSS generator like LESS or Compass, so I can at least use variables for color and perhaps take advantage of some of the other cool features they offer. My concern is that Qt does not use the W3C standard for stylesheet, they utilize a subset of the syntax with a few extra options. Is this even possible? Are Less and Compass able to generate valid Qt stylesheets? 回答1: Qt's CSS has a

How can I select a href tags in a QTextBrowser from QSS?

纵然是瞬间 提交于 2019-12-25 02:59:54
问题 I would like to format my clickable URLs inside a QTextBrowser. In a QSS file that I set for the entire application, I've tried QTextBrowser::text.a and QTextBrowser.a , but neither worked. Am I actually expected to manually format every link using the Qt Creator editor, or is there a way around this? 回答1: You can’t use QSS for that, but QTextBrowser supports a subset of CSS, so you can make it part of the displayed HTML, or set a default stylesheet: QTextDocument::defaultStyleSheet. 来源:

Enable own widget for stylesheet

霸气de小男生 提交于 2019-12-25 01:15:36
问题 I want to enable my own widget class for stylesheets, whereat I am not talking about setStyleSheet(qss) , but selectors in a qss stylesheet. It is understood that I have to replace the "::" with "--" in namespaces. Here ( Qt Stylesheet for custom widget ) I have found a similar question, but it is > 4 years old. Based on the answer I have some detailed questions: a) Is the published approach with an overridden paintEvent still valid (Qt5.6/5.7), from https://stackoverflow.com/a/8817908/356726

Using PyQt5/Pyside2 to set a repeating SVG pattern as main window/Qwidget background

倖福魔咒の 提交于 2019-12-24 12:03:30
问题 I've generated the SVG css code through http://www.heropatterns.com/ and I'm trying to use it as the background for my main window/Qwidget. I want the background to resize as the window grows bigger or shrinks. I tried calling Form.setStyleSheet() with the generated css being passed in as an argument, but I only get the one of the two colors(the backround color) in the pattern. What's the proper way to display a SVG as the backround of the main QWidget window and see the complete pattern? I