Results 1 to 5 of 5

Thread: Style size of elements

  1. #1
    Join Date
    Nov 2008
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Style size of elements

    Hello,

    I'm trying to implement custom style for some widgets. I made my own style class, derived from QPlastiqueStyle, that customize widgets. For some widgets I would like to change their size (for instance for ToolBox tab). There is a virtual function sizeFromContents() that should return new element size. However, incoming structure ContentsType (describes widget type) doesn't contain my widget type. Honestly structure quite limited for a number of widgets.

    Does it mean that I cannot change size of ToolBox tabs? In general, does it mean that I can resize only elements from ContentsType structure? If yes is there ant other way to resize toolbox tab?
    Last edited by 1111; 24th February 2009 at 10:44.

  2. #2
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Style size of elements

    hv u seen

    Qt Code:
    1. int QStyle::pixelMetric ( PixelMetric metric, const QStyleOption * option = 0, const QWidget * widget = 0 ) const [pure virtual]
    To copy to clipboard, switch view to plain text mode 

    here PixelMetric has many toolbar relative fields, should be helpful to u

  3. #3
    Join Date
    Nov 2008
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Wink Re: Style size of elements

    Quote Originally Posted by talk2amulya View Post
    here PixelMetric has many toolbar relative fields, should be helpful to u
    I have one misprint in my previous post. I would like to resize toolBOX tab, not toolBAR tab.

  4. #4
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    517
    Thanks
    21
    Thanked 66 Times in 62 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Style size of elements

    u can easily change the size of the tab of a QToolBox widget by calling setGeometry or resize or setFixedSize()..u dont need to create a style for that

  5. #5
    Join Date
    Nov 2008
    Posts
    17
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Style size of elements

    I need to make a new style any way. In my case I have a toolbox that has to be in my style with custom view. Unfortunately, when I draw this toolbox via drawControl(), existing area not enough to draw custom toolbox tab. So I would like to extend size of toolbox a little bit, that it can fit my custom view.

Similar Threads

  1. Text size
    By bnilsson in forum Qt Programming
    Replies: 2
    Last Post: 2nd October 2008, 21:56
  2. How to find best size for QTableWidget?
    By plamkata in forum Qt Programming
    Replies: 3
    Last Post: 24th July 2008, 19:07
  3. QT-wince and QHttp::readAll() trouble....
    By AcerExtensa in forum Qt for Embedded and Mobile
    Replies: 6
    Last Post: 12th June 2008, 09:40
  4. QLabel size policy
    By Caius Aérobus in forum Qt Programming
    Replies: 3
    Last Post: 7th December 2007, 17:57
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

Tags for this Thread

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.