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.Capture.jpg
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.Capture.jpg
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.
Qt Code:
#include <QtGui> int main(int argc, char **argv) { QGraphicsView view; QGraphicsScene scene; view.setScene(&scene); p2->setZValue(1); view.show(); return app.exec(); }To copy to clipboard, switch view to plain text mode
chong_kimkeang (5th October 2012)
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?
Last edited by chong_kimkeang; 5th October 2012 at 03:23.
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) ?
chong_kimkeang (5th October 2012)
chong_kimkeang (5th October 2012)
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.
Last edited by chong_kimkeang; 5th October 2012 at 08:39.
I try to test this code with new file, still the problem is the same.
Qt 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(); }To copy to clipboard, switch view to plain text mode
What should be the problem? (My code is written in Visual Studio 2008 and I add Qt frame work version 4.8.2 )
use:-
Qt Code:
To copy to clipboard, switch view to plain text mode
instead of setItemFlag.
Heavy Metal Rules. For those about to rock, we salute you.
HIT THANKS IF I HELPED.
chong_kimkeang (5th October 2012)
Bookmarks