Rajeshwar
Rajeshwar

Reputation: 11661

Detecting areas in an image. Overlapping Widgets in QT is it possible ?

I currently have an image say of a face displayed inside a QLabel and I would like to add two QPushButtons on the eye so that I would know when those buttons are pressed.I would like to have the buttons overlap the face so I would know that the user clicked on the eye. My question is if there is a Layout in QT that would allow overlapping of widgets. ?

Upvotes: 0

Views: 194

Answers (1)

John Phu Nguyen
John Phu Nguyen

Reputation: 319

You can set the parent of the QPushButtons to the QLabel, and then use setGeometry(x, y, w, h) to specify the QPushButton's location and size within the QLabel.

QPushButton * leftEyeButton = new QPushButton(ui->myLabel);
leftEyeButton ->setGeometry(5,10,20,20);

Upvotes: 2

Related Questions