Hello everyone, I want to load two image at the same time when I run the program and one image can be moved by mouse over another image.Attachment 8281
Printable View
Hello everyone, I want to load two image at the same time when I run the program and one image can be moved by mouse over another image.Attachment 8281
Look at Qt's demos. There was such an example there.
Sorry, can you give me the link? I don't know Qt demos.
The program qtdemo is part of your Qt install. I do not know which particular demo code_err is referring to though.
Code:
#include <QtGui> int main(int argc, char **argv) { QGraphicsView view; QGraphicsScene scene; view.setScene(&scene); p2->setZValue(1); view.show(); return app.exec(); }
Sorry, this is my fault that I don't state this problem clearly. One of the image is the background and the other is the image that movable over the background image.
How can I do with this problem?
What sort of tool are you trying to make? Is this a sort of painting tool where the foreground image is brush/region cut from another image (your earlier thread) ?
Yes, it will be included in my previous tool (cutting image from the brush/region) but now I just try to create this new tool in separate file because I want to make sure that the code for swiping image by mouse can work before I merge them together.
My background image is created by stylesheet("border-image: url(/bc-black-ui.png);")
So I want to have another image to be over the image background and I can swipe it to left or to right by mouse. How can I code it?
Added after 8 minutes:
To Mr.wysota, when I run the code, there is an error that 'setItemFlag' : is not a memberof 'QGraphicsPixmapItem'. What might be my problem?
Sorry for making confuse.
I try to test this code with new file, still the problem is the same.
Code:
#include "testimage.h" #include <QApplication> #include <QtGui> int main(int argc, char **argv) { QGraphicsView view; QGraphicsScene scene; view.setScene(&scene); QGraphicsPixmapItem *p2 = scene.addPixmap(QPixmap(":/C:/Users/kimkeang/Pictures/blank-canvas.png")); p2->setZValue(1); view.show(); return app.exec(); }
What should be the problem? (My code is written in Visual Studio 2008 and I add Qt frame work version 4.8.2 )
use:-
instead of setItemFlag.