You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.0 KiB
C++
65 lines
1.0 KiB
C++
#ifndef CFONTVIEW_H
|
|
#define CFONTVIEW_H
|
|
|
|
|
|
#include <QWidget>
|
|
#include <QColor>
|
|
#include <QMouseEvent>
|
|
|
|
#include <QList>
|
|
|
|
|
|
namespace Ui {
|
|
class cFontView;
|
|
}
|
|
|
|
class cFontView : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit cFontView(QWidget *parent = nullptr);
|
|
~cFontView() override;
|
|
|
|
void setText(const QString& text);
|
|
void setFont(const QFont& font);
|
|
void setBackground(const QColor& color);
|
|
void setForeground(const QColor& color);
|
|
|
|
private:
|
|
Ui::cFontView* ui;
|
|
QColor m_backgroundColor;
|
|
QColor m_foregroundColor;
|
|
QColor m_defaultColor;
|
|
QColor m_selectedColor;
|
|
|
|
void setColor();
|
|
|
|
protected:
|
|
void enterEvent(QEvent *ev) override;
|
|
void leaveEvent(QEvent *ev) override;
|
|
|
|
public slots:
|
|
void windowEntered();
|
|
void windowLeft();
|
|
};
|
|
|
|
Q_DECLARE_METATYPE(cFontView*)
|
|
|
|
class cFontViewList : public QObject, public QList<cFontView*>
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit cFontViewList(QObject* parent = nullptr);
|
|
|
|
void add(cFontView* fontView);
|
|
void clearAll();
|
|
|
|
signals:
|
|
|
|
public slots:
|
|
};
|
|
|
|
#endif // CFONTVIEW_H
|