Results 1 to 3 of 3

Thread: QCombobox showPopup problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2008
    Posts
    57
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default QCombobox showPopup problem

    I develop for an embedded system, ARM9 with Qt Embedded 4.2.

    I have a combobox delegate and when the editor is opened the combobox
    is shown on top and the popup view is below. I just want the popup view list
    to be visible?

    When I run the same code on my laptop (X11) only the popup view is visible as I want it to be?

    This is the constructor for the combobox...
    Qt Code:
    1. BatchComboBox::BatchComboBox(QWidget *parent)
    2. : QComboBox(parent)
    3. {
    4.  
    5. view()->installEventFilter(this);
    6.  
    7. addItem(BATCH_ON);
    8. addItem(BATCH_OFF);
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 

    ...and the setEditor of the delegate.
    Qt Code:
    1. void PSetItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
    2. {
    3.  
    4. BatchComboBox *comboBox = static_cast<BatchComboBox*>(editor);
    5.  
    6. QString str = index.model()->data(index, (int) Qt::DisplayRole).toString();
    7. int value = comboBox->findText(str, Qt::MatchExactly);
    8.  
    9. comboBox->setCurrentIndex(value);
    10. comboBox->showPopup();
    11.  
    12. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,372
    Thanks
    3
    Thanked 5,019 Times in 4,795 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QCombobox showPopup problem

    Maybe you want to use QListWidget or QListView for your editor instead?

  3. #3
    Join Date
    Mar 2008
    Posts
    57
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QCombobox showPopup problem

    Yes I have thought of that solution. Seems to be the easiest way to get it done.

Similar Threads

  1. QCombobox showPopup
    By SailinShoes in forum Qt Programming
    Replies: 1
    Last Post: 8th August 2008, 12:21
  2. QComboBox problem
    By ^NyAw^ in forum Qt Programming
    Replies: 4
    Last Post: 31st March 2008, 11:43
  3. Problem while using QComboBox
    By merry in forum Qt Programming
    Replies: 6
    Last Post: 20th December 2007, 10:22
  4. Problem with QComboBox
    By jogeshwarakundi in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 8th December 2007, 13:21

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.