Results 1 to 8 of 8

Thread: Qtoolbutton style

  1. #1
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Question Qtoolbutton style

    Hi all
    i have to QToolButton. i want to give efect a button.

  2. #2
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qtoolbutton style


  3. #3
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Qtoolbutton style

    Click the button to change the efect is exactly what I should do.

  4. #4
    Join Date
    Apr 2010
    Location
    Rostov-na-Donu, Russia
    Posts
    153
    Thanks
    2
    Thanked 26 Times in 23 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qtoolbutton style

    Honestly, I didn't understand neither the first time nor now.
    What the effect (or effect of what) do you want to change?

  5. #5
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Qtoolbutton style

    I want to make a flash like a button. I'm click give different effects.

  6. #6
    Join Date
    Apr 2010
    Posts
    5
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Thumbs down Re: Qtoolbutton style

    You probably want to change the stylesheet every time you click the button?

    http://doc.trolltech.com/4.6/qwidget...tyleSheet-prop

    Edit:
    Ah, i saw that was already linked earlier. Something similar to this should give you an idea how you could achief this.

    Qt Code:
    1. class yourwindow
    2. {
    3. ...
    4. private:
    5. int buttonstate ;
    6. QButton * btn;
    7. private slots:
    8. void btnClicked();
    9. }
    10.  
    11. //setup the button somewhere
    12. buttonstate = 0;
    13. btn = new QButton(this);
    14. connect(btn, SIGNAL(clicked), this, SLOT(btnClicked));
    15.  
    16. void yourwindow::btnClicked()
    17. {
    18. switch(buttonstate)
    19. {
    20. case 0: btn->setStyleSheet(QString::fromUtf8("QButton { background: red; }")); break;
    21. case 1: btn->setStyleSheet(QString::fromUtf8("QButton { background: blue; }")); break;
    22. case 2: btn->setStyleSheet(QString::fromUtf8("QButton { background: green; }")); break;
    23. default: break;
    24. }
    25. buttonstate++;
    26. if(buttonstate > 2)
    27. buttonstate = 0;
    28. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by GreyHound; 4th April 2010 at 16:43.

  7. The following user says thank you to GreyHound for this useful post:

    offline (4th April 2010)

  8. #7
    Join Date
    Nov 2009
    Posts
    16
    Thanks
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Qtoolbutton style

    thanks.
    when i click on the button , i want to have shining.

  9. #8
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qtoolbutton style

    Depends on how you define shining.
    You could have some image overlay to create shining, you could paint the shining yourself,
    May be also you can have a look at QGraphicsEffect class.. it works with widgets and may be colorize might help you.

Similar Threads

  1. QToolButton + style sheet problem
    By John82 in forum Qt Programming
    Replies: 6
    Last Post: 22nd August 2015, 19:37
  2. Do Qt Style Sheets support List-style-image?
    By daiheitan in forum Qt Programming
    Replies: 6
    Last Post: 12th March 2010, 01:41
  3. Problems with Gradient style used through Style sheet on ARM platform
    By puneet.narsapur in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 25th January 2010, 12:48
  4. Replies: 1
    Last Post: 15th March 2009, 20:02
  5. QToolButton and Style sheet
    By desch in forum Qt Programming
    Replies: 8
    Last Post: 1st December 2007, 08:38

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
  •  
Qt is a trademark of The Qt Company.