Results 1 to 4 of 4

Thread: QComboBox setMaxVisibleItems, need help?

  1. #1
    Join Date
    Nov 2010
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Symbian S60

    Default QComboBox setMaxVisibleItems, need help?

    Hi everyone how to user setMaxVisibleItems() with QCombobox?

    thank you very much.

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QComboBox setMaxVisibleItems, need help?

    http://doc.qt.nokia.com/4.7/qcombobo...ibleItems-prop

    Is there something specific you want help with?

  3. #3
    Join Date
    Nov 2010
    Posts
    4
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: QComboBox setMaxVisibleItems, need help?

    Why this code don't work?

    Qt Code:
    1. int numItems = 300;
    2. QStandardItemModel * queryModel = new QStandardItemModel(numItems , 1);
    3.  
    4. for (int row=0; row<numItems; ++row) {
    5. QStandardItem *item = new QStandardItem(QString("row %0").arg(row));
    6. queryModel->setItem(row, 0, item);
    7. }
    8. QComboBox *combo = new QComboBox;
    9. combo->setModel(queryModel);
    10. combo->view()->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    11. // MaxVisibleItems set
    12. combo->setMaxVisibleItems(20);//why this don't work
    13. combo->show();
    To copy to clipboard, switch view to plain text mode 

    thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: QComboBox setMaxVisibleItems, need help?

    Does the following apply to your system?

    This property is ignored for non-editable comboboxes in styles that returns false for QStyle::SH_ComboBox_Popup

Similar Threads

  1. Qcombobox
    By Project25 in forum Qt Programming
    Replies: 2
    Last Post: 16th December 2009, 19:29
  2. QComboBox
    By kavinsiva in forum Qt Programming
    Replies: 3
    Last Post: 10th August 2009, 16:11
  3. QComboBox
    By bismitapadhy in forum Qt Programming
    Replies: 7
    Last Post: 15th July 2009, 06:01
  4. QComboBox
    By coderbob in forum Qt Programming
    Replies: 4
    Last Post: 12th December 2007, 06:38
  5. QComboBox
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 31st August 2007, 13:17

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.