Results 1 to 2 of 2

Thread: No scrollbars or stretching in QToolBox

  1. #1
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default No scrollbars or stretching in QToolBox

    Hello

    This is a bit of newbie-ish question, even though I'm not a newbie. I have a QToolBox inside a QDockWidget. I have a custom widget "GeneralPage" that I add to the toolbox before adding that to the dockwidget. I have created "GeneralPage" using the designer, but everything else I have coded manually.

    I have two problems. Problem 1, my various lineedits, comboboxes etc that I have on my page do not stretch as I would like, nor can I get them to be the initial size that I would like. Problem 2, shrinking the page so that it is too small to show the contents does not result in scrollbars appearing.

    I have tried various layouts and spacers but nothing makes any difference. I've spent hours on this! I must be doing something fundamentally wrong. Perhaps I should code everything manually? Thanks.

  2. #2
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: No scrollbars or stretching in QToolBox

    Ok, I seem to have fixed the stretching problem and the lack of scrollbars.

    I had previously tried placing everything in a VBoxLayout, but that didn't work. I compared what I was doing to the source code of another program which worked. The difference was that in the designer, the layout in the working example had its properties combined with the widget properties. Whereas, in mine the VBoxLayout had its own separate properties and its own entry in the object list.

    So, I compared the UI files. In mine there was a second top level widget definition, not present in the working example:

    Qt Code:
    1. <widget class="QWidget" name="verticalLayoutWidget">
    2. <property name="geometry">
    3. <rect>
    4. <x>0</x>
    5. <y>0</y>
    6. <width>254</width>
    7. <height>381</height>
    8. </rect>
    9. </property>
    10. .
    11. .
    12. .
    13. </widget>
    To copy to clipboard, switch view to plain text mode 

    I manually edited the UI file to remove this which left me with the layout at the top level (below the first widget definition):

    Qt Code:
    1. <layout class="QVBoxLayout" name="verticalLayout">
    2. .
    3. .
    4. .
    5. </layout>
    To copy to clipboard, switch view to plain text mode 

    And the moral of the story is don't use the designer, code everything manually!

Similar Threads

  1. QwtPlot stretching
    By jmsbc in forum Qwt
    Replies: 7
    Last Post: 27th August 2013, 07:43
  2. Scrollbars for QStackedLayout
    By JohannesMunk in forum Newbie
    Replies: 0
    Last Post: 6th December 2009, 16:50
  3. Dockwidget stretching
    By jayreddy in forum Qt Programming
    Replies: 0
    Last Post: 6th November 2009, 15:37
  4. QGraphicsView and scrollbars
    By godmodder in forum Qt Programming
    Replies: 1
    Last Post: 29th March 2008, 22:34
  5. Stretching Icon in QPushButton
    By dsandber in forum Qt Tools
    Replies: 1
    Last Post: 6th October 2007, 16:51

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.