DolphinQt: resolve Qt5.15 deprecations

This commit is contained in:
Shawn Hoffman 2020-08-21 18:09:04 -07:00
parent c629af6319
commit 89b6a4cbee
7 changed files with 15 additions and 14 deletions

View File

@ -28,7 +28,7 @@ void DualShockUDPClientWidget::CreateWidgets()
m_servers_enabled = new QCheckBox(tr("Enable"));
m_servers_enabled->setChecked(Config::Get(ciface::DualShockUDPClient::Settings::SERVERS_ENABLED));
main_layout->addWidget(m_servers_enabled, 0, 0);
main_layout->addWidget(m_servers_enabled, 0, {});
m_server_list = new QListWidget();
main_layout->addWidget(m_server_list);

View File

@ -131,9 +131,12 @@ static int GetLayoutHorizontalSpacing(const QGridLayout* layout)
// Docs claim this is deprecated, but on macOS with Qt 5.8 this is the only one that actually
// works.
float pixel_ratio = QGuiApplication::primaryScreen()->devicePixelRatio();
#ifdef __APPLE__
// TODO is this still required?
hspacing = pixel_ratio * style->pixelMetric(QStyle::PM_DefaultLayoutSpacing);
if (hspacing >= 0)
return hspacing;
#endif
// Ripped from qtbase/src/widgets/styles/qcommonstyle.cpp
return pixel_ratio * 6;

View File

@ -156,7 +156,7 @@ void MemoryViewWidget::Update()
}
else
{
hex_item->setFlags(0);
hex_item->setFlags({});
hex_item->setText(QStringLiteral("-"));
}
}

View File

@ -120,7 +120,7 @@ QLayoutItem* FlowLayout::takeAt(int index)
Qt::Orientations FlowLayout::expandingDirections() const
{
return 0;
return {};
}
bool FlowLayout::hasHeightForWidth() const

View File

@ -186,9 +186,9 @@ void InterfacePane::ConnectLayout()
connect(m_checkbox_use_covers, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_show_debugging_ui, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_checkbox_focused_hotkeys, &QCheckBox::toggled, this, &InterfacePane::OnSaveConfig);
connect(m_combobox_theme, qOverload<const QString&>(&QComboBox::currentIndexChanged),
&Settings::Instance(), &Settings::SetThemeName);
connect(m_combobox_userstyle, qOverload<const QString&>(&QComboBox::currentIndexChanged), this,
connect(m_combobox_theme, qOverload<int>(&QComboBox::currentIndexChanged), this,
[=](int index) { Settings::Instance().SetThemeName(m_combobox_theme->itemText(index)); });
connect(m_combobox_userstyle, qOverload<int>(&QComboBox::currentIndexChanged), this,
&InterfacePane::OnSaveConfig);
connect(m_combobox_language, qOverload<int>(&QComboBox::currentIndexChanged), this,
&InterfacePane::OnSaveConfig);

View File

@ -168,10 +168,9 @@ void USBDeviceAddToWhitelistDialog::OnDeviceSelection()
{
// Not the nicest way of doing this but...
QString device = usb_inserted_devices_list->currentItem()->text().left(9);
QString* vid = new QString(
device.split(QString::fromStdString(":"), QString::SplitBehavior::KeepEmptyParts)[0]);
QString* pid = new QString(
device.split(QString::fromStdString(":"), QString::SplitBehavior::KeepEmptyParts)[1]);
QStringList split = device.split(QString::fromStdString(":"));
QString* vid = new QString(split[0]);
QString* pid = new QString(split[1]);
device_vid_textbox->setText(*vid);
device_pid_textbox->setText(*pid);
}

View File

@ -279,10 +279,9 @@ void WiiPane::OnUSBWhitelistAddButton()
void WiiPane::OnUSBWhitelistRemoveButton()
{
QString device = m_whitelist_usb_list->currentItem()->text().left(9);
QString vid =
QString(device.split(QString::fromStdString(":"), QString::SplitBehavior::KeepEmptyParts)[0]);
QString pid =
QString(device.split(QString::fromStdString(":"), QString::SplitBehavior::KeepEmptyParts)[1]);
QStringList split = device.split(QString::fromStdString(":"));
QString vid = QString(split[0]);
QString pid = QString(split[1]);
const u16 vid_u16 = static_cast<u16>(std::stoul(vid.toStdString(), nullptr, 16));
const u16 pid_u16 = static_cast<u16>(std::stoul(pid.toStdString(), nullptr, 16));
SConfig::GetInstance().m_usb_passthrough_devices.erase({vid_u16, pid_u16});