From 1ad0f24ecdb876c6ca7c81abffbf6ba67fcc88d1 Mon Sep 17 00:00:00 2001 From: Nekotekina Date: Thu, 7 Jan 2021 13:18:48 +0300 Subject: [PATCH] Fix or silence Qt warnings --- rpcs3/Emu/Io/usb_device.cpp | 2 +- rpcs3/rpcs3qt/custom_table_widget_item.h | 11 +++++++++-- rpcs3/rpcs3qt/game_list.h | 7 +++++++ rpcs3/rpcs3qt/game_list_grid_delegate.cpp | 2 +- rpcs3/rpcs3qt/kernel_explorer.cpp | 4 ++-- rpcs3/rpcs3qt/pad_settings_dialog.cpp | 2 +- rpcs3/rpcs3qt/patch_manager_dialog.cpp | 4 ++-- rpcs3/rpcs3qt/screenshot_preview.cpp | 2 +- 8 files changed, 24 insertions(+), 10 deletions(-) diff --git a/rpcs3/Emu/Io/usb_device.cpp b/rpcs3/Emu/Io/usb_device.cpp index 08c9dfa9ac..9a8594f967 100644 --- a/rpcs3/Emu/Io/usb_device.cpp +++ b/rpcs3/Emu/Io/usb_device.cpp @@ -72,7 +72,7 @@ void usb_device_passthrough::read_descriptors() for (u8 index = 0; index < device._device.bNumConfigurations; index++) { u8 buf[1000]; - int ssize = libusb_control_transfer(lusb_handle, LIBUSB_ENDPOINT_IN | LIBUSB_REQUEST_TYPE_STANDARD | LIBUSB_RECIPIENT_DEVICE, LIBUSB_REQUEST_GET_DESCRIPTOR, 0x0200 | index, 0, buf, 1000, 0); + int ssize = libusb_control_transfer(lusb_handle, +LIBUSB_ENDPOINT_IN | +LIBUSB_REQUEST_TYPE_STANDARD | +LIBUSB_RECIPIENT_DEVICE, LIBUSB_REQUEST_GET_DESCRIPTOR, 0x0200 | index, 0, buf, 1000, 0); if (ssize < 0) { sys_usbd.fatal("Couldn't get the config from the device: %d", ssize); diff --git a/rpcs3/rpcs3qt/custom_table_widget_item.h b/rpcs3/rpcs3qt/custom_table_widget_item.h index 27c315b09a..9c69573893 100644 --- a/rpcs3/rpcs3qt/custom_table_widget_item.h +++ b/rpcs3/rpcs3qt/custom_table_widget_item.h @@ -28,12 +28,19 @@ public: } } - bool operator <(const QTableWidgetItem &other) const + bool operator <(const QTableWidgetItem& other) const { +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif return data(m_sort_role) < other.data(m_sort_role); +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif } - void setData(int role, const QVariant &value, bool assign_sort_role) + void setData(int role, const QVariant& value, bool assign_sort_role) { if (assign_sort_role) { diff --git a/rpcs3/rpcs3qt/game_list.h b/rpcs3/rpcs3qt/game_list.h index 82bf11dca8..b3ebd2965c 100644 --- a/rpcs3/rpcs3qt/game_list.h +++ b/rpcs3/rpcs3qt/game_list.h @@ -12,7 +12,14 @@ class game_list : public QTableWidget private: void mousePressEvent(QMouseEvent *event) override { +#ifndef _MSC_VER +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif if (!indexAt(event->pos()).isValid() || itemAt(event->pos())->data(Qt::UserRole) < 0) +#ifndef _MSC_VER +#pragma GCC diagnostic pop +#endif { clearSelection(); setCurrentItem(nullptr); // Needed for currentItemChanged diff --git a/rpcs3/rpcs3qt/game_list_grid_delegate.cpp b/rpcs3/rpcs3qt/game_list_grid_delegate.cpp index 4fd3f9a612..69a8859ff6 100644 --- a/rpcs3/rpcs3qt/game_list_grid_delegate.cpp +++ b/rpcs3/rpcs3qt/game_list_grid_delegate.cpp @@ -55,7 +55,7 @@ void game_list_grid_delegate::paint(QPainter *painter, const QStyleOptionViewIte } painter->setFont(option.font); - painter->drawText(QRect(r.left(), top, r.width(), height), Qt::TextWordWrap | Qt::AlignCenter, title); + painter->drawText(QRect(r.left(), top, r.width(), height), +Qt::TextWordWrap | +Qt::AlignCenter, title); } QSize game_list_grid_delegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const diff --git a/rpcs3/rpcs3qt/kernel_explorer.cpp b/rpcs3/rpcs3qt/kernel_explorer.cpp index 750d9bab53..9ebe703aba 100644 --- a/rpcs3/rpcs3qt/kernel_explorer.cpp +++ b/rpcs3/rpcs3qt/kernel_explorer.cpp @@ -93,7 +93,7 @@ static QTreeWidgetItem* find_first_node(QTreeWidget* tree, QTreeWidgetItem *pare { if (tree && parent) { - for (auto item : tree->findItems(regexp, Qt::MatchFlag::MatchRegExp | Qt::MatchFlag::MatchRecursive)) + for (auto item : tree->findItems(regexp, Qt::MatchFlag::MatchRegularExpression | Qt::MatchFlag::MatchRecursive)) { if (item->parent() == parent && item->data(0, kernel_item_role::type_role).toInt() != kernel_item_type::leaf) { @@ -108,7 +108,7 @@ static QTreeWidgetItem* find_node(QTreeWidget* tree, u32 id) { if (tree) { - for (auto item : tree->findItems(".*", Qt::MatchFlag::MatchRegExp | Qt::MatchFlag::MatchRecursive)) + for (auto item : tree->findItems(".*", Qt::MatchFlag::MatchRegularExpression | Qt::MatchFlag::MatchRecursive)) { if (item->data(0, kernel_item_role::type_role).toInt() == kernel_item_type::node && item->data(0, kernel_item_role::id_role).toUInt() == id) diff --git a/rpcs3/rpcs3qt/pad_settings_dialog.cpp b/rpcs3/rpcs3qt/pad_settings_dialog.cpp index 18c5a206f3..019045ac4f 100644 --- a/rpcs3/rpcs3qt/pad_settings_dialog.cpp +++ b/rpcs3/rpcs3qt/pad_settings_dialog.cpp @@ -223,7 +223,7 @@ pad_settings_dialog::pad_settings_dialog(std::shared_ptr gui_setti SubscribeTooltips(); // Repaint controller image - ui->l_controller->setPixmap(gui::utils::get_colorized_pixmap(*ui->l_controller->pixmap(), QColor(), gui::utils::get_label_color("l_controller"), false, true)); + ui->l_controller->setPixmap(gui::utils::get_colorized_pixmap(ui->l_controller->pixmap(Qt::ReturnByValue), QColor(), gui::utils::get_label_color("l_controller"), false, true)); // Show default widgets first in order to calculate the required size for the scroll area (see pad_settings_dialog::ResizeDialog) ui->left_stack->setCurrentIndex(0); diff --git a/rpcs3/rpcs3qt/patch_manager_dialog.cpp b/rpcs3/rpcs3qt/patch_manager_dialog.cpp index 735e17ef86..446e95021e 100644 --- a/rpcs3/rpcs3qt/patch_manager_dialog.cpp +++ b/rpcs3/rpcs3qt/patch_manager_dialog.cpp @@ -194,7 +194,7 @@ void patch_manager_dialog::populate_tree() { // "Reset" currently used items. Items that aren't persisted will be removed later. // Using this logic instead of clearing the tree here should persist the expanded status of items. - for (auto item : ui->patch_tree->findItems(".*", Qt::MatchFlag::MatchRegExp | Qt::MatchFlag::MatchRecursive)) + for (auto item : ui->patch_tree->findItems(".*", Qt::MatchFlag::MatchRegularExpression | Qt::MatchFlag::MatchRecursive)) { if (item) { @@ -430,7 +430,7 @@ void patch_manager_dialog::filter_patches(const QString& term) }; // Go through each top level item and try to find matches - for (auto top_level_item : ui->patch_tree->findItems(".*", Qt::MatchRegExp)) + for (auto top_level_item : ui->patch_tree->findItems(".*", Qt::MatchRegularExpression)) { show_matches(top_level_item, false); } diff --git a/rpcs3/rpcs3qt/screenshot_preview.cpp b/rpcs3/rpcs3qt/screenshot_preview.cpp index b1a6534a48..fa239efb19 100644 --- a/rpcs3/rpcs3qt/screenshot_preview.cpp +++ b/rpcs3/rpcs3qt/screenshot_preview.cpp @@ -37,7 +37,7 @@ void screenshot_preview::show_context_menu(const QPoint & pos) menu->addSeparator(); QAction* reset_act = menu->addAction(tr("To &Normal Size"), [this]() { scale(m_image.size()); }); - reset_act->setEnabled(pixmap()->size() != m_image.size()); + reset_act->setEnabled(pixmap(Qt::ReturnByValue).size() != m_image.size()); QAction* stretch_act = menu->addAction(tr("&Stretch to size"), [this]() { m_stretch = !m_stretch; scale(size()); }); stretch_act->setCheckable(true);