From a5912810ef9a66ee5ae2de8ea4fb5d2905ad3390 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole-Andr=C3=A9=20Rodlie?= Date: Mon, 16 Dec 2024 00:31:42 +0100 Subject: [PATCH] Timeline: ui restore bug fix --- src/app/GUI/timelinewidget.cpp | 8 ++++---- src/app/GUI/timelinewidget.h | 2 +- src/ui/widgets/changewidthwidget.cpp | 6 ++++++ src/ui/widgets/changewidthwidget.h | 2 ++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/app/GUI/timelinewidget.cpp b/src/app/GUI/timelinewidget.cpp index e2ad44269..4208edcf8 100644 --- a/src/app/GUI/timelinewidget.cpp +++ b/src/app/GUI/timelinewidget.cpp @@ -302,9 +302,8 @@ TimelineWidget::TimelineWidget(Document &document, chww->raise(); connect(chww, &ChangeWidthWidget::widthSet, this, &TimelineWidget::setBoxesListWidth); - setBoxesListWidth(chww->getCurrentWidth()); - readSettings(); + readSettings(chww); } TimelineWidget::~TimelineWidget() @@ -513,11 +512,12 @@ void TimelineWidget::writeStateXEV(QDomElement& ele, QDomDocument& doc, ele.setAttribute("search", mSearchLine->text()); } -void TimelineWidget::readSettings() +void TimelineWidget::readSettings(ChangeWidthWidget *chww) { const auto tWidth = AppSupport::getSettings("ui", "TimeLineMenuWidth"); - if (tWidth.isValid()) { setBoxesListWidth(tWidth.toInt()); } + setBoxesListWidth(tWidth.isValid() ? tWidth.toInt() : chww->getCurrentWidth()); + if (tWidth.isValid()) { chww->setWidth(tWidth.toInt()); } } void TimelineWidget::writeSettings() diff --git a/src/app/GUI/timelinewidget.h b/src/app/GUI/timelinewidget.h index af87fd0ff..40a2125a1 100644 --- a/src/app/GUI/timelinewidget.h +++ b/src/app/GUI/timelinewidget.h @@ -83,7 +83,7 @@ class TimelineWidget : public QWidget { RuntimeIdToWriteId& objListIdConv); void writeStateXEV(QDomElement& ele, QDomDocument& doc, RuntimeIdToWriteId& objListIdConv) const; - void readSettings(); + void readSettings(ChangeWidthWidget *chww); void writeSettings(); private: diff --git a/src/ui/widgets/changewidthwidget.cpp b/src/ui/widgets/changewidthwidget.cpp index 824f4a3fe..b9c408eeb 100644 --- a/src/ui/widgets/changewidthwidget.cpp +++ b/src/ui/widgets/changewidthwidget.cpp @@ -82,3 +82,9 @@ void ChangeWidthWidget::leaveEvent(QEvent *) { mHover = false; update(); } + +void ChangeWidthWidget::setWidth(int w) +{ + mCurrentWidth = w; + updatePos(); +} diff --git a/src/ui/widgets/changewidthwidget.h b/src/ui/widgets/changewidthwidget.h index 480221849..8b2d0aaf7 100644 --- a/src/ui/widgets/changewidthwidget.h +++ b/src/ui/widgets/changewidthwidget.h @@ -52,6 +52,8 @@ class UI_EXPORT ChangeWidthWidget : public QWidget return mCurrentWidth; } + void setWidth(int w); + signals: void widthSet(int);