icon; doesn't actually work the way i expect it to. need to talk to bibr about some things.
svn path=/trunk/KDE/kdebase/workspace/lib/plasma/; revision=671576
This commit is contained in:
parent
60032d6779
commit
c2f7734144
@ -150,8 +150,8 @@ void Icon::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
||||
|
||||
|
||||
if (!d->icon.isNull()) {
|
||||
int deltaX = d->size.width() * 0.1;
|
||||
int deltaY = d->size.height() * 0.1;
|
||||
qreal deltaX = d->size.width() * 0.1;
|
||||
qreal deltaY = d->size.height() * 0.1;
|
||||
painter->drawPixmap(deltaX, deltaY, d->icon.pixmap((d->size * 0.9).toSize()));
|
||||
}
|
||||
|
||||
@ -214,6 +214,11 @@ QSizeF Icon::size() const
|
||||
return d->size;
|
||||
}
|
||||
|
||||
QSizeF Icon::iconSize() const
|
||||
{
|
||||
return d->size * .9;
|
||||
}
|
||||
|
||||
void Icon::setSize(const QSizeF& s)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
@ -322,6 +327,11 @@ void Icon::setGeometry(const QRectF &r)
|
||||
setPos(r.x(),r.y());
|
||||
}
|
||||
|
||||
int Icon::boundsForIconSize(int iconSize)
|
||||
{
|
||||
return iconSize * 1.1;
|
||||
}
|
||||
|
||||
} // namespace Plasma
|
||||
|
||||
#include "icon.moc"
|
||||
|
@ -48,6 +48,7 @@ class PLASMA_EXPORT Icon : public QObject,
|
||||
void setText(const QString &name);
|
||||
|
||||
QSizeF size() const;
|
||||
QSizeF iconSize() const;
|
||||
void setSize(const QSizeF& size);
|
||||
void setSize(int height, int width);
|
||||
|
||||
@ -55,7 +56,7 @@ class PLASMA_EXPORT Icon : public QObject,
|
||||
void setIcon(const QIcon& icon);
|
||||
|
||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
|
||||
QRectF boundingRect() const;
|
||||
QRectF boundingRect() const;
|
||||
|
||||
//layout stufff
|
||||
Qt::Orientations expandingDirections() const;
|
||||
@ -74,6 +75,8 @@ class PLASMA_EXPORT Icon : public QObject,
|
||||
|
||||
QSizeF sizeHint() const;
|
||||
|
||||
static int boundsForIconSize(int iconSize);
|
||||
|
||||
Q_SIGNALS:
|
||||
void pressed(bool down);
|
||||
void clicked();
|
||||
|
Loading…
Reference in New Issue
Block a user