class MainWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

protected:
    QImage obraz;

    void paintEvent(QPaintEvent*);
    void mouseMoveEvent(QMouseEvent* event);

// ...
};

// ...

void
MainWindow::paintEvent(QPaintEvent *)
{
    QPainter painter(this);
    painter.drawImage(0, 0, obraz);
}


void
MainWindow::mouseMoveEvent(QMouseEvent* event)
{

// operacje na tablicy z obraz.bits()

    repaint();
}

// ...

Add a code snippet to your website: www.paste.org