Important: Please read the Qt Code of Conduct -

Drawing transformed child widgets

  • Hi everyone,

    I am trying to draw widgets with different transformations (scale, rotation) I know that you can accomplish this with QGraphicsScene and QProxyWidget but I have seen that you get similar results using something as simple as this:

    void Widget::paintEvent(QPaintEvent *event)
    QPainter painter(this);
    lbl->render(&painter, QPoint(100, 50));

    The problem I am facing is that lbl is rendered twice, first in your paintEvent, and if it is child of widget, it is also rendered with its normal geometry.
    I could make lbl parentless but I do not know if there is a better way to accomplish this or if there is something wrong in calling render inside paintEvent.

    thanks for your help,

    Xavier LLigadas

  • Lifetime Qt Champion

    Just a note, you can draw any widget using
    QApplication::style()->drawControl (...)

    If you hide lbl, maybe it will still render ?

Log in to reply