QSS: qlineargradient not working, when inserting whitespaces
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:
Code:
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:
Code:
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 */
}
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 :-)
Re: QSS: qlineargradient not working, when inserting whitespaces
I have the same problem. It looks like it also depends on the ‘rgba’.
For example this code works independently on the whitespaces:
Code:
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):
Code:
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:
Code:
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
Re: QSS: qlineargradient not working, when inserting whitespaces
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.
Re: QSS: qlineargradient not working, when inserting whitespaces
This should be fixed with 5.12