Solved How to splash screen a gif video
-
@mrjj itsworking sir,
Now i want to align the gif video to play at the centre of the screen.
QLayout *data = new QLayout;
data->alignment(Qt::AlignCenter);
QLabel *processLabel = new QLabel(NULL);
processLabel->setLayout(data);but it showed error . Note : these i am using it in main.cpp
-
@mrjj I found it sir,
i used
QLabel *processLabel = new QLabel(NULL);
processLabel->setAlignment(Qt::AlignCenter);Now my doubt is , Its not aligning at all.
-
This post is deleted! -
@ManiRon
HI
Thats the internal aligment :)I assume you mean to center window onthe screen / desktop
https://wiki.qt.io/How_to_Center_a_Window_on_the_Screen -
@mrjj its coming like this when i use code from the above mentioned link
-
@ManiRon
you do that on label ?anyway, you should set both alignments so movie is in center
-
This is my code
processLabel->setGeometry(
QStyle::alignedRect(
Qt::LeftToRight,
Qt::AlignCenter,
processLabel->size(),
qApp->desktop()->availableGeometry() -
@ManiRon
ok.
well u need to center the movie also or
set size of label to size of movie. -
i have to do both sir .
-
@ManiRon
well to be on safe size u can do that.
use resize to size label to width, height of movie -
@mrjj not getting your point
-
QMovie *movie = new QMovie("C:/Users/data/Documents/untitled14/200w.gif");
QLabel *processLabel = new QLabel(NULL);
processLabel->setMovie(movie);
movie->start();
processLabel->setWindowFlags(Qt::FramelessWindowHint);
processLabel->setGeometry(
QStyle::alignedRect(
Qt::RightToLeft,
Qt::AlignCenter,
processLabel->size(),
qApp->desktop()->availableGeometry()
));
processLabel->show();This Is my current code
-
@ManiRon
you can use
processLabel->resize( some width, some height )
and i told u how to center movie in label already -
Is this the one to center the movie
processLabel->setAlignment(Qt::AlignCenter);
for example,
I added this in my code,processLabel->resize(100,100);
error: invalid use of void expression
)
^It showed this error
-
@ManiRon
yes.
its AlignCenter = AlignVCenter | AlignHCenter -
@mrjj after giving this also the gif is not aligining
-
@ManiRon
ok. not sure what goes wrong then. -
@mrjj oh
-
@ManiRon
but if u just resize label, is movie not in the center then ? -
@mrjj said in How to splash screen a gif video:
resize
tried to resize but it throwed error
processLabel->resize(100,100);
error: invalid use of void expression
)
^It showed this error