bunch of stuff. very basic drag/drop now working
This commit is contained in:
49
tiercard.hpp
Normal file
49
tiercard.hpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef TIERCARD_H
|
||||
#define TIERCARD_H
|
||||
|
||||
#include "aspectratiopixmaplabel.hpp"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QColor>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
class TierCard : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using IdType = uint32_t;
|
||||
inline static const char* MimeType = "application/x-tiercard";
|
||||
TierCard(TierCard const&) = delete;
|
||||
~TierCard();
|
||||
static TierCard* create(QWidget *parent = nullptr);
|
||||
static TierCard* clone(TierCard *other, QWidget* parent = nullptr);
|
||||
static TierCard* getFromId(IdType id);
|
||||
void setText(QString str);
|
||||
QString getText() const;
|
||||
void setImage(const QPixmap img);
|
||||
QPixmap getImage() const;
|
||||
IdType getId() const;
|
||||
void setBgColor(QColor color);
|
||||
QColor getBgColor();
|
||||
// QColor bg_color() const;
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
private:
|
||||
explicit TierCard(IdType id, QWidget *parent = nullptr);
|
||||
QWidget* background;
|
||||
AspectRatioPixmapLabel* image;
|
||||
QLabel* textLabel;
|
||||
QLabel* idLabel;
|
||||
QColor bgColor;
|
||||
static IdType getAvailableId();
|
||||
static void releaseId(IdType id);
|
||||
inline static std::unordered_map<IdType, TierCard*> idMap;
|
||||
|
||||
signals:
|
||||
};
|
||||
|
||||
#endif // TIERCARD_H
|
||||
Reference in New Issue
Block a user