PDA

View Full Version : QSS: qlineargradient not working, when inserting whitespaces



Kampfgnom
14th December 2011, 08:02
Hi,

I came across a weird behaviour in Qt 4.7.4 on Mac OS X Lion 10.7.2.
I have a QSS file as a Qt resource and set it on an QTreeView like:

QFile stylesheet(QLatin1String(":/sidebar/macos_lionmail/stylesheet"));
stylesheet.open(QFile::ReadOnly);
m_treeView->setStyleSheet(stylesheet.readAll());

The first of the two following stylesheets works (and btw resembles the Mail.app sidebar background on Lion), the second does nothing:

QTreeView {
background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(238, 240, 244, 255), stop:1 rgba(210, 216, 224, 255) ); /* works */
}
QTreeView {
background-color: qlineargradient( spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(238, 240, 244, 255), stop:1 rgba(210, 216, 224, 255) ); /* fails */
}


Now someone tell me that this ist wanted behaviour! Discuss :-)

Steamus
15th December 2011, 14:52
I have the same problem. It looks like it also depends on the ‘rgba’.

For example this code works independently on the whitespaces:


setStyleSheet( "background-color: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 red, stop:1 white )" ); /* works */

But this one doesn’t work (and there is message - Could not parse stylesheet of widget):


setStyleSheet( "background-color: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 rgba( 255, 0, 0, 155 ), stop:1 white )" ); /* fails */

When I remove space after 'qlineargradient(' It start working:


setStyleSheet( "background-color: qlineargradient(x1:0 y1:0, x2:1 y2:0, stop:0 rgba( 255, 0, 0, 155 ), stop:1 white )" ); /* works */

Qt for Desktop 4.7.4
Windows XP

DDR
14th December 2018, 06:04
Oh man, I just got bitten by this one on Qt 5.11, 7 years later. ?

[edit] OK, high-unicode doesn't work here either, I guess.

ChristianEhrlicher
16th December 2018, 13:36
This should be fixed with 5.12