mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
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:
parent
55428d34e1
commit
6ed94914fe
3 changed files with 8 additions and 8 deletions
|
@ -879,8 +879,8 @@ void KStatusNotifierItemPrivate::minimizeRestore(bool show)
|
||||||
KDbusImageStruct KStatusNotifierItemPrivate::imageToStruct(const QImage &image)
|
KDbusImageStruct KStatusNotifierItemPrivate::imageToStruct(const QImage &image)
|
||||||
{
|
{
|
||||||
KDbusImageStruct icon;
|
KDbusImageStruct icon;
|
||||||
icon.width = image.size().width();
|
icon.width = image.width();
|
||||||
icon.height = image.size().height();
|
icon.height = image.height();
|
||||||
if (image.format() == QImage::Format_ARGB32) {
|
if (image.format() == QImage::Format_ARGB32) {
|
||||||
icon.data = QByteArray((const char*)image.constBits(), image.byteCount());
|
icon.data = QByteArray((const char*)image.constBits(), image.byteCount());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -729,8 +729,8 @@ void KWindowSystem::setIcons( WId win, const QPixmap& icon, const QPixmap& miniI
|
||||||
NETWinInfo info( QX11Info::display(), win, QX11Info::appRootWindow(), 0 );
|
NETWinInfo info( QX11Info::display(), win, QX11Info::appRootWindow(), 0 );
|
||||||
QImage img = icon.toImage().convertToFormat( QImage::Format_ARGB32 );
|
QImage img = icon.toImage().convertToFormat( QImage::Format_ARGB32 );
|
||||||
NETIcon ni;
|
NETIcon ni;
|
||||||
ni.size.width = img.size().width();
|
ni.size.width = img.width();
|
||||||
ni.size.height = img.size().height();
|
ni.size.height = img.height();
|
||||||
ni.data = (unsigned char *) img.bits();
|
ni.data = (unsigned char *) img.bits();
|
||||||
info.setIcon( ni, true );
|
info.setIcon( ni, true );
|
||||||
if ( miniIcon.isNull() )
|
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 );
|
img = miniIcon.toImage().convertToFormat( QImage::Format_ARGB32 );
|
||||||
if ( img.isNull() )
|
if ( img.isNull() )
|
||||||
return;
|
return;
|
||||||
ni.size.width = img.size().width();
|
ni.size.width = img.width();
|
||||||
ni.size.height = img.size().height();
|
ni.size.height = img.height();
|
||||||
ni.data = (unsigned char *) img.bits();
|
ni.data = (unsigned char *) img.bits();
|
||||||
info.setIcon( ni, false );
|
info.setIcon( ni, false );
|
||||||
}
|
}
|
||||||
|
|
|
@ -633,8 +633,8 @@ void SignalPlotter::drawWidget(QPainter *p, uint w, uint height, int horizontalS
|
||||||
h -= fontheight;
|
h -= fontheight;
|
||||||
}
|
}
|
||||||
if (d->backgroundPixmap.isNull() ||
|
if (d->backgroundPixmap.isNull() ||
|
||||||
(uint)d->backgroundPixmap.size().height() != height ||
|
(uint)d->backgroundPixmap.height() != height ||
|
||||||
(uint)d->backgroundPixmap.size().width() != w) {
|
(uint)d->backgroundPixmap.width() != w) {
|
||||||
// recreate on resize etc
|
// recreate on resize etc
|
||||||
d->backgroundPixmap = QPixmap(w, height);
|
d->backgroundPixmap = QPixmap(w, height);
|
||||||
d->backgroundPixmap.fill(Qt::transparent);
|
d->backgroundPixmap.fill(Qt::transparent);
|
||||||
|
|
Loading…
Add table
Reference in a new issue