Unsolved Take pixmap of pressed button ?
-
Hey
How can I take a pixmap of a pressed button?
Regards
Dariusz -
@Dariusz What do you mean by "take pixmap"?
What about https://doc.qt.io/qt-5/qabstractbutton.html#icon-prop ? -
Well QWidget has a -grab() option if I'm not wrong to get a pixmap of widget. I want to take on of button when being pressed. To on the go generate icons.
-
so what does QPushbutton::grab() with default parameters do in your case? According to docs, it should do what you seem to want.
-
@Kent-Dorfman Grab would return it in natural state, but I need it in pressed state.
-
@Dariusz Then subclass QPushButton and override https://doc.qt.io/qt-5/qabstractbutton.html#mousePressEvent and grab the pixmap there.
-
@jsulm said in Take pixmap of pressed button ?:
@Dariusz Then subclass QPushButton and override https://doc.qt.io/qt-5/qabstractbutton.html#mousePressEvent and grab the pixmap there.
Hmm will give it a go. But I need to grab it before UI shows up to display it as icon in other areas.
-
@Dariusz said in Take pixmap of pressed button ?:
But I need to grab it before UI shows
I don't think you can do this as there is nothing to grab if nothing is shown. You would need to render to a buffer somehow, but I really don't know how you could do this.
-
Is there no way to initiate styleDelegate with pressed flag maybe?
Regards
Dariusz