Fix build failure with Qt5.6 (#8829)

With Qt 5.6, build fails with error below.

This is because in Qt 5.6, the 3rd argument is not optional. Starting from Qt
5.7 the default value for the 3rd argument is nullptr, so setting it to
nullptr.

https://doc.qt.io/archives/qt-5.6/qaction.html#QAction-2
https://doc.qt.io/archives/qt-5.7/qaction.html#QAction-2

Error:
src/gui/tag/TagView.cpp:79:38: error: no matching constructor for initialization of 'QAction'
        auto action = menu.exec({new QAction(icons()->icon("trash"), tr("Remove Search"))}, mapToGlobal(pos));
                                     ^       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
tenzap 2023-01-29 17:12:12 +01:00 committed by GitHub
parent e221f89e68
commit ef8c7b0a4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,14 +76,14 @@ void TagView::contextMenuRequested(const QPoint& pos)
if (type == TagModel::SAVED_SEARCH) {
// Allow deleting saved searches
QMenu menu;
auto action = menu.exec({new QAction(icons()->icon("trash"), tr("Remove Search"))}, mapToGlobal(pos));
auto action = menu.exec({new QAction(icons()->icon("trash"), tr("Remove Search"), nullptr)}, mapToGlobal(pos));
if (action) {
m_db->metadata()->deleteSavedSearch(index.data(Qt::DisplayRole).toString());
}
} else if (type == TagModel::TAG) {
// Allow removing tags from all entries in a database
QMenu menu;
auto action = menu.exec({new QAction(icons()->icon("trash"), tr("Remove Tag"))}, mapToGlobal(pos));
auto action = menu.exec({new QAction(icons()->icon("trash"), tr("Remove Tag"), nullptr)}, mapToGlobal(pos));
if (action) {
auto tag = index.data(Qt::DisplayRole).toString();
auto ans = MessageBox::question(this,