mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-23 10:22:49 +00:00
plasma: set the preferred size of lockout applet widgets
because the panel containment, for example, resizes the applet to the preferred size when the sizeHintChanged() signal is emitted. this makes the applet stretch well in panels Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
16ce0e0ea5
commit
5f2df7ae2c
2 changed files with 13 additions and 5 deletions
|
@ -152,16 +152,16 @@ void DigitalClockApplet::constraintsEvent(Plasma::Constraints constraints)
|
|||
if (constraints && Plasma::SizeConstraint || constraints & Plasma::FormFactorConstraint) {
|
||||
switch (formFactor()) {
|
||||
// panel
|
||||
case Plasma::FormFactor::Vertical: {
|
||||
setMinimumSize(0, 0);
|
||||
setPreferredSize(kClockSize(contentsRect(), m_clockstring, true));
|
||||
break;
|
||||
}
|
||||
case Plasma::FormFactor::Horizontal: {
|
||||
setMinimumSize(0, 0);
|
||||
setPreferredSize(kClockSize(contentsRect(), m_clockstring, false));
|
||||
break;
|
||||
}
|
||||
case Plasma::FormFactor::Vertical: {
|
||||
setMinimumSize(0, 0);
|
||||
setPreferredSize(kClockSize(contentsRect(), m_clockstring, true));
|
||||
break;
|
||||
}
|
||||
// desktop-like
|
||||
default: {
|
||||
setMinimumSize(kClockSize(QRect(), m_clockstring, false));
|
||||
|
|
|
@ -426,6 +426,14 @@ void LockoutApplet::updateSizes()
|
|||
break;
|
||||
}
|
||||
}
|
||||
const QSizeF contentsrect = contentsRect().size();
|
||||
const qreal iconsizereal = qMin(contentsrect.width(), contentsrect.height());
|
||||
const QSizeF iconsizef = QSizeF(iconsizereal, iconsizereal);
|
||||
m_switchwidget->setPreferredSize(iconsizef);
|
||||
m_shutdownwidget->setPreferredSize(iconsizef);
|
||||
m_toramwidget->setPreferredSize(iconsizef);
|
||||
m_todiskwidget->setPreferredSize(iconsizef);
|
||||
m_hybridwidget->setPreferredSize(iconsizef);
|
||||
emit sizeHintChanged(Qt::PreferredSize);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue