2

I'm using custom compiled Qt libraries version 4.8.5 with MinGW GCC 4.8.2 along with Qt Creator 3.0.1 and I'm trying to set the sizeHint of two Tab Widgets inside a Horizontal Splitter under the Central Widget in order to have the left tab widget occupy less space than the right one. I found this answer that describes the layout mechanism a little and it says that this can be achieved with the sizeHint widget property. However I can't find find the sizeHint property inside the widget properties panel. There's only sizePolicy, minimumSize and mazimumSize (geometry is locked since it's inside a splitter). Trying to add that property manually gives me a message that the property already exists but I can't find it anywhere.

Does this property exists only in Qt libraries 5x or older 4x versions? Do I have to do this manually in C++ or can be done without programming? Where can I set this property inside the Qt Creator?

Community
  • 1
  • 1
SLC
  • 2,167
  • 2
  • 28
  • 46
  • 2
    I'm pretty sure `sizeHint` is a method, not property. Many widgets must calculate it dynamically in a non-trivial way. – Violet Giraffe Mar 01 '14 at 20:55
  • Oh, I see. From what I can understand so far that is a method that returns a size that I'm guessing it's calculated automatically to represent the preferred/recommend size. – SLC Mar 01 '14 at 21:04

1 Answers1

4

You may use layout's stretch feature. When you have 2 widgets in, say, QHBoxLayout, the default is to give them equal space. But look at the "stretch" property. If you set it to "1,2", you get first one to occupy 1/(1+2) of the layout space and second to 2/(1+2).

elephant
  • 149
  • 1
  • 6