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.
41 lines
812 B
C++
41 lines
812 B
C++
#ifndef FAVBUTTON_H
|
|
#define FAVBUTTON_H
|
|
|
|
#include <QToolButton>
|
|
#include <QProxyStyle>
|
|
|
|
class FavButtonStyle : public QProxyStyle
|
|
{
|
|
public:
|
|
FavButtonStyle();
|
|
~FavButtonStyle() override = default;
|
|
|
|
// QStyle interface
|
|
public:
|
|
void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole) const override;
|
|
|
|
private:
|
|
Q_DISABLE_COPY(FavButtonStyle)
|
|
};
|
|
|
|
class FavButton : public QToolButton
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit FavButton(QWidget *parent = nullptr);
|
|
|
|
signals:
|
|
void itemDropped();
|
|
|
|
// QWidget interface
|
|
protected:
|
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
|
void dropEvent(QDropEvent *event) override;
|
|
|
|
private:
|
|
FavButtonStyle m_style;
|
|
};
|
|
|
|
#endif // FAVBUTTON_H
|