qtstylesheets

QWebView set border visible

China☆狼群 提交于 2019-12-11 02:35:30
问题 I want to make QWebView widget have borders in my layout and UI when running, similar to QTableView . Now it looks borderless and hidden. Is it even possible? 回答1: It's not possible to set border to QWebView. Instead you can place your QWebView inside another QWidget and set it's border. See example below (QtDesigner): Widgets hierarchy: Look inside QtDesigner: StyleSheet for QFrame: QFrame { border: 1px solid black; background: white; } 来源: https://stackoverflow.com/questions/21249403

Why does the border of QWidget cover the contents?

时光总嘲笑我的痴心妄想 提交于 2019-12-10 23:31:18
问题 I have a custom widget derived from QWidget , which has a minimumSize of (30, 30) and a QLabel as a childWidget : MyWidget::MyWidget (QWidget *parent, QPoint p, QWidget *childWidget) : QWidget (parent) { childWidget = this->childWidget; setAttribute (Qt::WA_DeleteOnClose); this->move (p); verticalLayout = new QVBoxLayout (this); if (childWidget != NULL) { childWidget->setParent (this); childWidget->releaseMouse(); childWidget->setAttribute (Qt::WA_TransparentForMouseEvents, true);

How can I restore default system value of a QSS property?

最后都变了- 提交于 2019-12-10 20:43:57
问题 Qt QSS is propagated to children, if one parent set its stylesheet to color: red , all its children will apply this stylesheet. If you set explicitely QLabel {color: red} , then only QLabel children will be concerned. It is possible to overwrite the stylesheet on children, if they set their own values children->setStyleSheet("color: blue"); but I could not find a way to reset the property to the default value. The value set by the system or Qt, if we had not set this property in any parent's

How to set color of child QLabels while hover parent QFrame with QSS?

瘦欲@ 提交于 2019-12-10 15:56:32
问题 I'm trying to set the hover state color of 2 labels inside a QFrame with a stylesheet, but the frame takes the hover states regardless if there is an actual hover: See screenshot: I've got a QFrame with QLabels. I set the default colors to green and purple. While i hover the QFrame, the color of both labels should go red. The exact same CSS does work with html, but i can't seem to get it to work with the QT stylesheets. div{background-color:black; width:200px; height:100px;} #label1{color:

QDockWidget::title (Need to change the font & size)

五迷三道 提交于 2019-12-10 14:05:52
问题 I have following style sheet set for QDockWidgets in my QT app. All the things mentioned in the style are working except for the font. Why is "font" is not detected & how could I change the font & size of QDockWidget title ? QDockWidget::title { font: 18pt "Roboto Lt"; background: lightgray; padding-left: 10px; padding-top: 4px; } 回答1: Font should be applied to the QDockWidget itself, not to the sub-control ::title QDockWidget { font-family: "Roboto Lt"; font-size: 18pt; } 回答2: Watch the font

Error while changing QObject stylesheet in a Thread

烂漫一生 提交于 2019-12-10 10:43:07
问题 Context I want to build QObject animations in python. For example, I tried animating the background of a QLineEdit object in order to make a "red flash" when a something wrong is entered. The function is working, the thread starts and I see the animation, but when the thread ends, the app collapses without error trace-back. I only get exit code -1073740940 Which I didn't find on the internet. Minimal Working Example Here's a mwe that I made in order for you to reproduce this error with only

Set CSS in QPushButton's subclass's constructor

心不动则不痛 提交于 2019-12-09 07:39:26
I'm creating my custom push button class by subclassing QPushButton . However for some reason setting that class's CSS in its constructor has no effect; I have to do it in for example paintEvent , then everything is fine. I could just have a global .qss file and set it for the entire application, but I want the class to manage its own styles. Why doesn't my approach work? The code: custompushbutton.h class CustomPushButton: public QPushButton { Q_OBJECT public: explicit CustomPushButton(QWidget *parent = 0); ~CustomPushButton() = default; }; custompushbutton.cpp CustomPushButton:

QComboBox text colour won't change with style sheet

微笑、不失礼 提交于 2019-12-08 23:49:48
问题 I'm trying to style a combobox in QT5. I'm using QT Creator for the layout and loading an app-wide style sheet at start up. The css I have related to my combobox is as follows: QComboBox { color:white; background-color: qlineargradient(x1:0, y1:0, x2:1,y2:1, stop: 1 rgba(228, 41, 81, 100), stop: 0 rgba(234, 107, 101, 100)); border-color: rgba(255,255,255,200); border-width: 1px; border-style: solid; } QComboBox QListView { border-style: none; background-color: qlineargradient(x1:0, y1:0, x2:1

Animated Gif static in QStyleSheet

ぃ、小莉子 提交于 2019-12-08 07:21:05
问题 I'm wanting to customize the look of a QProgressBar with a stylesheet. I'd like to give it that animated, 'indeterminate' look. So I made an animated GIF to stick in the background of the QProgressBar::chunk . It shows up fine, but the image is static, with no animation. Any suggestions or workarounds? I'm running PyQt 4.9.4 on OS X 10.8. 回答1: So, this is a slightly more complex problem that you're facing. The QProgressBar relies on information from a loop or some determined amount to

Set CSS in QPushButton's subclass's constructor

一笑奈何 提交于 2019-12-08 06:44:45
问题 I'm creating my custom push button class by subclassing QPushButton . However for some reason setting that class's CSS in its constructor has no effect; I have to do it in for example paintEvent , then everything is fine. I could just have a global .qss file and set it for the entire application, but I want the class to manage its own styles. Why doesn't my approach work? The code: custompushbutton.h class CustomPushButton: public QPushButton { Q_OBJECT public: explicit CustomPushButton