Fix or silence Qt warnings

This commit is contained in:
Nekotekina 2021-01-07 13:18:48 +03:00
parent 586440622b
commit 1ad0f24ecd
8 changed files with 24 additions and 10 deletions

View File

@ -72,7 +72,7 @@ void usb_device_passthrough::read_descriptors()
for (u8 index = 0; index < device._device.bNumConfigurations; index++) for (u8 index = 0; index < device._device.bNumConfigurations; index++)
{ {
u8 buf[1000]; 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) if (ssize < 0)
{ {
sys_usbd.fatal("Couldn't get the config from the device: %d", ssize); sys_usbd.fatal("Couldn't get the config from the device: %d", ssize);

View File

@ -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); 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) if (assign_sort_role)
{ {

View File

@ -12,7 +12,14 @@ class game_list : public QTableWidget
private: private:
void mousePressEvent(QMouseEvent *event) override 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) if (!indexAt(event->pos()).isValid() || itemAt(event->pos())->data(Qt::UserRole) < 0)
#ifndef _MSC_VER
#pragma GCC diagnostic pop
#endif
{ {
clearSelection(); clearSelection();
setCurrentItem(nullptr); // Needed for currentItemChanged setCurrentItem(nullptr); // Needed for currentItemChanged

View File

@ -55,7 +55,7 @@ void game_list_grid_delegate::paint(QPainter *painter, const QStyleOptionViewIte
} }
painter->setFont(option.font); 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 QSize game_list_grid_delegate::sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const

View File

@ -93,7 +93,7 @@ static QTreeWidgetItem* find_first_node(QTreeWidget* tree, QTreeWidgetItem *pare
{ {
if (tree && parent) 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) 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) 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 && if (item->data(0, kernel_item_role::type_role).toInt() == kernel_item_type::node &&
item->data(0, kernel_item_role::id_role).toUInt() == id) item->data(0, kernel_item_role::id_role).toUInt() == id)

View File

@ -223,7 +223,7 @@ pad_settings_dialog::pad_settings_dialog(std::shared_ptr<gui_settings> gui_setti
SubscribeTooltips(); SubscribeTooltips();
// Repaint controller image // 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) // 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); ui->left_stack->setCurrentIndex(0);

View File

@ -194,7 +194,7 @@ void patch_manager_dialog::populate_tree()
{ {
// "Reset" currently used items. Items that aren't persisted will be removed later. // "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. // 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) 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 // 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); show_matches(top_level_item, false);
} }

View File

@ -37,7 +37,7 @@ void screenshot_preview::show_context_menu(const QPoint & pos)
menu->addSeparator(); menu->addSeparator();
QAction* reset_act = menu->addAction(tr("To &Normal Size"), [this]() { scale(m_image.size()); }); 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()); }); QAction* stretch_act = menu->addAction(tr("&Stretch to size"), [this]() { m_stretch = !m_stretch; scale(size()); });
stretch_act->setCheckable(true); stretch_act->setCheckable(true);