[PyQt] Problems with stylesheets.

Gustavo A. Díaz gustavo.diaz at gmail.com
Fri Nov 30 22:02:39 GMT 2007


Hi guys.

I have a weird problem when i want to style my app, but specially with
QPushButton and QScrollBar.

I have this for QPushButton:

self.setStyleSheet (" \
                QPushButton {background-image:
url(:/Styles/styles/oc_buttonBg.png); color: white; font: bold; \
                border-style: inset; background-repeat: no repeat;
background-position: center;} \
                QPushButton:hover {background-image:
url(:/Styles/styles/oc_buttonBg_hover.png); \
                border-style: inset; background-repeat: no repeat;
background-position: center;} \
                QPushButton:pressed {background-image:
url(:/Styles/styles/oc_buttonBg_pressed.png);\
                border-style: inset; background-repeat: no repeat;
background-position: center;}")

And for QScrollBar:

self.setStyleSheet ("QScrollBar:vertical { \
                      background-image:
url(:/Styles/styles/scrollbar_bg.png); \
                      width: 15px; \
                      margin: 15px 0 15px 0;} \
                      QScrollBar::handle:vertical { \
                      background-image:
url(:/Styles/styles/scrollbar_body.png); \
                      min-height: 15px;} \
                QScrollBar::add-line:vertical { \
                      border: 0px; \
                      background-image:
url(:/Styles/styles/scrollbar_downArrow_Bg.png); \
                      height: 15px; \
                      subcontrol-position: bottom; \
                      subcontrol-origin: margin;} \
                QScrollBar::sub-line:vertical { \
                      border: 0px; \
                      background-image:
url(:/Styles/styles/scrollbar_upArrow_Bg.png); \
                      height: 15px; \
                      subcontrol-position: top; \
                      subcontrol-origin: margin;} \
                      QScrollBar::up-arrow:vertical { \
                      background-image:
url(:/Styles/styles/scrollbar_upArrow.png); \
                background-repeat: no repeat; \
                width: 15px; \
                height: 15px;} \
                QScrollBar::down-arrow:vertical { \
                      background-image:
url(:/Styles/styles/scrollbar_downArrow.png); \
                background-repeat: no repeat; \
                width: 15px; \
                height: 15px;} \
                      QScrollBar::add-page:vertical,
QScrollBar::sub-page:vertical { \
                      background: none;}")

Now, the buttons are not being styled if the scrollbar stylesheet exist...
if i delete the scrollbar stylesheet.. buttons style are there.

Now, if a use both but in the QPushButton i use directly the name of the
Widget to style (lets say, self.firstButton.setStyleSheet....) the buttons
shows the style but the scrollbar back to QT4 default look...

What is going on?

Thanks

Cheers.... and hope someone to respond my post someday.... lately no one
does it.... :(


-- 
Gustavo A. Díaz
GDNet Projects
www.gdnet.com.ar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20071130/95294d71/attachment-0001.html


More information about the PyQt mailing list