mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-09-24 03:52:21 +08:00
42 lines
857 B
C++
42 lines
857 B
C++
|
|
#pragma once
|
|
|
|
#include <QLabel>
|
|
#include <QVBoxLayout>
|
|
#include <QHBoxLayout>
|
|
#include "qt/elidedlabel.h"
|
|
|
|
class SpkAppItem : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
SpkAppItem(int appId, QWidget *parent = nullptr);
|
|
void SetIcon(QPixmap p) { mIcon->setPixmap(p); }
|
|
void SetTitle(QString s) { mTitle->setText(s); }
|
|
void SetDescription(QString s) { mDescription->setText(s); }
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *e);
|
|
void mousePressEvent(QMouseEvent *e);
|
|
void mouseReleaseEvent(QMouseEvent *e);
|
|
|
|
public:
|
|
static constexpr int IconSize = 72;
|
|
static constexpr QSize IconSize_ = { IconSize, IconSize };
|
|
|
|
private:
|
|
QLabel *mIcon;
|
|
QLabel *mTitle;
|
|
ElidedLabel *mDescription;
|
|
int mAppId;
|
|
|
|
bool mPressCond;
|
|
|
|
QVBoxLayout *mLayText;
|
|
QHBoxLayout *mMainLay;
|
|
|
|
signals:
|
|
void clicked(int);
|
|
};
|