diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebf7aa0..6404c42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,12 +39,8 @@ jobs: brew update brew install libchewing qt@5 - # Qt - brew link --force qt@5 - # Homebrew does not link mkspecs and plugins https://github.com/Homebrew/homebrew-core/issues/93056 - export HOMEBREW_QT5_VERSION=$(brew list --versions qt@5 | rev | cut -d' ' -f1 | rev) - sudo ln -s /usr/local/Cellar/qt@5/$HOMEBREW_QT5_VERSION/mkspecs /usr/local/mkspecs - sudo ln -s /usr/local/Cellar/qt@5/$HOMEBREW_QT5_VERSION/plugins /usr/local/plugins + # Allow CMake to find qt@5 by passing down the environment variable + echo "CMAKE_PREFIX_PATH=$(brew --prefix qt@5)" >> $GITHUB_ENV if: ${{ matrix.os == 'macos-latest' }} - name: Configure CMake diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a42b12..079cab0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ elseif(MSVC) add_definitions(-DUNICODE -D_UNICODE) endif() -add_definitions(-DTESTDATA="${PROJECT_SOURCE_DIR}/test/data") +add_definitions(-DTESTDATA="${PROJECT_SOURCE_DIR}/test/data" -DQT_DISABLE_DEPRECATED_BEFORE=0x050e00) find_package(PkgConfig) find_package(Qt5Widgets REQUIRED) @@ -161,12 +161,12 @@ QT5_ADD_RESOURCES(qt_resources ${PROJECT_SOURCE_DIR}/ts/ts.qrc) # exporter file(GLOB_RECURSE exporter_src ${PROJECT_SOURCE_DIR}/src/exporter/*) add_library(exporter STATIC ${exporter_src}) -qt5_use_modules(exporter Widgets) +target_link_libraries(exporter Qt5::Widgets) # importer file(GLOB_RECURSE importer_src ${PROJECT_SOURCE_DIR}/src/importer/*) add_library(importer STATIC ${importer_src}) -qt5_use_modules(importer Widgets) +target_link_libraries(importer Qt5::Widgets) # ui file(GLOB ui_src ${PROJECT_SOURCE_DIR}/src/ui/*) @@ -175,7 +175,7 @@ qt5_wrap_ui(ui ${ui_src}) # util file(GLOB util_src ${PROJECT_SOURCE_DIR}/src/util/*) add_library(util STATIC ${util_src}) -qt5_use_modules(util Widgets) +target_link_libraries(util Qt5::Widgets) # chewing-editor file(GLOB chewing-editor_src @@ -206,7 +206,7 @@ if(MSVC) ) endif() -qt5_use_modules(chewing-editor Widgets) +target_link_libraries(chewing-editor Qt5::Widgets) install(PROGRAMS ${CMAKE_BINARY_DIR}/chewing-editor DESTINATION ${CMAKE_INSTALL_BINDIR}) # icon @@ -273,7 +273,7 @@ target_link_libraries(run-test util pthread ) -qt5_use_modules(run-test Widgets) +target_link_libraries(run-test Qt5::Widgets) add_test(test run-test) diff --git a/src/model/UserphraseModel.cpp b/src/model/UserphraseModel.cpp index 995abeb..7e06004 100644 --- a/src/model/UserphraseModel.cpp +++ b/src/model/UserphraseModel.cpp @@ -20,6 +20,8 @@ #include "UserphraseModel.h" #include +#include +#include static void logger(void *data, int level, const char *fmt, ...) { @@ -86,7 +88,10 @@ void UserphraseModel::remove(QModelIndexList indexList) return; } - qSort(indexList.begin(), indexList.end(), qGreater()); + std::sort(indexList.begin(), indexList.end(), [] (const QModelIndex& a, const QModelIndex& b) { + // QModelIndex provides operator< but no operator> + return !(a < b); + }); // XXX: indexList is in revsrsed order, so first is actual last, and vice // verse. diff --git a/src/view/ChewingEditor.cpp b/src/view/ChewingEditor.cpp index be56c05..6200ad3 100644 --- a/src/view/ChewingEditor.cpp +++ b/src/view/ChewingEditor.cpp @@ -86,7 +86,7 @@ void ChewingEditor::execFileDialog(DialogType type) fileDialog_->setWindowTitle(tr("Import")); fileDialog_->setAcceptMode(QFileDialog::AcceptOpen); fileDialog_->setFileMode(QFileDialog::ExistingFile); - fileDialog_->setConfirmOverwrite(false); + fileDialog_->setOption(QFileDialog::DontConfirmOverwrite, true); fileDialog_->selectFile(""); break; @@ -94,7 +94,7 @@ void ChewingEditor::execFileDialog(DialogType type) fileDialog_->setWindowTitle(tr("Export")); fileDialog_->setAcceptMode(QFileDialog::AcceptSave); fileDialog_->setFileMode(QFileDialog::AnyFile); - fileDialog_->setConfirmOverwrite(true); + fileDialog_->setOption(QFileDialog::DontConfirmOverwrite, false); fileDialog_->selectFile("chewing.json"); break;