kdeplasma-addons: disregard the size of the kolourpicker applet for layout orientation

to match the orinetation of the panel for example

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-23 06:30:34 +03:00
parent e5755dcb77
commit 99528e7f11

View file

@ -305,17 +305,14 @@ void Kolourpicker::configChanged()
void Kolourpicker::constraintsEvent(Plasma::Constraints constraints) void Kolourpicker::constraintsEvent(Plasma::Constraints constraints)
{ {
if (constraints & Plasma::FormFactorConstraint) { if (constraints & Plasma::FormFactorConstraint) {
if (formFactor() == Plasma::Planar) { const Plasma::FormFactor formfactor = formFactor();
if (formfactor == Plasma::Planar) {
setBackgroundHints(Plasma::Applet::StandardBackground); setBackgroundHints(Plasma::Applet::StandardBackground);
} else { } else {
setBackgroundHints(Plasma::Applet::NoBackground); setBackgroundHints(Plasma::Applet::NoBackground);
} }
}
if (constraints & Plasma::FormFactorConstraint ||
constraints & Plasma::SizeConstraint) {
QGraphicsLinearLayout *l = dynamic_cast<QGraphicsLinearLayout *>(layout()); QGraphicsLinearLayout *l = dynamic_cast<QGraphicsLinearLayout *>(layout());
if (formFactor() == Plasma::Horizontal && size().height() < 40) { if (formfactor == Plasma::Horizontal) {
l->setOrientation(Qt::Horizontal); l->setOrientation(Qt::Horizontal);
} else { } else {
l->setOrientation(Qt::Vertical); l->setOrientation(Qt::Vertical);