How to implement an image control that displays network images and supports loading state.
-
wrote on 12 Oct 2023, 06:57 last edited by
May I ask if there is such a control now? If not, which control can be used to implement it: supporting the display of images by setting the URL and showing loading state during the image download process. Once the download is successful, the loading state disappears, and the downloaded image is displayed.
-
@SGaist Thank you for your answer! May I ask if there are any open source projects that can be referenced?
One possible simple implementation could be a QStackedWidget with an infinite QProgressBar as first widget and one QLabel to show the image as the second one.
When you start the download, you set the progress bar as current widget and when the download is done, you load the image in the QLabel and set it as current widget.
-
Hi,
If you are thinking of a pre-made widget in the Qt framework, then, no. You will have to implement that yourself.
Note that maybe KDE has something.
-
Hi,
If you are thinking of a pre-made widget in the Qt framework, then, no. You will have to implement that yourself.
Note that maybe KDE has something.
-
@SGaist Thank you for your answer! May I ask if there are any open source projects that can be referenced?
One possible simple implementation could be a QStackedWidget with an infinite QProgressBar as first widget and one QLabel to show the image as the second one.
When you start the download, you set the progress bar as current widget and when the download is done, you load the image in the QLabel and set it as current widget.
-
One possible simple implementation could be a QStackedWidget with an infinite QProgressBar as first widget and one QLabel to show the image as the second one.
When you start the download, you set the progress bar as current widget and when the download is done, you load the image in the QLabel and set it as current widget.
-
@Quella QPixmap is not a widget, so cannot be shown directly in UI
-
Q Quella has marked this topic as solved on 23 Oct 2023, 01:57
1/7