Results 1 to 3 of 3

Thread: how to define a new tyle of Qt::BrushStyle,

  1. #1
    Join Date
    May 2010
    Location
    China
    Posts
    66
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default how to define a new tyle of Qt::BrushStyle,

    i need to define a new style of QT::BrushStyle ,because i need to change the color of the brushstyle at runtime ,so i can't use the Qt::TexturePattern.
    how to define a new style ,anyone can help me?

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: how to define a new tyle of Qt::BrushStyle,

    You can create a brush with a texture by providing the pixmap when the brush is created or by using setTexture().
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. #3
    Join Date
    Feb 2013
    Location
    India
    Posts
    153
    Thanks
    27
    Thanked 18 Times in 18 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: how to define a new tyle of Qt::BrushStyle,

    you need not to define a new QBrush style, just create a QBrush member variable in your class.

    So, whenever you want to change its texture you can set it to your brush.
    Painter will then use your newly updated brush style for drawing.
    Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

Similar Threads

  1. Does not define type
    By Atomic_Sheep in forum General Programming
    Replies: 4
    Last Post: 22nd July 2013, 15:04
  2. how to define a dependency on an archive
    By Mike Rumore in forum Newbie
    Replies: 2
    Last Post: 10th February 2010, 21:49
  3. tr with #define..it can work?
    By mattia in forum Newbie
    Replies: 9
    Last Post: 4th February 2008, 11:15
  4. #define MYCLASS_H ?
    By bnilsson in forum General Programming
    Replies: 1
    Last Post: 3rd February 2008, 10:50
  5. where should i put #define in QtDesigner?
    By nass in forum Qt Tools
    Replies: 1
    Last Post: 16th October 2006, 15:52

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.