Create replacement repo for previous corrupted one
This commit is contained in:
42
src/components/albumTile/albumtile.cpp
Normal file
42
src/components/albumTile/albumtile.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
#include "albumtile.h"
|
||||
#include <QPixmap>
|
||||
#include <QMouseEvent>
|
||||
|
||||
AlbumTile::AlbumTile(const AlbumData& item, QWidget* parent)
|
||||
: QWidget(parent), item_(item)
|
||||
{
|
||||
auto* layout = new QVBoxLayout(this);
|
||||
layout->setAlignment(Qt::AlignCenter);
|
||||
layout->setSpacing(6);
|
||||
|
||||
// Cover Image
|
||||
QPixmap pix(item.imagePath);
|
||||
QLabel* cover = new QLabel;
|
||||
cover->setPixmap(
|
||||
pix.scaled(200, 200, Qt::KeepAspectRatio, Qt::SmoothTransformation)
|
||||
);
|
||||
cover->setAlignment(Qt::AlignCenter);
|
||||
|
||||
// Album Label
|
||||
QLabel* albumLabel = new QLabel(item.album);
|
||||
albumLabel->setAlignment(Qt::AlignCenter);
|
||||
albumLabel->setStyleSheet("font-weight: 600; font-size: 14px;");
|
||||
|
||||
// Artist Label
|
||||
QLabel* artistLabel = new QLabel(item.artist);
|
||||
artistLabel->setAlignment(Qt::AlignCenter);
|
||||
artistLabel->setStyleSheet("color: #888; font-size: 12px;");
|
||||
|
||||
layout->addWidget(cover);
|
||||
layout->addWidget(albumLabel);
|
||||
layout->addWidget(artistLabel);
|
||||
|
||||
setCursor(Qt::PointingHandCursor);
|
||||
}
|
||||
|
||||
// Simple click handler
|
||||
void AlbumTile::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
emit activated(item_);
|
||||
QWidget::mousePressEvent(event);
|
||||
}
|
||||
Reference in New Issue
Block a user