replace currentData with itemData on QComboBox::currentIndexChanged slots

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
(cherry picked from commit 0cafac84ac6328fefb8992de2c6a2385b1c0053c)
This commit is contained in:
Trial97 2024-10-28 12:54:21 +02:00 committed by github-actions[bot]
parent 1e696328bb
commit c3cf5d31da
4 changed files with 12 additions and 12 deletions

View File

@ -325,9 +325,9 @@ void ResourcePage::onSelectionChanged(QModelIndex curr, [[maybe_unused]] QModelI
updateUi(); updateUi();
} }
void ResourcePage::onVersionSelectionChanged(int) void ResourcePage::onVersionSelectionChanged(int index)
{ {
m_selectedVersionIndex = m_ui->versionSelectionBox->currentData().toInt(); m_selectedVersionIndex = m_ui->versionSelectionBox->itemData(index).toInt();
updateSelectionButton(); updateSelectionButton();
} }
@ -364,10 +364,10 @@ void ResourcePage::onResourceSelected()
auto& version = current_pack->versions[m_selectedVersionIndex]; auto& version = current_pack->versions[m_selectedVersionIndex];
if (version.downloadUrl.isNull()) { if (version.downloadUrl.isNull()) {
CustomMessageBox::selectable(this, tr("How?"), CustomMessageBox::selectable(
"You managed to select a resource that doesn't have a download link. Because of this missing " this, tr("Download Link Missing"),
"information prism will not try to download it.", tr("It looks like the resource you selected doesn't have a download link, so Prism won't attempt to download it."),
QMessageBox::Warning) QMessageBox::Warning)
->show(); ->show();
return; return;
} }
@ -485,7 +485,7 @@ void ResourcePage::openProject(QVariant projectID)
m_ui->gridLayout_4->addWidget(buttonBox, 1, 2); m_ui->gridLayout_4->addWidget(buttonBox, 1, 2);
connect(m_ui->versionSelectionBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this, connect(m_ui->versionSelectionBox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
[this, okBtn] { okBtn->setEnabled(m_ui->versionSelectionBox->currentData().toInt() >= 0); }); [this, okBtn](int index) { okBtn->setEnabled(m_ui->versionSelectionBox->itemData(index).toInt() >= 0); });
auto jump = [this] { auto jump = [this] {
for (int row = 0; row < m_model->rowCount({}); row++) { for (int row = 0; row < m_model->rowCount({}); row++) {

View File

@ -273,7 +273,7 @@ void FlamePage::suggestCurrent()
void FlamePage::onVersionSelectionChanged(int index) void FlamePage::onVersionSelectionChanged(int index)
{ {
bool is_blocked = false; bool is_blocked = false;
ui->versionSelectionBox->currentData().toInt(&is_blocked); ui->versionSelectionBox->itemData(index).toInt(&is_blocked);
if (index == -1 || is_blocked) { if (index == -1 || is_blocked) {
m_selected_version_index = -1; m_selected_version_index = -1;

View File

@ -375,7 +375,7 @@ void ModrinthPage::onVersionSelectionChanged(int index)
selectedVersion = ""; selectedVersion = "";
return; return;
} }
selectedVersion = ui->versionSelectionBox->currentData().toString(); selectedVersion = ui->versionSelectionBox->itemData(index).toString();
suggestCurrent(); suggestCurrent();
} }

View File

@ -87,7 +87,7 @@ void ThemeCustomizationWidget::applyIconTheme(int index)
{ {
auto settings = APPLICATION->settings(); auto settings = APPLICATION->settings();
auto originalIconTheme = settings->get("IconTheme").toString(); auto originalIconTheme = settings->get("IconTheme").toString();
auto newIconTheme = ui->iconsComboBox->currentData().toString(); auto newIconTheme = ui->iconsComboBox->itemData(index).toString();
if (originalIconTheme != newIconTheme) { if (originalIconTheme != newIconTheme) {
settings->set("IconTheme", newIconTheme); settings->set("IconTheme", newIconTheme);
APPLICATION->themeManager()->applyCurrentlySelectedTheme(); APPLICATION->themeManager()->applyCurrentlySelectedTheme();
@ -100,7 +100,7 @@ void ThemeCustomizationWidget::applyWidgetTheme(int index)
{ {
auto settings = APPLICATION->settings(); auto settings = APPLICATION->settings();
auto originalAppTheme = settings->get("ApplicationTheme").toString(); auto originalAppTheme = settings->get("ApplicationTheme").toString();
auto newAppTheme = ui->widgetStyleComboBox->currentData().toString(); auto newAppTheme = ui->widgetStyleComboBox->itemData(index).toString();
if (originalAppTheme != newAppTheme) { if (originalAppTheme != newAppTheme) {
settings->set("ApplicationTheme", newAppTheme); settings->set("ApplicationTheme", newAppTheme);
APPLICATION->themeManager()->applyCurrentlySelectedTheme(); APPLICATION->themeManager()->applyCurrentlySelectedTheme();
@ -113,7 +113,7 @@ void ThemeCustomizationWidget::applyCatTheme(int index)
{ {
auto settings = APPLICATION->settings(); auto settings = APPLICATION->settings();
auto originalCat = settings->get("BackgroundCat").toString(); auto originalCat = settings->get("BackgroundCat").toString();
auto newCat = ui->backgroundCatComboBox->currentData().toString(); auto newCat = ui->backgroundCatComboBox->itemData(index).toString();
if (originalCat != newCat) { if (originalCat != newCat) {
settings->set("BackgroundCat", newCat); settings->set("BackgroundCat", newCat);
} }