[EDHRec] Add background plate and "selection highlight" to card display widgets (#6390)
Some checks failed
Build Desktop / Configure (push) Has been cancelled
Build Docker Image / amd64 & arm64 (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 11) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, 13) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Debian, DEB, skip, 12) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, 43) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Fedora, RPM, skip, 42) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Servatrice_Debian, DEB, yes, skip, 11) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, 24.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (Ubuntu, DEB, skip, 22.04) (push) Has been cancelled
Build Desktop / ${{matrix.distro}} ${{matrix.version}} (yes, Arch, skip) (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Windows10-installer, true, Visual Studio 17 2022, x64, 1, Windows, -Win10, win64_msvc2019_64, qtimageformats qtmultimedia qt… (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (Windows7-installer, true, Visual Studio 17 2022, x64, 1, Windows, -Win7, win64_msvc2019_64, 5.15.*, windows-2022, 7, Release) (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (false, Ninja, macOS, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, macos-15, Apple, 15, Debug, 1, 16.4) (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (macOS13_Intel-package, false, Ninja, 1, macOS, 13, -macOS13_Intel, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*… (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (macOS14-package, false, Ninja, 1, macOS, -macOS14, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, macos-14, Appl… (push) Has been cancelled
Build Desktop / ${{matrix.os}} ${{matrix.target}}${{ matrix.soc == 'Intel' && ' Intel' || '' }}${{ matrix.type == 'Debug' && ' Debug' || '' }} (macOS15-package, false, Ninja, 1, macOS, -macOS15, clang_64, qtimageformats qtmultimedia qtwebsockets, 6.6.*, macos-15, Appl… (push) Has been cancelled

This commit is contained in:
BruebachL 2025-12-01 09:37:48 +01:00 committed by GitHub
parent 3ff2df2796
commit 364d0ca52b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 44 additions and 3 deletions

View File

@ -8,7 +8,7 @@ class BackgroundPlateWidget : public QWidget
Q_OBJECT
public:
explicit BackgroundPlateWidget(QWidget *parent = nullptr);
explicit BackgroundPlateWidget(QWidget *parent);
void setFocused(bool focused);

View File

@ -1,5 +1,6 @@
#include "edhrec_api_response_card_details_display_widget.h"
#include "../../../../../general/display/background_plate_widget.h"
#include "../../tab_edhrec_main.h"
#include <libcockatrice/card/database/card_database_manager.h>
@ -25,8 +26,14 @@ EdhrecApiResponseCardDetailsDisplayWidget::EdhrecApiResponseCardDetailsDisplayWi
layout->addWidget(nameLabel);
layout->addWidget(cardPictureWidget);
layout->addWidget(inclusionDisplayWidget);
layout->addWidget(synergyDisplayWidget);
backgroundPlateWidget = new BackgroundPlateWidget(this);
auto plateLayout = new QVBoxLayout(backgroundPlateWidget);
plateLayout->addWidget(inclusionDisplayWidget);
plateLayout->addWidget(synergyDisplayWidget);
layout->addWidget(backgroundPlateWidget);
QWidget *currentParent = parentWidget();
TabEdhRecMain *parentTab = nullptr;
@ -49,6 +56,28 @@ EdhrecApiResponseCardDetailsDisplayWidget::EdhrecApiResponseCardDetailsDisplayWi
}
}
void EdhrecApiResponseCardDetailsDisplayWidget::mousePressEvent(QMouseEvent *event)
{
QWidget::mousePressEvent(event);
actRequestPageNavigation();
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void EdhrecApiResponseCardDetailsDisplayWidget::enterEvent(QEnterEvent *event)
#else
void EdhrecApiResponseCardDetailsDisplayWidget::enterEvent(QEvent *event)
#endif
{
QWidget::enterEvent(event);
backgroundPlateWidget->setFocused(true);
}
void EdhrecApiResponseCardDetailsDisplayWidget::leaveEvent(QEvent *event)
{
QWidget::leaveEvent(event);
backgroundPlateWidget->setFocused(false);
}
void EdhrecApiResponseCardDetailsDisplayWidget::actRequestPageNavigation()
{
emit requestUrl(toDisplay.url);

View File

@ -8,6 +8,7 @@
#define EDHREC_COMMANDER_API_RESPONSE_CARD_DETAILS_DISPLAY_WIDGET_H
#include "../../../../../cards/card_info_picture_widget.h"
#include "../../../../../general/display/background_plate_widget.h"
#include "../../api_response/cards/edhrec_api_response_card_details.h"
#include "edhrec_api_response_card_inclusion_display_widget.h"
#include "edhrec_api_response_card_synergy_display_widget.h"
@ -30,9 +31,20 @@ private:
EdhrecApiResponseCardDetails toDisplay;
QVBoxLayout *layout;
CardInfoPictureWidget *cardPictureWidget;
BackgroundPlateWidget *backgroundPlateWidget; ///< Plate for metadata labels
QLabel *nameLabel;
EdhrecApiResponseCardInclusionDisplayWidget *inclusionDisplayWidget;
EdhrecApiResponseCardSynergyDisplayWidget *synergyDisplayWidget;
protected slots:
void mousePressEvent(QMouseEvent *event) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void enterEvent(QEnterEvent *event) override; ///< Qt6 hover enter
#else
void enterEvent(QEvent *event) override; ///< Qt5 hover enter
#endif
void leaveEvent(QEvent *event) override;
};
#endif // EDHREC_COMMANDER_API_RESPONSE_CARD_DETAILS_DISPLAY_WIDGET_H