Results 1 to 2 of 2

Thread: Remove space in VBoxLayout

  1. #1
    Join Date
    Jun 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Symbian S60 Maemo/MeeGo

    Default Remove space in VBoxLayout

    Hello

    For some reason when I drop (using QT Creator) a PushButton onto the VBoxLayout it is not possible to set the height of the PushButton any more. It is important that I can set the height of the button though for ease of use.

    I reverted back to creating the form and widgets in code. Here it is possible for me to set the height of the button before adding the button to the layout. The issue now though is that there is a big space between widgets. How can I remove the space between widgets.

    I make use of the layout widget because it strecthes the button widgets nicely when the mobile device is tilted. Is there perhaps a different way to keep the buttons stretched in vertical and horizontal mode without using a layout?

    Regards

    George
    Attached Images Attached Images

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: Remove space in VBoxLayout

    For some reason when I drop (using QT Creator) a PushButton onto the VBoxLayout it is not possible to set the height of the PushButton any more. It is important that I can set the height of the button though for ease of use.
    You should be able to set the height from the property editor, what happens if you set from property editor?

    I reverted back to creating the form and widgets in code. Here it is possible for me to set the height of the button before adding the button to the layout. The issue now though is that there is a big space between widgets. How can I remove the space between widgets.
    You can do this by using a container layout, something like this
    Qt Code:
    1. QWidget* widget = new QWidget(this);
    2. QVBoxLayout* layout = new QVBoxLayout(this);
    3. layout->addStretch();
    4. layout->addWidget(new QPushButton("Upper"));
    5. layout->addWidget(new QPushButton("Lower"));
    6. layout->addStretch();
    7. widget->setLayout(layout);
    To copy to clipboard, switch view to plain text mode 

    I make use of the layout widget because it strecthes the button widgets nicely when the mobile device is tilted. Is there perhaps a different way to keep the buttons stretched in vertical and horizontal mode without using a layout?
    You may need to implement your own custom layout management which monitors the device size, and the resize your buttons, I would prefer to use a layout to do this.

Similar Threads

  1. How to remove Space Between 2 QHBoxLayout Widget
    By jaya in forum Qt Programming
    Replies: 3
    Last Post: 6th October 2010, 22:57
  2. Replies: 0
    Last Post: 27th April 2010, 15:15
  3. Eleminating Spacing Between QScrollArea and VBoxLayout
    By wswartzendruber in forum Newbie
    Replies: 1
    Last Post: 19th January 2009, 04:34
  4. QScrollArea with a VBoxLayout
    By rishid in forum Qt Programming
    Replies: 3
    Last Post: 22nd January 2008, 09:17
  5. peculiar VBoxLayout Behavior....
    By nupul in forum Qt Programming
    Replies: 2
    Last Post: 3rd May 2006, 18:37

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.