Changeset View
Changeset View
Standalone View
Standalone View
src/klineedit.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
49 | } | 49 | } | ||
50 | 50 | | |||
51 | void KLineEditPrivate::_k_textChanged(const QString &text) | 51 | void KLineEditPrivate::_k_textChanged(const QString &text) | ||
52 | { | 52 | { | ||
53 | Q_Q(KLineEdit); | 53 | Q_Q(KLineEdit); | ||
54 | // COMPAT (as documented): emit userTextChanged whenever textChanged is emitted | 54 | // COMPAT (as documented): emit userTextChanged whenever textChanged is emitted | ||
55 | if (!completionRunning && (text != userText)) { | 55 | if (!completionRunning && (text != userText)) { | ||
56 | userText = text; | 56 | userText = text; | ||
57 | #ifndef KCOMPLETION_NO_DEPRECATED | 57 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(4, 5) | ||
58 | emit q->userTextChanged(text); | 58 | emit q->userTextChanged(text); | ||
59 | #endif | 59 | #endif | ||
60 | } | 60 | } | ||
61 | } | 61 | } | ||
62 | 62 | | |||
63 | // Call this when a completion operation changes the lineedit text | 63 | // Call this when a completion operation changes the lineedit text | ||
64 | // "as if it had been edited by the user". | 64 | // "as if it had been edited by the user". | ||
65 | void KLineEditPrivate::updateUserText(const QString &text) | 65 | void KLineEditPrivate::updateUserText(const QString &text) | ||
66 | { | 66 | { | ||
67 | Q_Q(KLineEdit); | 67 | Q_Q(KLineEdit); | ||
68 | if (!completionRunning && (text != userText)) { | 68 | if (!completionRunning && (text != userText)) { | ||
69 | userText = text; | 69 | userText = text; | ||
70 | q->setModified(true); | 70 | q->setModified(true); | ||
71 | #ifndef KCOMPLETION_NO_DEPRECATED | 71 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(4, 5) | ||
72 | emit q->userTextChanged(text); | 72 | emit q->userTextChanged(text); | ||
73 | #endif | 73 | #endif | ||
74 | emit q->textEdited(text); | 74 | emit q->textEdited(text); | ||
75 | emit q->textChanged(text); | 75 | emit q->textChanged(text); | ||
76 | } | 76 | } | ||
77 | } | 77 | } | ||
78 | 78 | | |||
79 | bool KLineEditPrivate::s_backspacePerformsCompletion = false; | 79 | bool KLineEditPrivate::s_backspacePerformsCompletion = false; | ||
▲ Show 20 Lines • Show All 70 Lines • ▼ Show 20 Line(s) | 149 | { | |||
150 | Q_D(KLineEdit); | 150 | Q_D(KLineEdit); | ||
151 | d->init(); | 151 | d->init(); | ||
152 | } | 152 | } | ||
153 | 153 | | |||
154 | KLineEdit::~KLineEdit() | 154 | KLineEdit::~KLineEdit() | ||
155 | { | 155 | { | ||
156 | } | 156 | } | ||
157 | 157 | | |||
158 | #ifndef KCOMPLETION_NO_DEPRECATED | 158 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 0) | ||
159 | QString KLineEdit::clickMessage() const | 159 | QString KLineEdit::clickMessage() const | ||
160 | { | 160 | { | ||
161 | return placeholderText(); | 161 | return placeholderText(); | ||
162 | } | 162 | } | ||
163 | #endif | 163 | #endif | ||
164 | 164 | | |||
165 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 46) | ||||
165 | void KLineEdit::setClearButtonShown(bool show) | 166 | void KLineEdit::setClearButtonShown(bool show) | ||
166 | { | 167 | { | ||
167 | setClearButtonEnabled(show); | 168 | setClearButtonEnabled(show); | ||
168 | } | 169 | } | ||
170 | #endif | ||||
169 | 171 | | |||
172 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 46) | ||||
170 | bool KLineEdit::isClearButtonShown() const | 173 | bool KLineEdit::isClearButtonShown() const | ||
171 | { | 174 | { | ||
172 | return isClearButtonEnabled(); | 175 | return isClearButtonEnabled(); | ||
173 | } | 176 | } | ||
177 | #endif | ||||
174 | 178 | | |||
175 | QSize KLineEdit::clearButtonUsedSize() const | 179 | QSize KLineEdit::clearButtonUsedSize() const | ||
176 | { | 180 | { | ||
177 | QSize s; | 181 | QSize s; | ||
178 | 182 | | |||
179 | if (isClearButtonEnabled()) { | 183 | if (isClearButtonEnabled()) { | ||
180 | // from qlineedit_p.cpp | 184 | // from qlineedit_p.cpp | ||
181 | 185 | | |||
▲ Show 20 Lines • Show All 885 Lines • ▼ Show 20 Line(s) | 1067 | connect(obj, &QObject::objectNameChanged, this, [this, obj] { | |||
1067 | } | 1071 | } | ||
1068 | }); | 1072 | }); | ||
1069 | } | 1073 | } | ||
1070 | } | 1074 | } | ||
1071 | 1075 | | |||
1072 | return QLineEdit::event(ev); | 1076 | return QLineEdit::event(ev); | ||
1073 | } | 1077 | } | ||
1074 | 1078 | | |||
1075 | #ifndef KCOMPLETION_NO_DEPRECATED | 1079 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 0) | ||
1076 | void KLineEdit::setUrlDropsEnabled(bool enable) | 1080 | void KLineEdit::setUrlDropsEnabled(bool enable) | ||
1077 | { | 1081 | { | ||
1078 | Q_D(KLineEdit); | 1082 | Q_D(KLineEdit); | ||
1079 | if (enable && !d->handleURLDrops) { | 1083 | if (enable && !d->handleURLDrops) { | ||
1080 | installEventFilter(d->urlDropEventFilter); | 1084 | installEventFilter(d->urlDropEventFilter); | ||
1081 | d->handleURLDrops = true; | 1085 | d->handleURLDrops = true; | ||
1082 | } else if (!enable && d->handleURLDrops) { | 1086 | } else if (!enable && d->handleURLDrops) { | ||
1083 | removeEventFilter(d->urlDropEventFilter); | 1087 | removeEventFilter(d->urlDropEventFilter); | ||
▲ Show 20 Lines • Show All 336 Lines • ▼ Show 20 Line(s) | 1408 | if (echoMode() == Password && d->threeStars) { | |||
1420 | setModified(isModifiedState); | 1424 | setModified(isModifiedState); | ||
1421 | blockSignals(false); | 1425 | blockSignals(false); | ||
1422 | setAttribute(Qt::WA_UpdatesDisabled, false); | 1426 | setAttribute(Qt::WA_UpdatesDisabled, false); | ||
1423 | } else { | 1427 | } else { | ||
1424 | QLineEdit::paintEvent(ev); | 1428 | QLineEdit::paintEvent(ev); | ||
1425 | } | 1429 | } | ||
1426 | } | 1430 | } | ||
1427 | 1431 | | |||
1428 | #ifndef KCOMPLETION_NO_DEPRECATED | 1432 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 0) | ||
1429 | void KLineEdit::setClickMessage(const QString &msg) | 1433 | void KLineEdit::setClickMessage(const QString &msg) | ||
1430 | { | 1434 | { | ||
1431 | setPlaceholderText(msg); | 1435 | setPlaceholderText(msg); | ||
1432 | } | 1436 | } | ||
1433 | #endif | 1437 | #endif | ||
1434 | 1438 | | |||
1435 | #ifndef KCOMPLETION_NO_DEPRECATED | 1439 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(4, 5) | ||
1436 | void KLineEdit::setContextMenuEnabled(bool showMenu) | 1440 | void KLineEdit::setContextMenuEnabled(bool showMenu) | ||
1437 | { | 1441 | { | ||
1438 | QLineEdit::setContextMenuPolicy(showMenu ? Qt::DefaultContextMenu : Qt::NoContextMenu); | 1442 | QLineEdit::setContextMenuPolicy(showMenu ? Qt::DefaultContextMenu : Qt::NoContextMenu); | ||
1439 | } | 1443 | } | ||
1440 | #endif | 1444 | #endif | ||
1441 | 1445 | | |||
1442 | #ifndef KCOMPLETION_NO_DEPRECATED | 1446 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(4, 5) | ||
1443 | bool KLineEdit::isContextMenuEnabled() const | 1447 | bool KLineEdit::isContextMenuEnabled() const | ||
1444 | { | 1448 | { | ||
1445 | return (contextMenuPolicy() == Qt::DefaultContextMenu); | 1449 | return (contextMenuPolicy() == Qt::DefaultContextMenu); | ||
1446 | } | 1450 | } | ||
1447 | #endif | 1451 | #endif | ||
1448 | 1452 | | |||
1449 | void KLineEdit::setPasswordMode(bool passwordMode) | 1453 | void KLineEdit::setPasswordMode(bool passwordMode) | ||
1450 | { | 1454 | { | ||
Show All 34 Lines |