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
Forum Updated to NodeBB v4.3 + New Features

Drawing transformed child widgets

Scheduled Pinned Locked Moved General and Desktop
transforms pain
2 Posts 2 Posters 871 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 18 Aug 2015, 06:25 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 20 Aug 2015, 08:45 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

      1/2

      18 Aug 2015, 06:25

      • Login

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