Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Help] QComboBox multiple events
i have a pretty simple question and i didnt found a solution on google yet.
Is it possible to have 2 different events connected to a click on the QComboBox ?
What i need is the following:
Event A: Click on the Box -> Do Function A
Event B: Click on the Arrow -> Toggle Dropdown
The dropdown is shown when you click on the arrow. What do you want to happen when you click in the line edit of the QComboBox ?
The dropdown is shown when i click anywhere on the combobox. Not just the arrow.
Let me explain it again:
[My1stEntry | ▼]
- Click on Arrow: Toggle Dropdown
- Click on Entry (Dropdown off): Call function defined by me.
- Click on Entry (Dropdown on:) Set selected entry as current selected.
Maybe this helps more in terms of understanding.
As written before the handling of the dropdown is already there.
The only thing you have to do is connect the QComboBox::activated signal to the function you want to call when an item is selected.
Okay, then i simply don't get it. Because right now it doesn't matter where i click on the combobox, it will simply toggle the dropdown (not just on click on the arrow). And i dont seem to find a way to have a difference between
Click on Arrow
Click on ComboBox (showing the current selected entry
Click on Entry (when list is open)
Guess i have to add a new button next to the combobox.
What Qt version are you using ?
What OS are you running ?
I'm using Qt 5.10 - Win10 with the Visual Studio Qt VS Tools Plugin.
Unless you make a subclass and implement to send signal on edit click
im not sure its possible. There seems to be no signal for user click on edit/text part.
You might be able to catch it using event filter.
But its very uncommon to have combobox run some function if you click it
so i much more like you idea of an Execute button. :)