Nyaruko
Nyaruko

Reputation: 4499

Button floating on QWidget?

I have a QWidget which shows some images from the USB camera, is it possible to add some button in the widget so it will auto resize/move with the window?

I have tried to simply use new operator to create a button, and set its parent as my QWidget, however, it always show up at the left corner of my widget, How could I put it to other places and make it auto resize?

Upvotes: 1

Views: 2027

Answers (1)

Jablonski
Jablonski

Reputation: 18514

Of course window is 2D, but there is also z-value or z-order, which show some widget above all other widgets. You can change z-value with QWidget::raise()

Raises this widget to the top of the parent widget's stack.

After this call the widget will be visually in front of any overlapping sibling widgets.

Upvotes: 1

Related Questions