How do I create an image comparator in qt?
I have two images--img1 and img2--and I would like to be able to compare both images. I would like to overlay them over each other with a slider which would let me see more of img1 or img2. Lastl开发者_如何学Goy, when I move in one image I would also like to move in the other img. This is what I have so far.
QGraphicsScene *scn = new QGraphicsScene( this );
ui->view->setScene( scn );
QPixmap *im = new QPixmap("P3C.jpg");
QPixmap *i = new QPixmap("result.jpg");
scn->addPixmap( *im );
scn->addPixmap(*i);
Use QGraphicsItemGroup
to group the 2 pixmap items so they will act as one. Set the item group to ItemIsMovable
so you can move them.
Set the opacity
of the item that is on top of the other so the bottom one can show thru. You can connect the value change signal of your slider widget to your object's slot to control the opacity.
精彩评论