No transformation result with QImage transformed

  • Hi,
    I'm currently implementing a class that operates on Matrices based on QImage as described bellow. But even if I know from docs that Transformed returns a copy of the QImage, no transformation occurs.

    What is wrong with LineShift this please?


    MathMatrix::MathMatrix(const QString MName, const quint16 MCols, const quint16 MRows, const quint32 MColors):
        Name(MName),Cols(MCols),Rows(MRows),Colors( MColors)
         WorkMatrix = new QImage(Cols,Rows,QImage::Format_RGB32);
         Name = MName;
         Cols= MCols ;
         Rows = MRows;
         Colors  = MColors;
    void MathMatrix::LineShift(  int Offset)
       *WorkMatrix = WorkMatrix->transformed(QTransform().translate(0,Offset)) ;
    void MathMatrix::Fill(uint Value)


    class MathMatrix
        QString Name ;
        quint16 Cols;
        quint16 Rows ;
        quint32 Colors ;
        QImage *WorkMatrix;
        MathMatrix(const QString MName="Matrix Name", const quint16 MCols=8 , const quint16 MRows=8, const quint32 MColors=3);
        QString getName()   { return Name   ;}
        quint16 getCols()   { return Cols   ;}
        quint16 getRows()   { return Rows   ;}
        quint32 getColors() { return Colors ;}
        void Fill(uint Value);
        void Fill(QColor NamedColor);   
        void LineShift(int Offset);
        void TestMatrix();

    This class is called like this :

    ProjectMatrix::ProjectMatrix(const QString M_Name, const quint16 M_Cols, const quint16 M_Rows, const quint32 M_Colors)
        MathMatrix ProjMatrix(M_Name,M_Cols,M_Rows,M_Colors);
        ProjMatrix.SetLine(1,0xFF000001) ;
        ProjMatrix.LineShift( 1);

Log in to reply

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