April 25, 2011

audrensitas audrensitas
Lab Rat
16 posts

QMovie help


Do someone know how to set location of QMovie object ? I added animated gif to this function and when i start my program it shows my animation on top left, but i tried with setGeometry and also setAlignment but it gave no results.

Also, do someone know how to connect this QMovie animation with QPushButton, that i click my animated duck and it disappear or does something else??

  1. void CFrameWnd::SukurtiAnti()
  2. {
  3. QMovie *movie = new QMovie(":/Antis/paveiksl/duck1111.gif");
  4. QLabel *processLabel = new QLabel(this);
  5. processLabel->setMovie(movie);
  6. //processLabel->setGeometry(10,5,55,39);
  7. //processLabel->setAlignment(Qt::AlignBottom);
  8. movie->start();
  12. QPushButton *button = new QPushButton(this);
  13. ui->toolBar->addWidget(button);
  14. button->setStyleSheet("background-image: url(:/Antis/paveiksl/duck1111.gif)");
  15. }

Here is screenshot of my duck position. http://img684.imageshack.us/i/screenshotafj.png/

2 replies

April 26, 2011

Flux Flux
Lab Rat
125 posts

Has “this” a layout? Just my guess…

April 26, 2011

Andre Andre
Robot Herder
6608 posts

This has nothing to do with QMovie. Just use a layout to manage the geometry of your widget. You can position the label any place you want it in the parent widget. It seems that you already are using Qt Designer and ui files. Why not add the QLabel you want to use for your movie there, put it in the layout you like, and simply reference the label instead of creating a new one in the code you are showing?

  ‹‹ Qt Button Create      Jambi synchronisation problem ››

You must log in to post a reply. Not a member yet? Register here!