mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
kdeplasma-addons: adjust the size of the kolourpicker color button icon based on the button size
otherwise if the applet is resized to, say, 100x100 the icon would be still 16x16 - very small for applet with a 100x100 size Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
ac1690f9d0
commit
a7d2cad4a8
1 changed files with 10 additions and 0 deletions
|
@ -152,6 +152,7 @@ public:
|
||||||
ColorButton(QGraphicsWidget *parent);
|
ColorButton(QGraphicsWidget *parent);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void resizeEvent(QGraphicsSceneResizeEvent *event) final;
|
||||||
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) final;
|
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) final;
|
||||||
void dragMoveEvent(QGraphicsSceneDragDropEvent *event) final;
|
void dragMoveEvent(QGraphicsSceneDragDropEvent *event) final;
|
||||||
void dropEvent(QGraphicsSceneDragDropEvent *event) final;
|
void dropEvent(QGraphicsSceneDragDropEvent *event) final;
|
||||||
|
@ -191,6 +192,15 @@ void ColorButton::dropEvent(QGraphicsSceneDragDropEvent *event)
|
||||||
picker->addColor(color);
|
picker->addColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ColorButton::resizeEvent(QGraphicsSceneResizeEvent *event)
|
||||||
|
{
|
||||||
|
const QSizeF sizef = size();
|
||||||
|
const int minsize = qRound(qMin(sizef.width(), sizef.height())) - 4;
|
||||||
|
nativeWidget()->setIconSize(QSize(minsize, minsize));
|
||||||
|
Plasma::ToolButton::resizeEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Kolourpicker::Kolourpicker(QObject *parent, const QVariantList &args)
|
Kolourpicker::Kolourpicker(QObject *parent, const QVariantList &args)
|
||||||
: Plasma::Applet(parent, args),
|
: Plasma::Applet(parent, args),
|
||||||
m_grabWidget(0)
|
m_grabWidget(0)
|
||||||
|
|
Loading…
Add table
Reference in a new issue