P
P
PMoysak2018-05-16 17:29:55
Qt
PMoysak, 2018-05-16 17:29:55

How to make beautiful loading?

I want to make a loading image in my program. You know, that's when the .exe is just starting to load and a picture of the program appears with the progress of the download.
But how to do that?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
developerxyz, 2018-08-31
@developerxyz

This window is implemented in Qt using the QSplashScreen class
Create a QSplashScreen with a QPixmap for the background
Next, show this box AND set the text (this just shows the text, can be used between QSplashScreen::show(); and QSplashScreen::finish();

splashScreen.showMessage(
    /*const QString &message*/ "Сообщение",
    /*int alignment = Qt::AlignLeft*/ Положение текста,
    /*const QColor &color = Qt::black*/ Цвет QColor);

Text position - bitwise combination of vertical and horizontal alignment
Qt::Alignment
Horizontal alignment
ConstantMeaningDescription
Qt::AlignLeft0x0001Left alignment
Qt::AlignRight0x0002Right
alignment
Qt::AlignHCenter0x0004Center alignment
(horizontal)

Vertical alignment
ConstantMeaningDescription
Qt::AlignTop0x0020Top alignment
Qt::AlignBottom0x0040Bottom alignment
Qt::AlignVCenter0x0080Center alignment
(vertical)
A little more flags (English)
You can use no more than one key from one group.
Example: Qt::AlighVCenter | Qt::AlignHCenter - absolute center of the window
To finish QSplashScreen, call the finish function:
This function will wait for the mainWin window to be displayed and only after that QSplashScreen closes.
These are the simplest functions. If you need "something more complicated", then we take and create our own SplashScreen and draw it ourselves (just like in QWidget)
I hope that my answer helped you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question