Results 1 to 4 of 4

Thread: QSS: qlineargradient not working, when inserting whitespaces

  1. #1
    Join Date
    Dec 2010
    Posts
    11
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default 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:
    Qt Code:
    1. QFile stylesheet(QLatin1String(":/sidebar/macos_lionmail/stylesheet"));
    2. stylesheet.open(QFile::ReadOnly);
    3. m_treeView->setStyleSheet(stylesheet.readAll());
    To copy to clipboard, switch view to plain text mode 

    The first of the two following stylesheets works (and btw resembles the Mail.app sidebar background on Lion), the second does nothing:
    Qt Code:
    1. 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 */
    2. }
    3. 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 */
    4. }
    To copy to clipboard, switch view to plain text mode 

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

  2. #2
    Join Date
    Dec 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default 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:

    Qt Code:
    1. setStyleSheet( "background-color: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 red, stop:1 white )" ); /* works */
    To copy to clipboard, switch view to plain text mode 

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

    Qt Code:
    1. setStyleSheet( "background-color: qlineargradient( x1:0 y1:0, x2:1 y2:0, stop:0 rgba( 255, 0, 0, 155 ), stop:1 white )" ); /* fails */
    To copy to clipboard, switch view to plain text mode 

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

    Qt Code:
    1. setStyleSheet( "background-color: qlineargradient(x1:0 y1:0, x2:1 y2:0, stop:0 rgba( 255, 0, 0, 155 ), stop:1 white )" ); /* works */
    To copy to clipboard, switch view to plain text mode 

    Qt for Desktop 4.7.4
    Windows XP

  3. #3
    Join Date
    Aug 2018
    Posts
    9
    Qt products
    Qt5
    Platforms
    Unix/X11

    Arrow 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.

  4. #4
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSS: qlineargradient not working, when inserting whitespaces

    This should be fixed with 5.12

Similar Threads

  1. Replies: 7
    Last Post: 21st June 2012, 21:37
  2. QLinearGradient and QwtThermo
    By Marco Trapanese in forum Qwt
    Replies: 2
    Last Post: 6th June 2010, 08:33
  3. QAbstractItemDelegate and QLinearGradient
    By toutarrive in forum Qt Programming
    Replies: 2
    Last Post: 12th February 2010, 18:20
  4. Regarding qlineargradient
    By jjbabu in forum Qt Programming
    Replies: 6
    Last Post: 15th April 2009, 10:21
  5. Related QLinearGradient
    By ashishsaryar in forum Qt Programming
    Replies: 5
    Last Post: 26th May 2008, 11:09

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.