Results 1 to 5 of 5

Thread: QTabWidget adjust internal Widget to fit full size

  1. #1
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QTabWidget adjust internal Widget to fit full size

    Hi,

    I'm creating a QTabWidget and adding a QScrollArea into it. I want the QScrollArea to fit all the avaiable space. How can I do it?

    Thanks,
    Òscar Llarch i Galán

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QTabWidget adjust internal Widget to fit full size

    Maybe I get you wrong, but what about using a layout inside a tab page? QHBoxLayout.

  3. #3
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTabWidget adjust internal Widget to fit full size

    Hi,

    This is the code that I'm using:
    Qt Code:
    1. m_pqTabWidget = new QTabWidget(m_pqParametersDock);
    2. m_pqParametersDock->setWidget(m_pqTabWidget);
    3.  
    4. m_pqScrollAreaConfig = new QScrollArea();
    5. m_pqScrollAreaConfig->setWidgetResizable(false);
    6. m_pqTabWidget->addTab(m_pqScrollAreaConfiguracio,QString("Configuration"));
    To copy to clipboard, switch view to plain text mode 

    Have I to create a QWidget as the internal Widget of the QTabWidget, then add a layout to it where I will add the QScrollArea?

    Thanks,
    Òscar Llarch i Galán

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QTabWidget adjust internal Widget to fit full size

    Your code works fine for me. Only be careful that m_pqScrollAreaConfig != m_pqScrollAreaConfiguracio. Maybe that's the error?

  5. #5
    Join Date
    Jan 2006
    Location
    Sta. Eugènia de Berga (Vic - Barcelona - Spain)
    Posts
    869
    Thanks
    69
    Thanked 59 Times in 57 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTabWidget adjust internal Widget to fit full size

    Hi,

    Only be careful that m_pqScrollAreaConfig != m_pqScrollAreaConfiguracio. Maybe that's the error?
    It's only a copy paste mistake.

    Your code works fine for me
    I use a QWidget into the QScrollArea that grows depending on some data that it have to show(it add some custom widgets). This internal widget is deleted when I need to fill up new different data. Then, the tabs that have showed the scrolls of the QScrollArea still show them and I don't want it.

    Thanks,
    Òscar Llarch i Galán

Similar Threads

  1. How can i make widget automatically adjust screen size
    By kapoorsudhish in forum Qt Programming
    Replies: 3
    Last Post: 23rd October 2009, 15:21
  2. resizing widgets depending on a main widget size
    By luf in forum Qt Programming
    Replies: 6
    Last Post: 10th October 2009, 16:13
  3. Replies: 0
    Last Post: 2nd October 2009, 17:57
  4. Replies: 2
    Last Post: 23rd March 2009, 17:26
  5. Simple custom widget won't size properly
    By MrGarbage in forum Qt Tools
    Replies: 2
    Last Post: 9th August 2007, 13:12

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.