Fixed stuff in user popup

This commit is contained in:
fourtf
2019-09-01 13:06:56 +02:00
parent b441e3e159
commit 5c0f81defd
8 changed files with 65 additions and 54 deletions
+13 -8
View File
@@ -38,14 +38,14 @@ const QPixmap &Button::getPixmap() const
return this->pixmap_;
}
void Button::setDim(bool value)
void Button::setDim(Dim value)
{
this->dimPixmap_ = value;
this->update();
}
bool Button::getDim() const
Button::Dim Button::getDim() const
{
return this->dimPixmap_;
}
@@ -76,7 +76,12 @@ bool Button::getEnableMargin() const
qreal Button::getCurrentDimAmount() const
{
return this->dimPixmap_ && !this->mouseOver_ ? 0.7 : 1;
if (this->dimPixmap_ == Dim::None || this->mouseOver_)
return 1;
else if (this->dimPixmap_ == Dim::Some)
return 0.7;
else
return 0.15;
}
void Button::setBorderColor(const QColor &color)
@@ -114,13 +119,13 @@ void Button::paintEvent(QPaintEvent *)
if (!this->pixmap_.isNull())
{
if (!this->mouseOver_ && this->dimPixmap_ && this->enabled_)
{
painter.setOpacity(this->getCurrentDimAmount());
}
painter.setOpacity(this->getCurrentDimAmount());
QRect rect = this->rect();
int s = this->enableMargin_ ? int(6 * this->scale()) : 0;
int margin = this->height() < 22 * this->scale() ? 3 : 6;
int s = this->enableMargin_ ? int(margin * this->scale()) : 0;
rect.moveLeft(s);
rect.setRight(rect.right() - s - s);