Skip to content

Commit

Permalink
fix: [customscreen] fix the actual format and suffix name of the imag…
Browse files Browse the repository at this point in the history
…e are inconsistent

The actual format and suffix name of the image are inconsistent

Log: The actual format and suffix name of the image are inconsistent
Bug: https://pms.uniontech.com/bug-view-276941.html
  • Loading branch information
pppanghu77 authored and deepin-bot[bot] committed Nov 12, 2024
1 parent ae6ff6e commit 136c0f0
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,14 @@ void SlideshowScreenSaver::onUpdateImage()
loadSlideshowImages();
}

m_pixmap.reset(new QPixmap(m_playOrder.value(m_currentIndex)));
QPixmap pix(m_playOrder.value(m_currentIndex));
if (pix.isNull()) {
QImageReader reader(m_playOrder.value(m_currentIndex));
reader.setDecideFormatFromContent(true);
pix = QPixmap::fromImage(reader.read());
}

m_pixmap.reset(new QPixmap(pix));

if (m_pixmap && !m_pixmap->isNull()) {
m_invaildPath.clear();
Expand Down Expand Up @@ -215,7 +222,15 @@ void SlideshowScreenSaver::initPixMap()
reader.setDecideFormatFromContent(true);
pix = QPixmap::fromImage(reader.read());
}

m_pixmap.reset(new QPixmap(pix));

if (m_pixmap && !m_pixmap->isNull()) {
m_invaildPath.clear();
} else {
m_invaildPath = m_playOrder.first();
qWarning() << "There is an issue with the format of the image" << m_invaildPath;
}
scaledPixmap();
m_currentIndex = 1;
m_lastImage = m_playOrder.last();
Expand Down

0 comments on commit 136c0f0

Please sign in to comment.