Results 1 to 4 of 4

Thread: How to set QListWidget size MAX = QMainWindow ?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Posts
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default How to set QListWidget size MAX = QMainWindow ?

    Qt Code:
    1. EngineerMainWindow::EngineerMainWindow(QWidget *parent, Qt::WFlags fl)
    2. : QMainWindow( parent, fl )
    3. {
    4. //====== set main window size, title
    5. //======main window already has layout, don't set layout
    6. setWindowTitle( tr("Engineer Mode") );
    7. this->setMaximumSize ( 171, 176 );
    8.  
    9. QListWidget *mList = new QListWidget( this );
    10. QListWidgetItem *item = 0;
    11.  
    12. #if 0
    13. //====== set widget list size
    14. mList->setMaximumWidth ( 171 );
    15. mList->setMinimumHeight ( 176 );
    16. //mList->setMaximumHeight ( 176 );
    17. #endif
    18. #if 0
    19. //mList->setMaximumSize ( mList->maximumSize() );
    20. QSize se = mList->maximumSize();
    21. qWarning()<< "max size = " << se; // ==== printf : max size = QSize(171,16777215)
    22. mList->setMaximumSize ( se );
    23. #endif
    24.  
    25. }
    To copy to clipboard, switch view to plain text mode 

    I set my QMainWindow size MaximumSize ( 171, 176 );
    Then I added a QListWidget on the MainWindow,
    I would like let the QListWidget Size the same as MainWindow,
    But I try a lot of API of Qtopia, the ListWidget always display 60% area of the MainWindow.
    Wolud you tell me why ?? Thanks !!
    PS: if I set QListWidget size (171,176) first, the I get QSize will the same as my setting(171,176) ...@@'', but it displaying on the screen size that is not (171, 176),
    it looks like (120, 176), the height is ok, but width is wrong...
    Last edited by jacek; 16th March 2007 at 11:10. Reason: changed [html] to [code]

  2. #2
    Join Date
    Aug 2006
    Posts
    221
    Thanks
    3
    Thanked 29 Times in 19 Posts

    Default Re: How to set QListWidget size MAX = QMainWindow ?

    You could try to use a layout. Add one to your QMainWidget and add your QListWidget. Does not matter that it is your only widget in the layout. Usually works for me.

  3. #3
    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: How to set QListWidget size MAX = QMainWindow ?

    How about setting the list widget as a central widget of the main window? See QMainWindow::setCentralWidget().
    J-P Nurmi

  4. #4
    Join Date
    Feb 2006
    Posts
    6
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to set QListWidget size MAX = QMainWindow ?

    COOL~
    Thanks~

    I use QMainWindow::setCentralWidget ( QWidget * widget ) ,
    it seems to be OK.

Similar Threads

  1. Replies: 11
    Last Post: 21st February 2007, 11:26
  2. Replies: 13
    Last Post: 15th December 2006, 11:52
  3. Qt 4.2: QListWidget changes size of its items
    By KingFish in forum Qt Programming
    Replies: 2
    Last Post: 25th October 2006, 11:06
  4. Replies: 1
    Last Post: 24th October 2006, 16:40
  5. Qt 4.1.1 linker warnings
    By Matt Smith in forum Installation and Deployment
    Replies: 0
    Last Post: 26th February 2006, 22:14

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
  •  
Qt is a trademark of The Qt Company.