generic: get QImage and QPixmap objects width and height via the specialized methods

QImage::size() and QPixmap::size() construct QSize object from the internal
width and height members

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-08-30 03:45:25 +03:00
parent 55428d34e1
commit 6ed94914fe
3 changed files with 8 additions and 8 deletions

View file

@ -879,8 +879,8 @@ void KStatusNotifierItemPrivate::minimizeRestore(bool show)
KDbusImageStruct KStatusNotifierItemPrivate::imageToStruct(const QImage &image)
{
KDbusImageStruct icon;
icon.width = image.size().width();
icon.height = image.size().height();
icon.width = image.width();
icon.height = image.height();
if (image.format() == QImage::Format_ARGB32) {
icon.data = QByteArray((const char*)image.constBits(), image.byteCount());
} else {

View file

@ -729,8 +729,8 @@ void KWindowSystem::setIcons( WId win, const QPixmap& icon, const QPixmap& miniI
NETWinInfo info( QX11Info::display(), win, QX11Info::appRootWindow(), 0 );
QImage img = icon.toImage().convertToFormat( QImage::Format_ARGB32 );
NETIcon ni;
ni.size.width = img.size().width();
ni.size.height = img.size().height();
ni.size.width = img.width();
ni.size.height = img.height();
ni.data = (unsigned char *) img.bits();
info.setIcon( ni, true );
if ( miniIcon.isNull() )
@ -738,8 +738,8 @@ void KWindowSystem::setIcons( WId win, const QPixmap& icon, const QPixmap& miniI
img = miniIcon.toImage().convertToFormat( QImage::Format_ARGB32 );
if ( img.isNull() )
return;
ni.size.width = img.size().width();
ni.size.height = img.size().height();
ni.size.width = img.width();
ni.size.height = img.height();
ni.data = (unsigned char *) img.bits();
info.setIcon( ni, false );
}

View file

@ -633,8 +633,8 @@ void SignalPlotter::drawWidget(QPainter *p, uint w, uint height, int horizontalS
h -= fontheight;
}
if (d->backgroundPixmap.isNull() ||
(uint)d->backgroundPixmap.size().height() != height ||
(uint)d->backgroundPixmap.size().width() != w) {
(uint)d->backgroundPixmap.height() != height ||
(uint)d->backgroundPixmap.width() != w) {
// recreate on resize etc
d->backgroundPixmap = QPixmap(w, height);
d->backgroundPixmap.fill(Qt::transparent);