Results 1 to 3 of 3

Thread: QHBoxlayout Size problem

  1. #1
    Join Date
    Nov 2007
    Posts
    6

    Default QHBoxlayout Size problem

    Hi.

    I'm having some troubles to stretch a widget on the screen.

    On my QmainWindow I create a Qwidget that I use as centralWidget.
    On my this QWidget( in my code mainWidget), I set a QHBoxlayout.

    In this HBoxlayout, I add 2 items, one is a QVBoxlayout, and another is an Widget, wich has an QGraphicsView and Scene.

    When I add the widget like this:

    Qt Code:
    1. m_centralWidget = new QWidget(this);
    2. m_hboxlay = new QHBoxLayout(m_centralWidget);
    3. m_vboxlay = new QVBoxLayout();
    4. [...]
    5. m_hboxlay->addLayout(m_vboxlay,0);
    6. m_hboxlay->addWidget(m_bordWidget,1);
    7. setCentralWidget(m_centralWidget);
    To copy to clipboard, switch view to plain text mode 

    I get something like this:


    As marked on the image with a red arrow, I would like to have that my bordWidget is stretched so it occupies the whole screen. I could set a fixedSize(int, int), but then on other resolutions, it would not fit.

    Can someone point me out how to do this?


    Thanks in advance,


    Spitz

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QHBoxlayout Size problem

    Does that "another Widget, wich has an QGraphicsView and Scene" have a layout installed?

    PS. Please attach screenshots next time.
    J-P Nurmi

  3. #3
    Join Date
    Nov 2007
    Posts
    6

    Default Re: QHBoxlayout Size problem

    Thank you, that was the problem.

    I added the view in a layout, and now it's ok!

    Thank you very much, and next time I'll add screen as attachment.

Similar Threads

  1. Problem with Size Policy of derived QWidget
    By eehmke in forum Qt Programming
    Replies: 6
    Last Post: 12th November 2008, 13:43
  2. Size Policy Problem
    By SenSej in forum Newbie
    Replies: 0
    Last Post: 28th October 2008, 14:13
  3. Qt Memory size problem ?
    By nrabara in forum Newbie
    Replies: 1
    Last Post: 29th September 2008, 15:27
  4. Simple Problem with QFont (point size)
    By mtrpoland in forum Newbie
    Replies: 4
    Last Post: 31st December 2007, 16:49
  5. QHBoxLayout Problem
    By Seema Rao in forum Qt Programming
    Replies: 5
    Last Post: 29th April 2006, 15:51

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.