[solved]Qmovie+QImage in single window screen
-
hi all,
I am new to qt. This is dialog.cpp. In this dialog i created 2 text labels. one is for movie and another one is for image. if i am running this code, i am getting the result which one in last(now movie). in single screen i want movie above and below image. how to do it. please help me .
@Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);QImage *image = new QImage("/home/dev6/Desktop/animation/label1.jpg"); QLabel *label1 = new QLabel(this); label1->setPixmap(QPixmap::fromImage(*image)); //label1->show(); QMovie *movie = new QMovie("/home/dev6/Desktop/animation/spectrum.gif"); QLabel *processLabel = new QLabel(this); processLabel->setMovie(movie); movie->start();@
-
Hi,
You could use "move":http://qt-project.org/doc/qt-5/qwidget.html#pos-prop or "setGeometry":http://qt-project.org/doc/qt-5/qwidget.html#geometry-prop to specify a position for the widgets. Use it to change QLabel's positions since by default it goes to (0,0).
Or the best way would be to put these widgets in a layout. -
Hi and welcome to devnet,
Have a look at QVBoxLayout
Are you using designer to build your UI ?
-
yes i am using designer.
-
how to set. can you please explain
-
i am using designer. in dialog.ui i changed geometry. but still i have the same problem.
-
Please, practice some patience.
Add two labels in your UI inside a QVBoxLayout then set the QMovie and QImage on these labels, then you can remove the two you are creating with code
-
okay. in program i used setgeometry. now it is working fine. thanks to you all.
[quote author="SGaist" date="1411473715"]Please, practice some patience.Add two labels in your UI inside a QVBoxLayout then set the QMovie and QImage on these labels, then you can remove the two you are creating with code[/quote]
-
yes now it is working fine. thanks to you all.
[quote author="p3c0" date="1411462248"]Hi,You could use "move":http://qt-project.org/doc/qt-5/qwidget.html#pos-prop or "setGeometry":http://qt-project.org/doc/qt-5/qwidget.html#geometry-prop to specify a position for the widgets. Use it to change QLabel's positions since by default it goes to (0,0).
Or the best way would be to put these widgets in a layout.[/quote] -
Good.. Please mark the post as solved then. Also in future try to use Layouts where ever possible.
-
yes okay. in future i will use layouts. how to mark the post as solved.
[quote author="p3c0" date="1411533921"]Good.. Please mark the post as solved then. Also in future try to use Layouts where ever possible.[/quote]
-
Edit your original post and update the thread
-
okay done.