Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: from linuxdeepin/dtkwidget #30

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions src/widgets/dlineedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,6 @@ void DLineEdit::setEchoMode(QLineEdit::EchoMode mode)
{
D_D(DLineEdit);
d->lineEdit->setEchoMode(mode);
d->updateFont();
}

/*!
Expand Down Expand Up @@ -668,8 +667,6 @@ bool DLineEdit::eventFilter(QObject *watched, QEvent *event)
event->accept();
pLineEdit->setFocus();
return true;
} else if (event->type() == QEvent::FontChange) {
d->updateFont();
}

// if (d->frame)
Expand Down Expand Up @@ -705,20 +702,7 @@ DLineEditPrivate::DLineEditPrivate(DLineEdit *q)

void DLineEditPrivate::updateTooltipPos()
{
}

void DLineEditPrivate::updateFont()
{
Q_Q(DLineEdit);

if (lineEdit->echoMode() == QLineEdit::Password) {
QFont passwordFont = lineEdit->font();
passwordFont.setPixelSize(6);
passwordFont.setLetterSpacing(passwordFont.letterSpacingType(), 200);
lineEdit->setFont(passwordFont);
} else {
lineEdit->setFont(q->font());
}
//control->updateTooltipPos();
}

void DLineEditPrivate::init()
Expand Down Expand Up @@ -748,8 +732,6 @@ void DLineEditPrivate::init()
q->connect(lineEdit, &QLineEdit::returnPressed, q, &DLineEdit::returnPressed);
q->connect(lineEdit, &QLineEdit::editingFinished, q, &DLineEdit::editingFinished);
q->connect(lineEdit, &QLineEdit::selectionChanged, q, &DLineEdit::selectionChanged);

updateFont();
}

DWIDGET_END_NAMESPACE
2 changes: 1 addition & 1 deletion src/widgets/dpasswordedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void DPasswordEditPrivate::init()
{
D_Q(DPasswordEdit);

q->DLineEdit::setEchoMode(QLineEdit::Password);
q->lineEdit()->setEchoMode(QLineEdit::Password);
q->lineEdit()->setAttribute(Qt::WA_InputMethodEnabled, false);

QList<QWidget *> list;
Expand Down
2 changes: 1 addition & 1 deletion src/widgets/dstyle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2025,7 +2025,7 @@ int DStyle::styleHint(QStyle::StyleHint sh, const QStyleOption *opt, const QWidg
case SH_ScrollView_FrameOnlyAroundContents:
return false;
case SH_LineEdit_PasswordCharacter:
return 0x25CF;
return 0x26AB;
default:
break;
}
Expand Down
1 change: 0 additions & 1 deletion src/widgets/private/dlineedit_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
Q_DECLARE_PUBLIC(DLineEdit)

public:
DLineEditPrivate(DLineEdit *q);

Check warning on line 24 in src/widgets/private/dlineedit_p.h

View workflow job for this annotation

GitHub Actions / cppcheck

Class 'DLineEditPrivate' has a constructor with 1 argument that is not explicit. Such constructors should in general be explicit for type safety reasons. Using the explicit keyword in the constructor means some mistakes when using the class can be avoided.
void updateTooltipPos();
void updateFont();

void init();

Expand Down
Loading