Rename underscore to underline

This commit is contained in:
johanneshilden 2017-10-05 17:35:22 +03:00
parent 85310163dd
commit 776e089399
3 changed files with 25 additions and 19 deletions

View File

@ -29,7 +29,7 @@ void QtMaterialTextFieldPrivate::init()
label = 0;
labelFontSize = 9.5;
showLabel = false;
showUnderscore = true;
showUnderline = true;
useThemeColors = true;
q->setFrame(false);
@ -232,19 +232,24 @@ QColor QtMaterialTextField::underlineColor() const
}
}
void QtMaterialTextField::setShowUnderscore(bool value)
void QtMaterialTextField::setShowUnderline(bool value)
{
Q_D(QtMaterialTextField);
if (d->showUnderscore == value) {
if (d->showUnderline == value) {
return;
}
d->showUnderscore = value;
d->showUnderline = value;
update();
}
bool QtMaterialTextField::hasUnderline() const
{
Q_D(const QtMaterialTextField);
return d->showUnderline;
}
/*!
* \reimp
@ -289,8 +294,7 @@ void QtMaterialTextField::paintEvent(QPaintEvent *event)
const int y = height()-1;
const int wd = width()-5;
if( d->showUnderscore )
if (d->showUnderline)
{
QPen pen;
pen.setWidth(1);
@ -299,16 +303,16 @@ void QtMaterialTextField::paintEvent(QPaintEvent *event)
painter.setOpacity(1);
painter.drawLine(2.5, y, wd, y);
QBrush brush;
brush.setStyle(Qt::SolidPattern);
brush.setColor(inkColor());
QBrush brush;
brush.setStyle(Qt::SolidPattern);
brush.setColor(inkColor());
if (progress > 0)
{
painter.setPen(Qt::NoPen);
painter.setBrush(brush);
const int w = (1-progress)*static_cast<qreal>(wd/2);
painter.drawRect(w+2.5, height()-2, wd-w*2, 2);
}
if (progress > 0)
{
painter.setPen(Qt::NoPen);
painter.setBrush(brush);
const int w = (1-progress)*static_cast<qreal>(wd/2);
painter.drawRect(w+2.5, height()-2, wd-w*2, 2);
}
}
}

View File

@ -41,7 +41,9 @@ public:
void setUnderlineColor(const QColor &color);
QColor underlineColor() const;
void setShowUnderscore(bool value);
void setShowUnderline(bool value);
bool hasUnderline() const;
protected:
bool event(QEvent *event) Q_DECL_OVERRIDE;

View File

@ -29,7 +29,7 @@ public:
QString labelString;
qreal labelFontSize;
bool showLabel;
bool showUnderscore;
bool showUnderline;
bool useThemeColors;
};