Skip to content

Commit

Permalink
fix: Custom wallpaper cannot be loaded
Browse files Browse the repository at this point in the history
Log: The actual format and suffix name of the image are inconsistent

Bug: https://pms.uniontech.com/bug-view-206843.html
  • Loading branch information
LiHua000 authored and deepin-bot[bot] committed Jul 3, 2023
1 parent 32fbe92 commit 196f7fc
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <QPainter>
#include <QPaintEvent>
#include <QRandomGenerator>
#include <QImageReader>

#include <xcb/xcb.h>
#include <X11/Xlib.h>
Expand Down Expand Up @@ -202,7 +203,14 @@ void SlideshowScreenSaver::initPixMap()
if (!m_playOrder.isEmpty()) {
if (m_shuffle)
randomImageIndex();
m_pixmap.reset(new QPixmap(m_playOrder.first()));
QPixmap pix(m_playOrder.first());
if(pix.isNull())
{
QImageReader reader(m_playOrder.first());
reader.setDecideFormatFromContent(true);
pix = QPixmap::fromImage(reader.read());
}
m_pixmap.reset(new QPixmap(pix));
scaledPixmap();
m_currentIndex = 1;
m_lastImage = m_playOrder.last();
Expand Down

0 comments on commit 196f7fc

Please sign in to comment.