[LyX/2.3.x] Fix Qt deprecation warns for setAutoCompletion()
Scott Kostyshak
skostysh at lyx.org
Thu Mar 18 02:19:25 UTC 2021
commit 0f17c6a98fc16fd5c1c0eefc6bd62bcf066564de
Author: Scott Kostyshak <skostysh at lyx.org>
Date: Wed Mar 17 22:13:10 2021 -0400
Fix Qt deprecation warns for setAutoCompletion()
This commit fixes a few warnings from Qt 5.14 like the following
one:
error: ‘void QComboBox::setAutoCompletion(bool)’ is deprecated: Use setCompleter() instead. [-Werror=deprecated-declarations]
We only generated setAutoCompletion() from setting the property in
the .ui files. There does not seem to be a .ui file property that
generates setCompleter(). However, the default in both Qt5 [1] and
Qt4 [2] is to enable case-insensitive autocompletion, which seems to
be the same type of autocompletion as when we were relying on
setAutoCompletion(true). Thus, we can remove the properties that set
autocomplete to true. There is only one file, SearchUi.ui, where we
were turning off the autocompletion; we now do so using
setCompleter(0) in GuiSearch::GuiSearch().
[1] https://doc.qt.io/qt-5/qcombobox.html#setCompleter
[2] https://doc.qt.io/archives/qt-4.8/qcombobox.html#setCompleter
(manually cherry picked from commit 27ba830b8ef513c8332e15747797844a97807791)
---
src/frontends/qt4/GuiSearch.cpp | 3 +++
src/frontends/qt4/ui/BibtexUi.ui | 3 ---
src/frontends/qt4/ui/ListingsUi.ui | 9 ---------
src/frontends/qt4/ui/SearchUi.ui | 6 ------
src/frontends/qt4/ui/SendtoUi.ui | 3 ---
src/frontends/qt4/ui/SpellcheckerUi.ui | 3 ---
6 files changed, 3 insertions(+), 24 deletions(-)
diff --git a/src/frontends/qt4/GuiSearch.cpp b/src/frontends/qt4/GuiSearch.cpp
index 411ba2e..294849c 100644
--- a/src/frontends/qt4/GuiSearch.cpp
+++ b/src/frontends/qt4/GuiSearch.cpp
@@ -62,6 +62,9 @@ GuiSearch::GuiSearch(GuiView & lv)
bc().addReadOnly(replacePB);
bc().addReadOnly(replaceallPB);
+ findCO->setCompleter(0);
+ replaceCO->setCompleter(0);
+
replacePB->setEnabled(false);
replaceallPB->setEnabled(false);
}
diff --git a/src/frontends/qt4/ui/BibtexUi.ui b/src/frontends/qt4/ui/BibtexUi.ui
index f72ba6c..79745ee 100644
--- a/src/frontends/qt4/ui/BibtexUi.ui
+++ b/src/frontends/qt4/ui/BibtexUi.ui
@@ -135,9 +135,6 @@
<property name="editable">
<bool>true</bool>
</property>
- <property name="autoCompletion">
- <bool>true</bool>
- </property>
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
diff --git a/src/frontends/qt4/ui/ListingsUi.ui b/src/frontends/qt4/ui/ListingsUi.ui
index 0c89d17..ad1781c 100644
--- a/src/frontends/qt4/ui/ListingsUi.ui
+++ b/src/frontends/qt4/ui/ListingsUi.ui
@@ -171,9 +171,6 @@
<property name="editable" >
<bool>false</bool>
</property>
- <property name="autoCompletion" >
- <bool>true</bool>
- </property>
<property name="duplicatesEnabled" >
<bool>false</bool>
</property>
@@ -217,9 +214,6 @@
<property name="editable" >
<bool>false</bool>
</property>
- <property name="autoCompletion" >
- <bool>true</bool>
- </property>
<property name="duplicatesEnabled" >
<bool>false</bool>
</property>
@@ -254,9 +248,6 @@
<property name="editable" >
<bool>false</bool>
</property>
- <property name="autoCompletion" >
- <bool>true</bool>
- </property>
<property name="duplicatesEnabled" >
<bool>false</bool>
</property>
diff --git a/src/frontends/qt4/ui/SearchUi.ui b/src/frontends/qt4/ui/SearchUi.ui
index 7fc1e31..68616e9 100644
--- a/src/frontends/qt4/ui/SearchUi.ui
+++ b/src/frontends/qt4/ui/SearchUi.ui
@@ -52,9 +52,6 @@
<property name="insertPolicy">
<enum>QComboBox::InsertAtTop</enum>
</property>
- <property name="autoCompletion">
- <bool>false</bool>
- </property>
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
@@ -87,9 +84,6 @@
<property name="insertPolicy">
<enum>QComboBox::InsertAtTop</enum>
</property>
- <property name="autoCompletion">
- <bool>false</bool>
- </property>
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
diff --git a/src/frontends/qt4/ui/SendtoUi.ui b/src/frontends/qt4/ui/SendtoUi.ui
index 7626a85..cd0e55f 100644
--- a/src/frontends/qt4/ui/SendtoUi.ui
+++ b/src/frontends/qt4/ui/SendtoUi.ui
@@ -50,9 +50,6 @@
<property name="insertPolicy" >
<enum>QComboBox::NoInsert</enum>
</property>
- <property name="autoCompletion" >
- <bool>true</bool>
- </property>
<property name="duplicatesEnabled" >
<bool>false</bool>
</property>
diff --git a/src/frontends/qt4/ui/SpellcheckerUi.ui b/src/frontends/qt4/ui/SpellcheckerUi.ui
index c8d6a86..5c09d13 100644
--- a/src/frontends/qt4/ui/SpellcheckerUi.ui
+++ b/src/frontends/qt4/ui/SpellcheckerUi.ui
@@ -110,9 +110,6 @@
<property name="insertPolicy" >
<enum>QComboBox::InsertAtTop</enum>
</property>
- <property name="autoCompletion" >
- <bool>true</bool>
- </property>
<property name="duplicatesEnabled" >
<bool>false</bool>
</property>
More information about the lyx-cvs
mailing list