From 4caeeb3a78d549e542fa43bff602811e66d3cc2a Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 19 Oct 2022 00:55:59 +0000 Subject: [PATCH] compatibility for qt 5.12 --- RedPandaIDE/mainwindow.cpp | 10 +++++++++- RedPandaIDE/widgets/bookmarkmodel.cpp | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 6dcb5b11..1f6f7fc3 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -6135,7 +6135,11 @@ void MainWindow::on_actionAdd_to_project_triggered() QModelIndex parentIndex = mProject->model()->getParentIndex(newUnit->node().get()); parentIndex = mProjectProxyModel->mapFromSource(parentIndex); if (parentIndex.isValid()) { - ui->projectView->expandRecursively(index); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + ui->projectView->expandRecursively(parentIndex); +#else + ui->projectView->expand(parentIndex); +#endif } if (index.isValid()) { ui->projectView->setCurrentIndex(index); @@ -6532,7 +6536,11 @@ void MainWindow::setProjectViewCurrentNode(PProjectModelNode node) QModelIndex parentIndex = mProject->model()->getParentIndex(node.get()); parentIndex = mProjectProxyModel->mapFromSource(parentIndex); if (parentIndex.isValid()) { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) ui->projectView->expandRecursively(parentIndex); +#else + ui->projectView->expand(parentIndex); +#endif } QModelIndex index = mProject->model()->getNodeIndex(node.get()); index = mProjectProxyModel->mapFromSource(index); diff --git a/RedPandaIDE/widgets/bookmarkmodel.cpp b/RedPandaIDE/widgets/bookmarkmodel.cpp index 3f4086f8..927aa14e 100644 --- a/RedPandaIDE/widgets/bookmarkmodel.cpp +++ b/RedPandaIDE/widgets/bookmarkmodel.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "../utils.h" BookmarkModel::BookmarkModel(QObject* parent):QAbstractTableModel(parent),