I develop Qt Application with a touchscreen. I use a combobox to display a list of computer comports. It works fine with mouse event, when I want to select an item from the combobox. When I use touch event, the combobox pops up the dropdown scroll, but I can not select an item from it with touch event.
For example, I can not change the selection from COM4 to COM6 with finger touch, but I can change it with mouse click.
How can I use finger touch to select item of combobox? Here is how I set the combobox items:
ui->bx_port->addItems(SerialConnect::GetSerialPortList());
Related
I have a JavaFX Windows application that contains:
a Teacher screen (JavaFX scene), which exists on the first monitor.
a Student screen, which exists on a second monitor.
On the Student screen there are controls, such as buttons, that the student touches in order to click.
When the student does that (touches a button in order to click it), I don’t want the mouse cursor to move at all from where it resides on the Teacher screen.
How can I accomplish that? Thanks!
I want to keep focus on TextField. For example i am typing something then tap to button. The focus on TextField is moving to button, that's why keyboard is automatically hiding on Android. I am using Qt 5.9.2. Thanks in advance!
In Qt Quick Controls 2, each control has a focusPolicy property which determines how the control gets focus. The default for controls like Button is Qt.StrongFocus, which means that buttons get focus after being clicked or tabbed into. If you're seeing that a control has focus and you don't want it to, just set its focusPolicy to Qt.NoFocus:
focusPolicy: Qt.NoFocus
I would like to update the items in combobox as user click on it, so when it unfold it will show the latest items. What signal should I connect and use? Thanks.
I am using a QMainWindow with few QLineEdits and with some QPushButtons in it. When the focus is in a QLineEdit (if I type something in the QLineEdit) and if I press the F5 key, I want to show a QDialog.
That QDialog contains a QTableView. My question is, when I press the F5 key, I want to move the focus from the QLineEdit to the QTableView's cell. How can I achieve this?
Subclass QLineEdit and override keyPressEvent() to detect when the F5 key is pressed, or install an event filter on the QLineEdit.
If you create and show the dialog during the key event processing the dialog will automatically receive a focus in event and the first widget in the dialog that accepts focus will be the widget in focus. So either let the QTableView be the first widget, or explicitly give the focus to it using setFocus().
If the dialog is already constructed or is a non-modal dialog which is already open, you need a pointer to the dialog so that you can show it/give it the focus when the F5 key is pressed.
If you want to move to a certain cell in the QTableView you of course also need to know the cell associated with your QLineEdit.
I show context menu when user right clicks on row at TableView and select clicked item:
downloadContextMenu.popup()
tableView.selection.clear()
tableView.selection.select(row)
but TableView show selection only if I will move mouse to something else (i.e. button) after it. So, how to update TableView in this case?
downloadContextMenu is Menu
P.S. If I will do it by this:
tableView.selection.clear()
tableView.selection.select(row)
downloadContextMenu.popup()
I will have the same problem, but after next opening of context menu (open menu, then click outside to close it, then open again)