From ab8ea9deb35715904ca988630c463ffd8ba4c8e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Wed, 18 Jun 2025 23:21:06 +0200 Subject: [PATCH] Qt5 compatibility stuff. --- cockatrice/src/dialogs/dlg_select_set_for_cards.cpp | 12 ++++++++++++ cockatrice/src/dialogs/dlg_select_set_for_cards.h | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp b/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp index e439e866f..416a5f9d3 100644 --- a/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp +++ b/cockatrice/src/dialogs/dlg_select_set_for_cards.cpp @@ -321,7 +321,11 @@ void DlgSelectSetForCards::dropEvent(QDropEvent *event) { QByteArray itemData = event->mimeData()->data("application/x-setentrywidget"); QString draggedSetName = QString::fromUtf8(itemData); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) QPoint adjustedPos = event->position().toPoint() + QPoint(0, scrollArea->verticalScrollBar()->value()); +#else + QPoint adjustedPos = event->pos() + QPoint(0, scrollArea->verticalScrollBar()->value()); +#endif int dropIndex = -1; for (int i = 0; i < listLayout->count(); ++i) { QWidget *widget = listLayout->itemAt(i)->widget(); @@ -433,7 +437,11 @@ SetEntryWidget::SetEntryWidget(DlgSelectSetForCards *_parent, const QString &_se QHBoxLayout *headerLayout = new QHBoxLayout(); CardSetPtr set = CardDatabaseManager::getInstance()->getSet(setName); checkBox = new QCheckBox("(" + set->getShortName() + ") - " + set->getLongName(), this); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) connect(checkBox, &QCheckBox::checkStateChanged, parent, &DlgSelectSetForCards::updateLayoutOrder); +#else + connect(checkBox, &QCheckBox::stateChanged, parent, &DlgSelectSetForCards::updateLayoutOrder); +#endif expandButton = new QPushButton("+", this); countLabel = new QLabel(QString::number(count), this); @@ -503,7 +511,11 @@ void SetEntryWidget::mousePressEvent(QMouseEvent *event) } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) void SetEntryWidget::enterEvent(QEnterEvent *event) +#else +void SetEntryWidget::enterEvent(QEvent *event) +#endif { QWidget::enterEvent(event); // Call the base class handler // Highlight the widget by changing the background color only for the widget itself diff --git a/cockatrice/src/dialogs/dlg_select_set_for_cards.h b/cockatrice/src/dialogs/dlg_select_set_for_cards.h index c0a8896e6..11d82ba7e 100644 --- a/cockatrice/src/dialogs/dlg_select_set_for_cards.h +++ b/cockatrice/src/dialogs/dlg_select_set_for_cards.h @@ -59,7 +59,6 @@ private: QPushButton *setAllToPreferredButton; QMap getSetsForCards(); - void updateCardAvailability(); }; class SetEntryWidget : public QWidget @@ -73,7 +72,6 @@ public: QStringList getAllCardsForSet(); void populateCardList(); void updateCardDisplayWidgets(); - void updateCardState(bool checked); bool isChecked() const; DlgSelectSetForCards *parent; QString setName;