kcms/screenedges: Fix buttons overlap on a too narrow vertical screen
BUG: 475579
This commit is contained in:
parent
6c67b73b7d
commit
264b054c5c
3 changed files with 23 additions and 0 deletions
|
@ -55,6 +55,7 @@ Monitor::Monitor(QWidget *parent)
|
|||
m_actionGroups[i] = std::make_unique<QActionGroup>(this);
|
||||
}
|
||||
QRect avail = screenFromWidget(this)->geometry();
|
||||
setMinimumContentWidth(20 * 3 + 5 * 2); // 3 buttons in a row and some spacing between them
|
||||
setRatio((qreal)avail.width() / (qreal)avail.height());
|
||||
checkSize();
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ public:
|
|||
ScreenPreviewWidgetPrivate(ScreenPreviewWidget *screen)
|
||||
: q(screen)
|
||||
, ratio(1)
|
||||
, minimumContentWidth(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -48,6 +49,11 @@ public:
|
|||
return;
|
||||
}
|
||||
|
||||
const auto minFrameWidth = minimumContentWidth + screenGraphics->marginSize(KSvg::FrameSvg::LeftMargin) + screenGraphics->marginSize(KSvg::FrameSvg::RightMargin);
|
||||
if (monitorSize.width() < minFrameWidth) {
|
||||
monitorSize.setWidth(minFrameWidth);
|
||||
}
|
||||
|
||||
monitorRect = QRect(QPoint(0, 0), monitorSize.toSize());
|
||||
monitorRect.moveCenter(bounds.center());
|
||||
|
||||
|
@ -63,6 +69,7 @@ public:
|
|||
QPixmap preview;
|
||||
QRect monitorRect;
|
||||
qreal ratio;
|
||||
qreal minimumContentWidth;
|
||||
QRect previewRect;
|
||||
};
|
||||
|
||||
|
@ -103,6 +110,17 @@ qreal ScreenPreviewWidget::ratio() const
|
|||
return d->ratio;
|
||||
}
|
||||
|
||||
void ScreenPreviewWidget::setMinimumContentWidth(const qreal minw)
|
||||
{
|
||||
d->minimumContentWidth = minw;
|
||||
d->updateScreenGraphics();
|
||||
}
|
||||
|
||||
qreal ScreenPreviewWidget::minimumContentWidth() const
|
||||
{
|
||||
return d->minimumContentWidth;
|
||||
}
|
||||
|
||||
QRect ScreenPreviewWidget::previewRect() const
|
||||
{
|
||||
return d->previewRect;
|
||||
|
|
|
@ -24,9 +24,13 @@ public:
|
|||
|
||||
void setPreview(const QPixmap &preview);
|
||||
const QPixmap preview() const;
|
||||
|
||||
void setRatio(const qreal ratio);
|
||||
qreal ratio() const;
|
||||
|
||||
void setMinimumContentWidth(qreal minw);
|
||||
qreal minimumContentWidth() const;
|
||||
|
||||
QRect previewRect() const;
|
||||
KSvg::ImageSet *svgImageSet() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue