Problem with Image Translation



  • 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!



  • 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!


Log in to reply
 

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