PDA

View Full Version : MouseButtonRelease only works once on Linux



leinad
5th February 2020, 16:27
Hi,

I have an event Filter for a comboBox. The issue I'm having is when I use mouseButtonRelease and select the drop down arrow, it only catches the signal if there is no data in the combo box. This is true only on Linux/MAC Linux. Once data is loaded the signal is not caught. On windows it works just fine.

If I use MouseButtonPress then it always works but the dropdown bounces back up after I release the mouse button to make a selection. This is why I prefer to use MouseButtonRelease unless there is a better alternative.

Any ideas?

//Assign event filter to the comboBox
ui->ipStringValueComboBox->installEventFilter(this);


Further down:
bool MainWindow::eventFilter(QObject *object, QEvent *event)
{

if(event->type() == QEvent::MouseButtonRelease)
{
if(object == ui->ipStringValueComboBox)
IPComboBoxClicked();

return true;
}
else
return false;

}

void MainWindow::IPComboBoxClicked()
{
//do some stuff
ui->ipStringValueComboBox->showPopup();

}

Thanks again.

^NyAw^
6th February 2020, 16:51
Hi,

It will be easier to connect one of the QComboBox signals available to a slot.