Results 1 to 3 of 3

Thread: QComboBox dropdown Height

  1. #1
    Join Date
    Feb 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QComboBox dropdown Height

    Version : Qt 4.6.0
    OS : Linux

    I tried setting QComboBox Height.

    Qt Code :
    Qt Code:
    1. QComboBox *cbo = new QComboBox;
    2.  
    3. ....
    4.  
    5. cbo->clear();
    6. cbo->setModel(model);
    7. cbo->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    8. cbo->view()->setFixedHeight(100);
    To copy to clipboard, switch view to plain text mode 
    If it's code execute, then QComboBox's area overflowed in window screen.


    Any suggestions?
    ( please show to me the short example ...
    I'm beginer Qt.
    )

    Thanks.

  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: QComboBox dropdown Height

    Quote Originally Posted by minsoub View Post
    ( please show to me the short example ...
    I'm beginer Qt.
    )
    Then you should use our Newbie section... See QComboBox::completer() and QCompleter::setMaxVisibleItems().

  3. #3
    Join Date
    Feb 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox dropdown Height

    First of all, thanks to your answer.

    I tried coding something like :

    QComboBox *cbo = new QComboBox;
    QSqlQueryModel *model = new QSqlQueryModel;

    ....

    cbo->clear();
    cbo->setModel(model);

    cbo->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded) ;

    QCompleter *p = new QCompleter(icao_cdModel);
    p->setMaxVisibleItems(20);
    cboIcao_cd->setCompleter(p);
    -----------------------------------------------------------------------------------------
    but the results is equlas above question.

    Please show to me detail the solution.

    thanks.

Similar Threads

  1. Replies: 6
    Last Post: 29th April 2014, 05:04
  2. Same height for QComboBox and QPushButton
    By cevou in forum Qt Programming
    Replies: 5
    Last Post: 12th May 2012, 08:56
  3. Dropdown menu?
    By rakkar in forum Newbie
    Replies: 1
    Last Post: 9th September 2009, 18:13
  4. QcomboBox item height
    By Beppe in forum Qt Programming
    Replies: 9
    Last Post: 16th June 2009, 12:31
  5. DropDown combo box
    By Tavit in forum Qt Programming
    Replies: 3
    Last Post: 3rd May 2008, 09:40

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.