Commit aee2f88a authored by Olivier SOLDANO's avatar Olivier SOLDANO Committed by Anthony Léonard

refacto ring button

the button triggering the file selection now stays in a
correct shape when canceling the selection

Change-Id: I4384f3f815ec6ded857cf1e2d2b8901ae1f7f27d
Reviewed-by: default avatarAnthony Léonard <anthony.leonard@savoirfairelinux.com>
parent 1404f96e
......@@ -36,11 +36,20 @@ RingButton::~RingButton()
void
RingButton::setText(const QString& text)
{
ui->button->setText(text);
ui->button->resize(ui->button->sizeHint().width(),
ui->button->sizeHint().height());
if (! text.isEmpty() && ! text.isNull()) {
ui->button->setText(text);
ui->button->resize(ui->button->sizeHint().width(),
ui->button->sizeHint().height());
path_ = text;
}
}
QString RingButton::text()
{
return path_;
}
void
RingButton::mousePressEvent(QMouseEvent* event)
{
......
......@@ -31,12 +31,12 @@ public:
explicit RingButton(QWidget* parent = 0);
~RingButton();
void setText(const QString& text);
protected:
void mousePressEvent(QMouseEvent* event);
QString text();
private:
Ui::RingButton* ui;
QString path_ {};
void mousePressEvent(QMouseEvent* event);
signals:
void clicked() const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment