PDA

View Full Version : Expanded QComboBox Prevents QPushButton Clicks



sean8051
29th August 2016, 19:12
Hello,

When using a touchscreen, leaving a QComboBox expanded and then clicking on a QPushButton leaves the button depressed and prevents the clicked() signal from being emitted from the button. pressed() works as documented but released() only takes effect when some other user input is performed. I was able to replicate this behavior using only automated clicks, no touchscreen required. The attached file is a small project with a "Run" button that goes through the steps that should cause the issue. Going through the same steps with a mouse produces the expected effects.

I've noticed that splitting the automated mouse press from the mouse release doesn't change the behavior but placing a QApplication::processEvents() call between the press and release (see code snippet) causes the pushbutton to correctly emit clicks() but I have no idea why this is the case. It's possible to go through the application and change the connections using clicked() to pressed() but this would leave the buttons depressed and I'd like to know if you have any input on why this is happening.

Produced on Qt 5.5.1, Windows 7 and 10

Thanks,
Sean



{
INPUT input;
input.type = INPUT_MOUSE;
input.mi.mouseData = 0;
input.mi.dx = point.x() * ( 65536.0 / GetSystemMetrics( SM_CXSCREEN ) );
input.mi.dy = point.y() * ( 65536.0 / GetSystemMetrics( SM_CYSCREEN ) );
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | MOUSEEVENTF_LEFTDOWN ;
input.mi.mouseData = 0;
input.mi.time = 0;
SendInput( 1, &input, sizeof( input ) );
}

QApplication::processEvents();

{
INPUT input;
input.type = INPUT_MOUSE;
input.mi.mouseData = 0;
input.mi.dx = point.x() * ( 65536.0 / GetSystemMetrics( SM_CXSCREEN ) );
input.mi.dy = point.y() * ( 65536.0 / GetSystemMetrics( SM_CYSCREEN ) );
input.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | MOUSEEVENTF_LEFTUP;
input.mi.mouseData = 0;
input.mi.time = 0;
SendInput( 1, &input, sizeof( input ) );
}


12101

sean8051
9th September 2016, 20:04
It looks like this is a known problem in Qt with Windows currently without a fix.

https://bugreports.qt.io/browse/QTBUG-52257?jql=text%20~%20%22combobox%20touch%22

Sean