diff --git a/components/qtmaterialtextfield.cpp b/components/qtmaterialtextfield.cpp index ee877da..d1166d7 100644 --- a/components/qtmaterialtextfield.cpp +++ b/components/qtmaterialtextfield.cpp @@ -29,7 +29,7 @@ void QtMaterialTextFieldPrivate::init() label = 0; labelFontSize = 9.5; showLabel = false; - showUnderline = true; + showInputLine = true; useThemeColors = true; q->setFrame(false); @@ -211,44 +211,44 @@ QColor QtMaterialTextField::inkColor() const } } -void QtMaterialTextField::setUnderlineColor(const QColor &color) +void QtMaterialTextField::setInputLineColor(const QColor &color) { Q_D(QtMaterialTextField); - d->underlineColor = color; + d->inputLineColor = color; MATERIAL_DISABLE_THEME_COLORS d->stateMachine->setupProperties(); } -QColor QtMaterialTextField::underlineColor() const +QColor QtMaterialTextField::inputLineColor() const { Q_D(const QtMaterialTextField); - if (d->useThemeColors || !d->underlineColor.isValid()) { + if (d->useThemeColors || !d->inputLineColor.isValid()) { return QtMaterialStyle::instance().themeColor("border"); } else { - return d->underlineColor; + return d->inputLineColor; } } -void QtMaterialTextField::setShowUnderline(bool value) +void QtMaterialTextField::setShowInputLine(bool value) { Q_D(QtMaterialTextField); - if (d->showUnderline == value) { + if (d->showInputLine == value) { return; } - d->showUnderline = value; + d->showInputLine = value; update(); } -bool QtMaterialTextField::hasUnderline() const +bool QtMaterialTextField::hasInputLine() const { Q_D(const QtMaterialTextField); - return d->showUnderline; + return d->showInputLine; } /*! @@ -294,11 +294,11 @@ void QtMaterialTextField::paintEvent(QPaintEvent *event) const int y = height()-1; const int wd = width()-5; - if (d->showUnderline) + if (d->showInputLine) { QPen pen; pen.setWidth(1); - pen.setColor(underlineColor()); + pen.setColor(inputLineColor()); painter.setPen(pen); painter.setOpacity(1); painter.drawLine(QLineF(2.5, y, wd, y)); diff --git a/components/qtmaterialtextfield.h b/components/qtmaterialtextfield.h index d4a12f6..0d09a57 100644 --- a/components/qtmaterialtextfield.h +++ b/components/qtmaterialtextfield.h @@ -12,7 +12,7 @@ class QtMaterialTextField : public QLineEdit Q_PROPERTY(QColor textColor WRITE setTextColor READ textColor) Q_PROPERTY(QColor inkColor WRITE setInkColor READ inkColor) - Q_PROPERTY(QColor underlineColor WRITE setUnderlineColor READ underlineColor) + Q_PROPERTY(QColor inputLineColor WRITE setInputLineColor READ inputLineColor) public: explicit QtMaterialTextField(QWidget *parent = 0); @@ -39,11 +39,11 @@ public: void setInkColor(const QColor &color); QColor inkColor() const; - void setUnderlineColor(const QColor &color); - QColor underlineColor() const; + void setInputLineColor(const QColor &color); + QColor inputLineColor() const; - void setShowUnderline(bool value); - bool hasUnderline() const; + void setShowInputLine(bool value); + bool hasInputLine() const; protected: bool event(QEvent *event) Q_DECL_OVERRIDE; diff --git a/components/qtmaterialtextfield_p.h b/components/qtmaterialtextfield_p.h index 51d7cc1..aab57d7 100644 --- a/components/qtmaterialtextfield_p.h +++ b/components/qtmaterialtextfield_p.h @@ -25,11 +25,11 @@ public: QColor textColor; QColor labelColor; QColor inkColor; - QColor underlineColor; + QColor inputLineColor; QString labelString; qreal labelFontSize; bool showLabel; - bool showUnderline; + bool showInputLine; bool useThemeColors; }; diff --git a/examples/textfieldsettingseditor.cpp b/examples/textfieldsettingseditor.cpp index ce21cd1..2b7fa8d 100644 --- a/examples/textfieldsettingseditor.cpp +++ b/examples/textfieldsettingseditor.cpp @@ -39,9 +39,9 @@ TextFieldSettingsEditor::TextFieldSettingsEditor(QWidget *parent) connect(ui->useThemeColorsCheckBox, SIGNAL(toggled(bool)), this, SLOT(updateWidget())); connect(ui->textColorToolButton, SIGNAL(pressed()), this, SLOT(selectColor())); connect(ui->inkColorToolButton, SIGNAL(pressed()), this, SLOT(selectColor())); - connect(ui->underlineColorToolButton, SIGNAL(pressed()), this, SLOT(selectColor())); + connect(ui->inputLineColorToolButton, SIGNAL(pressed()), this, SLOT(selectColor())); connect(ui->labelColorToolButton, SIGNAL(pressed()), this, SLOT(selectColor())); - connect(ui->underlineCheckBox, SIGNAL(toggled(bool)), this, SLOT(setShowUnderline())); + connect(ui->inputLineCheckBox, SIGNAL(toggled(bool)), this, SLOT(setShowInputLine())); connect(m_textField, SIGNAL(textChanged(QString)), this, SLOT(setupForm())); } @@ -59,7 +59,7 @@ void TextFieldSettingsEditor::setupForm() ui->labelCheckBox->setChecked(m_textField->hasLabel()); ui->labelTextLineEdit->setText(m_textField->label()); ui->useThemeColorsCheckBox->setChecked(m_textField->useThemeColors()); - ui->underlineCheckBox->setChecked(m_textField->hasUnderline()); + ui->inputLineCheckBox->setChecked(m_textField->hasInputLine()); } void TextFieldSettingsEditor::updateWidget() @@ -70,7 +70,7 @@ void TextFieldSettingsEditor::updateWidget() m_textField->setLabel(ui->labelTextLineEdit->text()); m_textField->setShowLabel(ui->labelCheckBox->isChecked()); m_textField->setUseThemeColors(ui->useThemeColorsCheckBox->isChecked()); - m_textField->setShowUnderline(ui->underlineCheckBox->isChecked()); + m_textField->setShowInputLine(ui->inputLineCheckBox->isChecked()); } void TextFieldSettingsEditor::selectColor() @@ -85,9 +85,9 @@ void TextFieldSettingsEditor::selectColor() } else if ("inkColorToolButton" == senderName) { m_textField->setInkColor(color); ui->inkColorLineEdit->setText(color.name(QColor::HexRgb)); - } else if ("underlineColorToolButton" == senderName) { - m_textField->setUnderlineColor(color); - ui->underlineColorLineEdit->setText(color.name(QColor::HexRgb)); + } else if ("inputLineColorToolButton" == senderName) { + m_textField->setInputLineColor(color); + ui->inputLineColorLineEdit->setText(color.name(QColor::HexRgb)); } else if ("labelColorToolButton" == senderName) { m_textField->setLabelColor(color); ui->labelColorLineEdit->setText(color.name(QColor::HexRgb)); @@ -96,7 +96,7 @@ void TextFieldSettingsEditor::selectColor() setupForm(); } -void TextFieldSettingsEditor::setShowUnderline() +void TextFieldSettingsEditor::setShowInputLine() { - m_textField->setShowUnderline( ui->underlineCheckBox->isChecked() ); + m_textField->setShowInputLine( ui->inputLineCheckBox->isChecked() ); } diff --git a/examples/textfieldsettingseditor.h b/examples/textfieldsettingseditor.h index 6631e27..57f0d0f 100644 --- a/examples/textfieldsettingseditor.h +++ b/examples/textfieldsettingseditor.h @@ -18,7 +18,7 @@ protected slots: void setupForm(); void updateWidget(); void selectColor(); - void setShowUnderline(); + void setShowInputLine(); private: Ui::TextFieldSettingsForm *const ui; diff --git a/examples/textfieldsettingsform.ui b/examples/textfieldsettingsform.ui index 12e1c87..861ca55 100644 --- a/examples/textfieldsettingsform.ui +++ b/examples/textfieldsettingsform.ui @@ -126,19 +126,19 @@ - + - Underline color + Input line color - + - + ... @@ -168,14 +168,14 @@ - + - Underline + Input line - +