Question

I'm using PyQt4 to make an interface with a number of QLineEdit and QSpinBox inputs. I want to give both a nice rounded appearance, but this gives a problem in the case of the spinboxes.

The relevant bits of the stylesheet looks like this:

QDialog {
    background-color: #444;
}

QLabel, QLineEdit, {
    background-color: #eee;
    border-radius: 8px;
}

QSpinBox{
    background-color: #eee;
}

Giving an interface looking like this:

UI screenshot

Now when I include a border-radius (even with a value of 0) for QSpinBox and QComboBox, I get this

Glitchy UI screenshot

Notice how the arrows changed from Windows XP/vista themed to a plain default look.

Why does this happen and how can I prevent it?

What I would like to see is that the main shapes of the spinbox and combobox are shaped like the line edits. I have not tried setting custom arrow images, as I would prefer to use the native defaults. Or is that really my best/only option? Thanks!

Was it helpful?

Solution

Go through this QStyle, where you get the idea to change the style of your widget to QWindowsStyle, QMacStyle or QMotifStyle. And also if you set stylesheet of a particular widget, only the values set by you will be updated, rest other properties are inherited from its parent widget. so try specifying widget style too as I said above while setting stylesheet.

OTHER TIPS

When you change style sheet of widget it becomes styled with QCssStyle. It fall backs every not styled subcontrol into default style. You must style whole control to get desired look. It won't mix

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top