Add method to set where we want to put the icon.Usefull for applet
Lock/Logout svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=734943
This commit is contained in:
parent
bb79a14a09
commit
1294c4e8a4
@ -59,6 +59,7 @@ Icon::Private::Private()
|
||||
iconSize(48, 48),
|
||||
state(Private::NoState),
|
||||
orientation(Qt::Vertical),
|
||||
alignment(Qt::AlignHCenter | Qt::AlignTop),
|
||||
calculateSizeRequested(true) // First time always true
|
||||
{
|
||||
svg.setContentType(Plasma::Svg::ImageSet);
|
||||
@ -546,7 +547,6 @@ QPixmap Icon::Private::decoration(const QStyleOptionGraphicsItem *option) const
|
||||
QPointF Icon::Private::iconPosition(const QStyleOptionGraphicsItem *option, const QPixmap &pixmap) const
|
||||
{
|
||||
const QRectF itemRect = subtractMargin(option->rect, Private::ItemMargin);
|
||||
Qt::Alignment alignment = Qt::AlignHCenter | Qt::AlignTop; // NOTE: This assumes always top-center -MB
|
||||
|
||||
// Compute the nominal decoration rectangle
|
||||
const QSizeF size = addMargin(iconSize, Private::IconMargin);
|
||||
@ -1008,6 +1008,11 @@ Qt::Orientations Icon::expandingDirections() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Icon::setAlignment(Qt::Alignment alignment)
|
||||
{
|
||||
d->alignment=alignment;
|
||||
}
|
||||
|
||||
/*
|
||||
QSizeF Icon::sizeHint() const
|
||||
{
|
||||
|
@ -147,6 +147,12 @@ public:
|
||||
*/
|
||||
void addAction(QAction* action);
|
||||
|
||||
/**
|
||||
* let set the position in layout area
|
||||
* @param action the QAction to associate with this icon.
|
||||
*/
|
||||
void setAlignment(Qt::Alignment alignment);
|
||||
|
||||
// Layout stuff - no need to document
|
||||
/*
|
||||
Qt::Orientations expandingDirections() const;
|
||||
|
@ -174,6 +174,7 @@ public:
|
||||
QIcon icon;
|
||||
ButtonState state;
|
||||
Qt::Orientation orientation;
|
||||
Qt::Alignment alignment;
|
||||
bool calculateSizeRequested;
|
||||
|
||||
QList<IconAction*> cornerActions;
|
||||
|
Loading…
Reference in New Issue
Block a user