mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 10:52:51 +00:00
plasma: set the keyboard applet minimum size, based on form factor
because it is painted as pixmap setting the minimum size is a must Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
04d081086c
commit
7bc2872f69
2 changed files with 27 additions and 0 deletions
|
@ -153,6 +153,29 @@ void KeyboardApplet::wheelEvent(QGraphicsSceneWheelEvent *event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void KeyboardApplet::constraintsEvent(Plasma::Constraints constraints)
|
||||||
|
{
|
||||||
|
if (constraints & Plasma::FormFactorConstraint) {
|
||||||
|
int iconsize = 0;
|
||||||
|
switch (formFactor()) {
|
||||||
|
case Plasma::FormFactor::Planar:
|
||||||
|
case Plasma::FormFactor::MediaCenter:
|
||||||
|
case Plasma::FormFactor::Application: {
|
||||||
|
// desktop-like
|
||||||
|
iconsize = KIconLoader::global()->currentSize(KIconLoader::Desktop);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Plasma::FormFactor::Horizontal:
|
||||||
|
case Plasma::FormFactor::Vertical: {
|
||||||
|
// panel
|
||||||
|
iconsize = KIconLoader::global()->currentSize(KIconLoader::Panel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setMinimumSize(iconsize, iconsize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void KeyboardApplet::slotLayoutChanged()
|
void KeyboardApplet::slotLayoutChanged()
|
||||||
{
|
{
|
||||||
const QList<KKeyboardType> layouts = m_keyboardlayout->layouts();
|
const QList<KKeyboardType> layouts = m_keyboardlayout->layouts();
|
||||||
|
|
|
@ -42,6 +42,10 @@ public:
|
||||||
void mousePressEvent(QGraphicsSceneMouseEvent *event) final;
|
void mousePressEvent(QGraphicsSceneMouseEvent *event) final;
|
||||||
void wheelEvent(QGraphicsSceneWheelEvent *event) final;
|
void wheelEvent(QGraphicsSceneWheelEvent *event) final;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// Plasma::Applet reimplementation
|
||||||
|
void constraintsEvent(Plasma::Constraints constraints) final;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void slotLayoutChanged();
|
void slotLayoutChanged();
|
||||||
void slotNextLayout();
|
void slotNextLayout();
|
||||||
|
|
Loading…
Add table
Reference in a new issue