QML ListView Delegates z-order are always on top of everything else - qt

I have a QML ListView with a custom widget (I call it PayloadOdometerRecord) as a delegate. This PayloadOdometerRecord contains a couple of other custom widgets (TextBox) that when clicked will change state and display a keyboard for user input.
The ListView works correctly until the user clicks one of these TextBox widgets to display the keyboard. The keyboard gets clipped by all of the delegates below the delegate that is displaying the keyboard.
When using this TextBox widget in a non-ListView, it works correctly...the keyboard is fully visible.
Does anyone have any idea why this is happening? My goal is to have a full-screen keyboard that shows up and is not covered by any other components.
Thanks!

Can you show some code? What is the parent of your keyboard component?
Z works only between siblings. The keyboard should be a child of the root element and have a higher z value than the other children of root to make it work.

If there are other components in front of the keyboard, you can try to set the keyboards z-property to a large value (e.g. 1000) → Qt Doc

Related

qml how to keep focus on TextField

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

What Object has Active Focus in QML?

i have a complex GUI with QML but in some situation i lost my focus and i don't know what object has active focus.
Is there any tools or ways to search in QML files and find focused Object?
I use this line to see which item has active focus:
Window {
onActiveFocusItemChanged: print("activeFocusItem", activeFocusItem)
}
This code responds to changes in the activeFocusItem property of Window by printing out the item with active focus. ApplicationWindow from Qt Quick Controls 1 and 2 have the same property since they derive from Window.
To find out how an item got focus, you can set the QT_LOGGING_RULES environment variable to qt.quick.focus = true. This enables logging for Qt's internal focus handling. The output can be a bit tricky to follow though..
Since you're using Qt Quick Controls 2, it's worth noting that 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

Is there a way to show tooltip on disabled QWidget

I have a Qt form, where I have a button and menu. For various reasons I can disable certain elements, e.g button or some actions in the menu.
Is there a way I could show a tooltip or when the mouse is hovered over the disabled button or menu item with an explanation as to why it is disabled?
I am using Qt 4.8.
Thanks!
You can set the tooltip dynamically based on the state of the QWidget or by simply toggling both at the same time. Upon disabling/enabling the widget from somewhere just call QWidget::setToolTip(...) with the QString you want the tooltip to display when hovering with the mouse over the given widget. For example if you have a public slot called toggleButton(bool toggleFlag) which toggles the enable-setting of a button you can do:
void MyWidget::toggleButton(bool toggleFlag) {
this->ui->myButton->setEnabled(toggleFlag);
this->ui->myButton->setToolTip(toggleFlag ? QString("Enabled wohoo!") : QString("Disabled because I like it"));
}
You can of course do also change the tooltip by calling QWidget::isEnabled() and act upon its return value. Since you haven't given any code I can only assume how you toggle your button(s) so that's all I can give you for now.
UPDATE: It was pointed in the comments that tooltips don't work with disabled widgets due not receiving mouse events. Both statements are not true (note that I have used the same tooltip message since due to lack of minimal working example I didn't want to write a whole new project from scratch and used an existing one of mine instead):
Hovering a disabled button triggers the tooltip
Hovering an enabled button triggers the tooltip

Context Menu of TableView in Child Widget

I am programming in C++ in QT and trying to make a UI with dynamic tabs having tables inside each of them. For doing the same, I had my TabWidget in the main window, and another widget with just the tableView. As the tabs are dynamically being added to the main window by a button click, I make a new object of my widget and put it in that.
I also have another version of the application in which there are no tabs, just a tableView in the main window.
I am unable to open the context menu in the former case, while it works perfectly for the latter.
I am using the signal "customContextMenuRequested" in both the cases. Don't understand what I need to add for it to work when the tableView is in a child widget.
Some help please?
Thanks already!
Did you check that nothing is involving QAbstractScrollArea, it's possible that in this case it would signal/slot as expected.
This signal is emitted when the widget's contextMenuPolicy is Qt::CustomContextMenu, and the user has requested a context menu on the widget. The position pos is the position of the context menu event that the widget receives. Normally this is in widget coordinates. The exception to this rule is QAbstractScrollArea and its subclasses that map the context menu event to coordinates of the viewport() .

How to make a QLabel turn to be a combobox or edit control, when you clicked this label

It looks like a label normally, once you move the mouse over it, or clicked it, then will turn to be a edit control or combobox likewise.
Use a QStackedWidget. According to the docs, "The QStackedWidget class provides a stack of widgets where only one widget is visible at a time." You can then reimplement QWidget::enterEvent and QWidget::leaveEvent to detect mouse overs and show the appropriate widget.

Resources