QPixmap in representation of data in the mem, so you don't display pixmap but view pixmap in i.e. qlabel. Do something like this:
px.load("image1.ext");
ui->label->setPixmap(px);
//and on button press
px.load("image2.ext");
//or
//QByteArray ByteArrayImage;
//px.loadFromData( ByteArrayImage );
ui->label->setPixmap(px);
QPixmap px;
px.load("image1.ext");
ui->label->setPixmap(px);
//and on button press
px.load("image2.ext");
//or
//QByteArray ByteArrayImage;
//px.loadFromData( ByteArrayImage );
ui->label->setPixmap(px);
To copy to clipboard, switch view to plain text mode
EDIT: You could use, on button press, something like this also:
ui->label->setScaledContents( false );
ui->label->update( ui->label->rect() );
ui->label->setScaledContents( true );
ui->label->setScaledContents( false );
ui->label->update( ui->label->rect() );
ui->label->setScaledContents( true );
To copy to clipboard, switch view to plain text mode
or repaint. If you don't setScaledContents(false) then true image don't show, assuming that scaledContents was true.
Bookmarks