Results 1 to 3 of 3

Thread: Custom Push Button Size

  1. #1
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Custom Push Button Size

    Hi,
    I have a ini file from which I have to load some settings such as widget colors and sizes.
    I'm implementing a new qstyle customized according to the settings loaded from the ini file (i.e. I read this file in the new qstyle constructor).
    About colors I haven't problems, I read the info from file and set the qpalette properties...instead about widget sizes I have some problems.
    QStyle uses qstyleoption subclasses to draw the different widgets, specially about its sizes so how can I set a fixed size for a specific widget through qstyle? For example, if I want to set the size 100x50 fro all the qpushbutton present in my gui, what's the easy way to do this without
    using a style sheet?

  2. #2
    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: Custom Push Button Size

    Its not a good idea to mix QStyle and stylesheets...
    You can read sizes from file and use QWidget::setGeometry or QWidget::resize to set the sizes.

  3. #3
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Custom Push Button Size

    Quote Originally Posted by aamer4yu View Post
    Its not a good idea to mix QStyle and stylesheets...
    I'm agree too...but in your opinion, regarding my task, is better using stylesheet or qstyle solution?

    Quote Originally Posted by aamer4yu View Post
    You can read sizes from file and use QWidget::setGeometry or QWidget::resize to set the sizes.
    Ok but in this way I have to manually set geometry or resize about all widget present in my gui...I want automatically do that in order to unifomize look & feel and size of all my widgest thought a qstyle!

Similar Threads

  1. Need help to design push button
    By keyurparekh in forum Qt Programming
    Replies: 4
    Last Post: 29th March 2011, 13:39
  2. [QT]Push button-no action
    By nqn in forum Newbie
    Replies: 4
    Last Post: 30th May 2010, 19:08
  3. Hareware Push Button
    By mickeyk191 in forum Newbie
    Replies: 2
    Last Post: 26th January 2010, 12:41
  4. shape of push button
    By Seema Rao in forum Qt Programming
    Replies: 23
    Last Post: 2nd April 2008, 01:05
  5. Push Button problem!!
    By Seema Rao in forum Qt Programming
    Replies: 1
    Last Post: 22nd April 2006, 16:31

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.