My class uses QWidget and I’ve got some QPushButtons there and I’d like to set a QLabel on top of each button, which are set on the window by move() but QLabel doesn’t want to move…
I use setMargin but it moves it from left to right, but not up or down.
There’s an example of my code:
self.btn = QPushButton(QIcon(),"Show table", self)
self.btn.move(360, 10)
self.btn.resize(100, 20)
self.btn.clicked.connect(self.doAction)
self.label = QLabel("Here comes the boom")
layout_LineEdit = QVBoxLayout()
layout_LineEdit.addWidget(self.label)
self.setLayout(layout_LineEdit)
Add a moveEvent to your class and connect move signal to your slot, your slot should be a function that change your widget’s geometry via:
your SLOT function:
and connect them as below: