Important: Please read the Qt Code of Conduct -

QComboBox Disable drop-down / popup ? (Drag-n-Drop)

  • Is there anyway that I can disable the drop-down for QComboBox and enable it again. The requirement is like I want to disable the dropdown list while using drag events i.e startDrag(),dragMoveEvent() etc and enable it after the events/functionalities have been executed successfully.


  • Setting enabled for the entire combo box to false doesn't do the trick?

  • [quote author="utcenter" date="1360560873"]Setting enabled for the entire combo box to false doesn't do the trick?[/quote]

    No, if I setEnabled(false) then I am not able to use drag-n-drop for the currentItem in the combo.Secondly the display/view of the combobox changes, i want to maintain the same efftect/display of the view and just want to disable the dropdown.

    PS :

    Found something like showPopup() and hidePopup() will check if this works.

  • Okay one more question ,

    When i am trying to drag the combobox then the drag cursor changes like
    ! )!

    but for a QWidget the drag cursor looks like

    ! cursor)!

    I did not explicitly change the dragCursor, then why do I get different outputs ? How to get the above dragCursor for comboBox?

  • Solved the above problem , I just forgot to use drag->setPixmap()


  • I'm maybe over thinking this, and got a bit confused about your usecase. THe only way for a combobox to 'open' is to click on top of the combobox. You explicitly have to do your mouse-down inside the area of the combobox. This means that it should not open at all while dragging...

    What am I missing?

Log in to reply