yolo
yolo

Reputation: 2795

Qt4: QLabel -> QPixmap -> click to open URL

I have a QLabel without any text but with a QPixmap image. I can not figure out a way to open a url when the user clicks the image. I can not use text in QLabel here.

Upvotes: 3

Views: 2172

Answers (2)

Frank Osterfeld
Frank Osterfeld

Reputation: 25155

You could install an event filter on the label and filter for mouse press events. For an example, see my answer to a similar question.

Upvotes: 1

Wes Hardaker
Wes Hardaker

Reputation: 22262

You don't need to put text in, but you do need to switch to either a subclassed label or to use a QPushButton instead. If you use a QPushButton (which is the easiest) then you can change the relief layout so it looks flat again (since the default button doesn't).

Upvotes: 3

Related Questions