Results 1 to 2 of 2

Thread: Convert to painter

  1. #1
    Join Date
    May 2009
    Location
    Gorontalo
    Posts
    200
    Thanks
    20
    Thanked 5 Times in 5 Posts
    Qt products
    Platforms
    Unix/X11 Windows

    Question Convert to painter

    I tied convert this stylesheet to painter, but I'm failed.

    stylesheet
    Qt Code:
    1. "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #e7effd, stop: 1 #cbdaf1);"
    To copy to clipboard, switch view to plain text mode 

    painter
    Qt Code:
    1. QLinearGradient linearGrad(0, 0, 0, 1);
    2. linearGrad.setColorAt(0, QColor("#e7effd"));
    3. linearGrad.setColorAt(1, QColor("#cbdaf1"));
    4.  
    5. painter->fillRect(option.rect, QBrush(linearGrad));
    To copy to clipboard, switch view to plain text mode 

    What is wrong ?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Convert to painter

    linearGrad(0,0,0,1) will make you a gradient that is 0 pixels wide and 1 pixel high. That's probably not what you want. Either set a different Spread for the gradient or use absolute (as opposed to relative used by style sheets) coordinates.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. problem in painter fillRect
    By wagmare in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2009, 13:43
  2. Problem with Painter in Qt4.4.1
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 1st September 2008, 13:47
  3. Painter drawLine doubt
    By arjunasd in forum Qt Programming
    Replies: 5
    Last Post: 24th August 2007, 19:59
  4. how to use loadFromData in painter
    By sar_van81 in forum Qt Programming
    Replies: 18
    Last Post: 31st January 2007, 04:09
  5. Painter not active!
    By Caius Aérobus in forum Qt Programming
    Replies: 7
    Last Post: 30th March 2006, 15:44

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.