configpanelbutton.h 1.15 KB
#ifndef CONFIGPANELBUTTON_H
#define CONFIGPANELBUTTON_H

#include <QWidget>

namespace Ui {
class ConfigPanelButton;
}

class ConfigPanelButton : public QWidget
{
    Q_OBJECT

public:
    explicit ConfigPanelButton(QWidget *parent = 0,uint16_t id = 0);
    ~ConfigPanelButton();

    const QString &text() { return text_; }
    const QString &value() { return value_; }

public slots:
    void setText(const QString &text);
    void setValue(const QString &value);
    void showFavoriteButton();
    void hideFavoriteButton();
    bool isFavoriteChecked();
    void setFavoriteCheck(bool checked);

private:
    Ui::ConfigPanelButton *ui;

    QString text_;
    QString value_;

    QRect textRect;
    QRect valueRect;

    bool showingFavoriteButton;
    bool isFavorited;
    uint16_t btnid;

private slots:
    void updateIcon();

    void on_favoriteButton_clicked(bool checked);

    void on_pushButton_clicked();

    void on_pushButton_released();

    void on_pushButton_pressed();

signals:
    void pressed(uint16_t);
    void released(uint16_t);
    void clicked(uint16_t);
    void checkButtonClicked(uint16_t, bool checked);
};

#endif // CONFIGPANELBUTTON_H