mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 03:18:55 +02:00
Closes #3707 All this does is anchor the left and right-most cards to their respective edges, and then equally distributes the gaps between cards thereafter. Don't even bother trying to figure out what the hell I just wrote. I'm a UI designer, not a mathematician. Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3829
27 lines
733 B
C++
27 lines
733 B
C++
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#pragma once
|
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
/**
|
|
* A stylized "card"-like delegate for the game grid view.
|
|
* Adapted from QML
|
|
*/
|
|
class GameCard : public QStyledItemDelegate {
|
|
Q_OBJECT
|
|
public:
|
|
explicit GameCard(QObject* parent = nullptr);
|
|
|
|
void paint(QPainter* painter, const QStyleOptionViewItem& option,
|
|
const QModelIndex& index) const override;
|
|
|
|
QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const override;
|
|
void setSize(const QSize& newSize, const int padding, const int columns);
|
|
|
|
private:
|
|
QSize m_size;
|
|
int m_padding;
|
|
int m_columns;
|
|
};
|