mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 05:25:26 +00:00
Fix a few deprecation warnings in Qt 5.14.1
These changes fix a few instances of the following type of warning: error: ‘void QListWidget::setItemSelected(const QListWidgetItem*, bool)’ is deprecated: Use QListWidgetItem::setSelected() instead [-Werror=deprecated-declarations] as well as similar warnings for setItemHidden() and setItemExpanded(). These are just warnings now, but it is planned to remove the methods for Qt 6: https://bugreports.qt.io/browse/QTBUG-73048 I tested that LyX can still be built against Qt 4.8.7 with this commit. Indeed, these methods have been deprecated for a while (it is just that QT_DEPRECATED_WARNINGS was only turned on by default starting with 5.13.0). See, e.g., https://doc.qt.io/archives/qt-4.7/qlistwidget-obsolete.html
This commit is contained in:
parent
c1357cbd01
commit
24926b2e23
@ -159,7 +159,7 @@ void BulletsModule::selectItem(int font, int character, bool select)
|
||||
return;
|
||||
|
||||
QListWidget * lw = static_cast<QListWidget *>(bulletpaneSW->widget(font));
|
||||
lw->setItemSelected(lw->item(character), select);
|
||||
lw->item(character)->setSelected(select);
|
||||
}
|
||||
|
||||
|
||||
|
@ -144,7 +144,7 @@ void GuiBranches::updateView()
|
||||
// restore selected branch
|
||||
if (bname == sel_branch) {
|
||||
branchesTW->setCurrentItem(newItem);
|
||||
branchesTW->setItemSelected(newItem, true);
|
||||
newItem->setSelected(true);
|
||||
}
|
||||
}
|
||||
unknownPB->setEnabled(!unknown_branches_.isEmpty());
|
||||
|
@ -146,7 +146,7 @@ void GuiIndices::updateView()
|
||||
// restore selected index
|
||||
if (iname == sel_index) {
|
||||
indicesTW->setCurrentItem(newItem);
|
||||
indicesTW->setItemSelected(newItem, true);
|
||||
newItem->setSelected(true);
|
||||
}
|
||||
}
|
||||
indicesTW->resizeColumnToContents(0);
|
||||
|
@ -3245,7 +3245,7 @@ void PrefShortcuts::on_searchLE_textEdited()
|
||||
// show all hidden items
|
||||
QTreeWidgetItemIterator it(shortcutsTW, QTreeWidgetItemIterator::Hidden);
|
||||
for (; *it; ++it)
|
||||
shortcutsTW->setItemHidden(*it, isAlwaysHidden(**it));
|
||||
(*it)->setHidden(isAlwaysHidden(**it));
|
||||
// close all categories
|
||||
for (int i = 0; i < shortcutsTW->topLevelItemCount(); ++i)
|
||||
shortcutsTW->collapseItem(shortcutsTW->topLevelItem(i));
|
||||
@ -3264,8 +3264,8 @@ void PrefShortcuts::on_searchLE_textEdited()
|
||||
// show matched items
|
||||
for (int i = 0; i < matched.size(); ++i)
|
||||
if (!isAlwaysHidden(*matched[i])) {
|
||||
shortcutsTW->setItemHidden(matched[i], false);
|
||||
shortcutsTW->setItemExpanded(matched[i]->parent(), true);
|
||||
matched[i]->setHidden(false);
|
||||
matched[i]->parent()->setExpanded(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3372,7 +3372,7 @@ void PrefShortcuts::shortcutOkPressed()
|
||||
if (item) {
|
||||
user_bind_.bind(&k, func);
|
||||
shortcutsTW->sortItems(0, Qt::AscendingOrder);
|
||||
shortcutsTW->setItemExpanded(item->parent(), true);
|
||||
item->parent()->setExpanded(true);
|
||||
shortcutsTW->setCurrentItem(item);
|
||||
shortcutsTW->scrollToItem(item);
|
||||
} else {
|
||||
|
@ -545,7 +545,7 @@ void GuiRef::redoRefs()
|
||||
while (*it) {
|
||||
if ((*it)->text(0) == textToFind) {
|
||||
refsTW->setCurrentItem(*it);
|
||||
refsTW->setItemSelected(*it, true);
|
||||
(*it)->setSelected(true);
|
||||
//Make sure selected item is visible
|
||||
refsTW->scrollToItem(*it);
|
||||
last_reference_ = textToFind;
|
||||
|
Loading…
Reference in New Issue
Block a user