]> git.lyx.org Git - features.git/commitdiff
Avoid deprecation warnings
authorEnrico Forestieri <forenr@lyx.org>
Fri, 29 Jan 2021 12:12:29 +0000 (13:12 +0100)
committerEnrico Forestieri <forenr@lyx.org>
Fri, 29 Jan 2021 12:12:29 +0000 (13:12 +0100)
In Qt 5.15 many deprecation warnings are issued, presumably for
helping the port to Qt 6. They are really a load but can be
shuten up by using -DQT_NO_DEPRECATED_WARNINGS, except for the ones
about MidButton, AdjustToMinimumContentsLength, and DefaultLocaleLongDate.

This change should not affect compilation with Qt 4, as all changes are
backward compatible (only Qt versions prior 4.5 could be affected).

src/frontends/qt/GuiChanges.cpp
src/frontends/qt/GuiWorkArea.cpp
src/frontends/qt/ui/PrefOutputUi.ui

index 7be8e7ef0e77eb5704037493803a1c46a1241f4c..eda161d0d54fc67ee0c82e2cb249239d5ceb106f 100644 (file)
@@ -70,8 +70,9 @@ void GuiChanges::updateContents()
                        text += inserted ? qt_("Inserted by %1").arg(author)
                                         : qt_("Deleted by %1").arg(author);
 
-               QString const date = QDateTime::fromTime_t(c.changetime)
-                                        .toString(Qt::DefaultLocaleLongDate);
+               QString const date =
+                       QLocale().toString(QDateTime::fromTime_t(c.changetime),
+                                       QLocale::LongFormat);
                if (!date.isEmpty()) {
                        if (!author.isEmpty())
                                text += qt_(" on[[date]] %1").arg(date);
index 3a2a362f09021584510199bf3df63b2c78f933e3..02e03aaaeb780565d741ffd284345b3c09a852e9 100644 (file)
@@ -93,7 +93,7 @@ static mouse_button::state q_button_state(Qt::MouseButton button)
                case Qt::LeftButton:
                        b = mouse_button::button1;
                        break;
-               case Qt::MidButton:
+               case Qt::MiddleButton:
                        b = mouse_button::button2;
                        break;
                case Qt::RightButton:
@@ -112,7 +112,7 @@ mouse_button::state q_motion_state(Qt::MouseButtons state)
        mouse_button::state b = mouse_button::none;
        if (state & Qt::LeftButton)
                b |= mouse_button::button1;
-       if (state & Qt::MidButton)
+       if (state & Qt::MiddleButton)
                b |= mouse_button::button2;
        if (state & Qt::RightButton)
                b |= mouse_button::button3;
@@ -1549,7 +1549,7 @@ TabWorkArea::TabWorkArea(QWidget * parent)
 
 void TabWorkArea::mousePressEvent(QMouseEvent *me)
 {
-       if (me->button() == Qt::MidButton)
+       if (me->button() == Qt::MiddleButton)
                midpressed_tab_ = tabBar()->tabAt(me->pos());
        else
                QTabWidget::mousePressEvent(me);
@@ -1558,7 +1558,7 @@ void TabWorkArea::mousePressEvent(QMouseEvent *me)
 
 void TabWorkArea::mouseReleaseEvent(QMouseEvent *me)
 {
-       if (me->button() == Qt::MidButton) {
+       if (me->button() == Qt::MiddleButton) {
                int const midreleased_tab = tabBar()->tabAt(me->pos());
                if (midpressed_tab_ == midreleased_tab && posIsTab(me->pos()))
                        closeTab(midreleased_tab);
index f8c8a8270cc72664f7adfd7914389a03d0a788fa..b62e5ded2a70ba4b128a4ac486d0397978a0737a 100644 (file)
@@ -56,7 +56,7 @@
            <bool>true</bool>
           </property>
           <property name="sizeAdjustPolicy">
-           <enum>QComboBox::AdjustToMinimumContentsLength</enum>
+           <enum>QComboBox::AdjustToContents</enum>
           </property>
          </widget>
         </item>
@@ -92,7 +92,7 @@
            <bool>true</bool>
           </property>
           <property name="sizeAdjustPolicy">
-           <enum>QComboBox::AdjustToMinimumContentsLength</enum>
+           <enum>QComboBox::AdjustToContents</enum>
           </property>
          </widget>
         </item>