Partially fix bug Debian BTS #992236 (width of DayNavigatorWidget).
authorPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 18 Aug 2021 17:56:32 +0000 (19:56 +0200)
committerPhilipp Spitzer <philipp@spitzer.priv.at>
Wed, 18 Aug 2021 17:56:32 +0000 (19:56 +0200)
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992236
Could be reproduced by setting environment variable QT_FONT_DPI to 200.

src/gui/daynavigatorwidget.cpp
src/gui/daynavigatorwidget.h
src/gui/mainwindow.ui

index b35f915f159c3abb298fcbfd6276a77f6315962b..dda40a629975ba18996d2b3e3126b07b78a1c0c3 100644 (file)
@@ -83,6 +83,14 @@ void DayNavigatorWidget::unsetDates() {
     this->update();
 }
 
     this->update();
 }
 
+QSize DayNavigatorWidget::minimumSizeHint() const {
+#ifdef MAEMO
+    return QSize(20, 0);
+#else
+    return QSize(fontMetrics().lineSpacing() * 3 / 2, 0);
+#endif
+}
+
 
 void DayNavigatorWidget::configureNavigation() {
     prevDayButton->setDisabled(!mStartDate.isValid() || mCurDate == mStartDate);
 
 void DayNavigatorWidget::configureNavigation() {
     prevDayButton->setDisabled(!mStartDate.isValid() || mCurDate == mStartDate);
index c89360556e08116350a18db8169d5197ec4d7cb7..c1529ed85c3574c1eab8350d90dce4b4fca042e2 100644 (file)
@@ -38,6 +38,7 @@ class DayNavigatorWidget : public QWidget, private Ui::DayNavigatorWidget {
         QDate curDate() const {return mCurDate;}
         QDate endDate() const {return mEndDate;}
         void unsetDates();
         QDate curDate() const {return mCurDate;}
         QDate endDate() const {return mEndDate;}
         void unsetDates();
+        virtual QSize minimumSizeHint() const override;
     protected:
         void paintEvent(QPaintEvent *);
         void configureNavigation();
     protected:
         void paintEvent(QPaintEvent *);
         void configureNavigation();
index e3b4fa1b2a4690f956409377c086d8fbb7ad9d63..d866c4d2d290ef972c776d4d62e729627a7e74de 100644 (file)
   <widget class="QWidget" name="centralwidget">
    <layout class="QHBoxLayout" name="horizontalLayout">
     <item>
   <widget class="QWidget" name="centralwidget">
    <layout class="QHBoxLayout" name="horizontalLayout">
     <item>
-     <widget class="DayNavigatorWidget" name="dayNavigator" native="true">
-      <property name="minimumSize">
-       <size>
-        <width>20</width>
-        <height>0</height>
-       </size>
-      </property>
-     </widget>
+     <widget class="DayNavigatorWidget" name="dayNavigator" native="true"/>
     </item>
     <item>
      <widget class="QTabWidget" name="tabWidget">
     </item>
     <item>
      <widget class="QTabWidget" name="tabWidget">