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

Problem with Image Translation

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 942 Views 1 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.
  • C Offline
    C Offline
    clovisrep
    wrote on last edited by
    #1

    Hello everyone.

    I'm just beggining to use Qt's QTransform.
    I'm trying to translate a simple image but I can't do it! In the form, I have a label named "rulo" and a button wich triggers the following code when clicked.

    @void MainWindow::on_pushButton_clicked()
    {
    QImage canvas = QImage("/home/andresdido/Descargas/ruleta.png","PNM");

    // QImage canvas;
    QTransform translating;
    QImage trasladada;
    
    qreal ancho = (qreal) canvas.width()/2;
    qreal alto = (qreal) canvas.height()/2;
    
    translating.translate(ancho,alto);
    
    trasladada=canvas.transformed(translating);
    ui->rulo->setPixmap(QPixmap::fromImage(trasladada));
    
    return;
    

    }@

    Both QImage's, canvas and trasladada are just the same! Just as if the translation had no effect at all. (Obviously, both Qimage's also look the same, since their "data" is perfectly equal).

    Any ideas about why the translation has no effect? Thanks!

    1 Reply Last reply
    0
    • C Offline
      C Offline
      clovisrep
      wrote on last edited by
      #2

      I've found a similar problem here:

      http://stackoverflow.com/questions/16584285/qt-image-move-rotation

      But no one seems to have an answer for this :(

      Help!

      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