You are not logged in.

Dear visitor, welcome to If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.


Wednesday, January 19th 2011, 9:59pm


Hello to all,

oh yes i am a further beginner,

here my problem,

i try to move an image (as label) through a window, there must be a way to display the changing of the x, y coordinates (of the labelposition).

my code so far:
#include <QApplication>
#include <QWidget>
#include <QImage>
#include <QLabel>
#include <stdio.h>

int main(int argc, char *argv[])
QApplication anwendung(argc, argv);
QWidget hauptfenster;
QPalette palette;
hauptfenster.resize(1024, 768);
palette.setBrush(hauptfenster.backgroundRole(), QBrush(QImage("man_1.bmp")));
QLabel label("", &hauptfenster);
QImage* image = new QImage("giggle.png");
label.setPixmap(QPixmap::fromImage(*image, Qt::AutoColor));
label.setGeometry(100, 100, 164, 180);
//label.setFrameStyle( QFrame::Panel | QFrame::Sunken );;
return anwendung.exec();

So far it works, it shows a picture (as label) in a window.
I'd like to change the position simply in a loop, if possible.
Please do not answere with too much stuff about existing classes and their possibilities,
I've found a lot about how to solve problems like this, usually by using "connect signal and slot",
i've also found the link to the possabilities of "QMovie".

I'd prefer an easier way, i'd like to get a simple way to manipulate the x and y coordinates of label.
For example: the changing of the x-coordinate comes from a simple subroutine, so that the picture moves between left and right border.

thanks from out of the past to your presence, while reading this, thanks for answeres


This post has been edited 2 times, last edit by "colorhead" (Jan 20th 2011, 7:49am)