I have a QDialog which has a layout, in this layout there are multiple QWidgets. Now I have a button, if the user presses this button I want to display a "tooltip" which displays some more information. This "tooltip" has to contain a layout.
For this I wanted to use a QWidget with an absolute position. When I put together the code mentioned in this question the solution does not work for me. I have also tried to use the QtWidget.raise_() function but the QWidget is not being displayed.
I stripped down my code to the following example:
# creating content layout = QtWidgets.QVBoxLayout() for i in range(0, 10): layout.addWidget(QtWidgets.QLabel("line {} - bla bla bla bla bla bla".format(i))) widget = QtWidgets.QWidget() widget.setLayout(layout) # creating dialog and apply the layout dialog = QtWidgets.QDialog() dialog.setLayout(layout) # creating the absolute positioned widget absolute_layout = QtWidgets.QVBoxLayout() absolute_layout.addWidget(QtWidgets.QLabel("Absolute positioned QWidget")) absolute_layout.addWidget(QtWidgets.QLabel("With some widgets in itself")) absolute_layout.addWidget(QtWidgets.QLabel("With some widgets in itself")) absolute_layout.addWidget(QtWidgets.QLabel("With some widgets in itself")) absolute = QtWidgets.QWidget(dialog) absolute.setLayout(absolute_layout) # show the absolute widget and move it absolute.show() absolute.move(10, 10) absolute.raise_() dialog.show() The dialog is shown correctly with the content in the layout but the absolute is not being shown.
What am I doing wrong?
<table>for laying out the text.QLayoutobject in this "tooltip", this layout contains some custom widgets. With using html I cannot achieve the result I want to have.