Results 1 to 13 of 13

Thread: Problem with setFont for a PushButton

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2006
    Location
    San Diego, USA
    Posts
    95
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Problem with setFont for a PushButton

    Hi All

    I am having a problem with setFont for a PushButton.
    I have designer GUI which have GroupBoxes, inside these GroupBoxes I have pushbuttons, where the pushbuttons font set to sanserif, 10, Bold.
    On clicking these pushbuttons I need to change the text on PushButton as well as from bold to normal.
    Here is the Code Snippet for changing font for a pushbutton which is not working for me.

    code:
    Qt Code:
    1. void MainWindow::function1()
    2. {
    3. ....
    4. ....
    5. QObject::connect(pushButton1, SIGNAL(clicked()), this, SLOT(changeProperties()));
    6. }
    7.  
    8. void MainWindow::changeProperties()
    9. {
    10. .....
    11. .....
    12. /*QFont f declared in .h file*/
    13. f.setPointSize(10);
    14. f.setBold(false);
    15. f.setWeight(5);
    16. pushButton1->setFont(f);
    17. pushButton1->setText("Changed Property");
    18. }
    To copy to clipboard, switch view to plain text mode 
    I am expicitly trying to change the font properties to this pushButton widget, which should overwrite the its own properties for font or parent widget properties, if at all it is using.
    I am not sure why it is not changing. Help me in this regard.

    Thanks & Regards,
    Arun
    Last edited by jpn; 28th March 2008 at 18:48. Reason: missing [code] tags

Similar Threads

  1. Pushbutton sizing problem on Mac OS
    By will49 in forum Qt Programming
    Replies: 5
    Last Post: 3rd October 2007, 21:26
  2. PushButton height problem
    By impeteperry in forum Qt Tools
    Replies: 4
    Last Post: 28th January 2007, 20:36
  3. Replies: 16
    Last Post: 7th March 2006, 15:57

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.