Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Drawing transformed child widgets

Drawing transformed child widgets

Scheduled Pinned Locked Moved General and Desktop
transforms pain
2 Posts 2 Posters 1.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    XavierLL
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      If you hide lbl, maybe it will still render ?

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved