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)
    {
    Q_UNUSED(event)
    QPainter painter(this);
    painter.scale(2,2);
    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


  • Qt Champions 2016

    hi
    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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.