Changeset View
Changeset View
Standalone View
Standalone View
src/klineedit.h
Show First 20 Lines • Show All 151 Lines • ▼ Show 20 Line(s) | |||||
152 | 152 | | |||
153 | class KCOMPLETION_EXPORT KLineEdit : public QLineEdit, public KCompletionBase //krazy:exclude=qclasses | 153 | class KCOMPLETION_EXPORT KLineEdit : public QLineEdit, public KCompletionBase //krazy:exclude=qclasses | ||
154 | { | 154 | { | ||
155 | friend class KComboBox; | 155 | friend class KComboBox; | ||
156 | friend class KLineEditStyle; | 156 | friend class KLineEditStyle; | ||
157 | 157 | | |||
158 | Q_OBJECT | 158 | Q_OBJECT | ||
159 | Q_DECLARE_PRIVATE(KLineEdit) | 159 | Q_DECLARE_PRIVATE(KLineEdit) | ||
160 | #ifndef KCOMPLETION_NO_DEPRECATED | 160 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(4, 5) | ||
161 | Q_PROPERTY(bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled) | 161 | Q_PROPERTY(bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled) | ||
162 | #endif | 162 | #endif | ||
163 | #ifndef KCOMPLETION_NO_DEPRECATED | 163 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 0) | ||
164 | Q_PROPERTY(bool urlDropsEnabled READ urlDropsEnabled WRITE setUrlDropsEnabled) | 164 | Q_PROPERTY(bool urlDropsEnabled READ urlDropsEnabled WRITE setUrlDropsEnabled) | ||
165 | #endif | 165 | #endif | ||
166 | Q_PROPERTY(bool trapEnterKeyEvent READ trapReturnKey WRITE setTrapReturnKey) | 166 | Q_PROPERTY(bool trapEnterKeyEvent READ trapReturnKey WRITE setTrapReturnKey) | ||
167 | Q_PROPERTY(bool squeezedTextEnabled READ isSqueezedTextEnabled WRITE setSqueezedTextEnabled) | 167 | Q_PROPERTY(bool squeezedTextEnabled READ isSqueezedTextEnabled WRITE setSqueezedTextEnabled) | ||
168 | #ifndef KCOMPLETION_NO_DEPRECATED | 168 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 0) | ||
169 | Q_PROPERTY(QString clickMessage READ clickMessage WRITE setClickMessage) | 169 | Q_PROPERTY(QString clickMessage READ clickMessage WRITE setClickMessage) | ||
170 | #endif | 170 | #endif | ||
171 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(5, 46) | ||||
171 | Q_PROPERTY(bool showClearButton READ isClearButtonShown WRITE setClearButtonShown) | 172 | Q_PROPERTY(bool showClearButton READ isClearButtonShown WRITE setClearButtonShown) | ||
173 | #endif | ||||
172 | Q_PROPERTY(bool passwordMode READ passwordMode WRITE setPasswordMode) | 174 | Q_PROPERTY(bool passwordMode READ passwordMode WRITE setPasswordMode) | ||
173 | 175 | | |||
174 | public: | 176 | public: | ||
175 | 177 | | |||
176 | /** | 178 | /** | ||
177 | * Constructs a KLineEdit object with a default text, a parent, | 179 | * Constructs a KLineEdit object with a default text, a parent, | ||
178 | * and a name. | 180 | * and a name. | ||
179 | * | 181 | * | ||
Show All 32 Lines | |||||
212 | /** | 214 | /** | ||
213 | * Disables completion modes by makeing them non-checkable. | 215 | * Disables completion modes by makeing them non-checkable. | ||
214 | * | 216 | * | ||
215 | * The context menu allows to change the completion mode. | 217 | * The context menu allows to change the completion mode. | ||
216 | * This method allows to disable some modes. | 218 | * This method allows to disable some modes. | ||
217 | */ | 219 | */ | ||
218 | void setCompletionModeDisabled(KCompletion::CompletionMode mode, bool disable = true); | 220 | void setCompletionModeDisabled(KCompletion::CompletionMode mode, bool disable = true); | ||
219 | 221 | | |||
222 | #if KCOMPLETION_BUILD_DEPRECATED_SINCE(4, 5) | ||||
220 | /** | 223 | /** | ||
221 | * Enables/disables the popup (context) menu. | 224 | * Enables/disables the popup (context) menu. | ||
222 | * | 225 | * | ||
223 | * This method only works if this widget is editable, i.e. read-write and | 226 | * This method only works if this widget is editable, i.e. read-write and | ||
224 | * allows you to enable/disable the context menu. It does nothing if invoked | 227 | * allows you to enable/disable the context menu. It does nothing if invoked | ||
225 | * for a none-editable combo-box. | 228 | * for a none-editable combo-box. | ||
226 | * | 229 | * | ||
227 | * By default, the context menu is created if this widget is editable. | 230 | * By default, the context menu is created if this widget is editable. | ||
228 | * Call this function with the argument set to false to disable the popup | 231 | * Call this function with the argument set to false to disable the popup | ||
229 | * menu. | 232 | * menu. | ||
230 | * | 233 | * | ||
231 | * @param showMenu If @c true, show the context menu. | 234 | * @param showMenu If @c true, show the context menu. | ||
232 | * @deprecated since 4.5, use setContextMenuPolicy instead | 235 | * @deprecated since 4.5, use setContextMenuPolicy instead | ||
233 | */ | 236 | */ | ||
234 | #ifndef KCOMPLETION_NO_DEPRECATED | 237 | KCOMPLETION_DEPRECATED_VERSION(4, 5, "Use QWidget::setContextMenuPolicy(Qt::ContextMenuPolicy)") | ||
235 | virtual KCOMPLETION_DEPRECATED void setContextMenuEnabled(bool showMenu); | 238 | virtual void setContextMenuEnabled(bool showMenu); | ||
236 | #endif | 239 | #endif | ||
237 | 240 | | |||
241 | #if KCOMPLETION_ENABLE_DEPRECATED_SINCE(4, 5) | ||||
238 | /** | 242 | /** | ||
239 | * Returns @c true when the context menu is enabled. | 243 | * Returns @c true when the context menu is enabled. | ||
240 | * @deprecated since 4.5, use contextMenuPolicy instead | 244 | * @deprecated since 4.5, use contextMenuPolicy instead | ||
241 | */ | 245 | */ | ||
242 | #ifndef KCOMPLETION_NO_DEPRECATED | 246 | KCOMPLETION_DEPRECATED_VERSION(4, 5, "Use QWidget::contextMenuPolicy()") | ||
243 | KCOMPLETION_DEPRECATED bool isContextMenuEnabled() const; | 247 | bool isContextMenuEnabled() const; | ||
244 | #endif | 248 | #endif | ||
245 | 249 | | |||
246 | /** | 250 | /** | ||
247 | * Enables/Disables handling of URL drops. If enabled and the user | 251 | * Enables/Disables handling of URL drops. If enabled and the user | ||
248 | * drops an URL, the decoded URL will be inserted. Otherwise the default | 252 | * drops an URL, the decoded URL will be inserted. Otherwise the default | ||
249 | * behavior of QLineEdit is used, which inserts the encoded URL. | 253 | * behavior of QLineEdit is used, which inserts the encoded URL. | ||
250 | * Call setUrlDropsEnabled(false) if you need dropEvent to be called in a KLineEdit subclass. | 254 | * Call setUrlDropsEnabled(false) if you need dropEvent to be called in a KLineEdit subclass. | ||
251 | * | 255 | * | ||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | |||||
337 | * Set the completion-box to be used in completion mode | 341 | * Set the completion-box to be used in completion mode | ||
338 | * CompletionPopup. | 342 | * CompletionPopup. | ||
339 | * This will do nothing if a completion-box already exists. | 343 | * This will do nothing if a completion-box already exists. | ||
340 | * | 344 | * | ||
341 | * @param box The KCompletionBox to set | 345 | * @param box The KCompletionBox to set | ||
342 | */ | 346 | */ | ||
343 | void setCompletionBox(KCompletionBox *box); | 347 | void setCompletionBox(KCompletionBox *box); | ||
344 | 348 | | |||
349 | #if KCOMPLETION_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
345 | /** | 350 | /** | ||
346 | * This makes the line edit display a grayed-out hinting text as long as | 351 | * This makes the line edit display a grayed-out hinting text as long as | ||
347 | * the user didn't enter any text. It is often used as indication about | 352 | * the user didn't enter any text. It is often used as indication about | ||
348 | * the purpose of the line edit. | 353 | * the purpose of the line edit. | ||
349 | * @deprecated since 5.0, use QLineEdit::setPlaceholderText instead. | 354 | * @deprecated since 5.0, use QLineEdit::setPlaceholderText instead. | ||
350 | */ | 355 | */ | ||
351 | #ifndef KCOMPLETION_NO_DEPRECATED | 356 | KCOMPLETION_DEPRECATED_VERSION(5, 0, "Use QLineEdit::setPlaceholderText(const QString&)") | ||
352 | KCOMPLETION_DEPRECATED void setClickMessage(const QString &msg); | 357 | void setClickMessage(const QString &msg); | ||
353 | #endif | 358 | #endif | ||
354 | 359 | | |||
360 | #if KCOMPLETION_ENABLE_DEPRECATED_SINCE(5, 0) | ||||
355 | /** | 361 | /** | ||
356 | * @return the message set with setClickMessage | 362 | * @return the message set with setClickMessage | ||
357 | * @deprecated since 5.0, use QLineEdit::placeholderText instead. | 363 | * @deprecated since 5.0, use QLineEdit::placeholderText instead. | ||
358 | */ | 364 | */ | ||
359 | #ifndef KCOMPLETION_NO_DEPRECATED | 365 | KCOMPLETION_DEPRECATED_VERSION(5, 0, "Use QLineEdit::placeholderText()") | ||
360 | KCOMPLETION_DEPRECATED QString clickMessage() const; | 366 | QString clickMessage() const; | ||
361 | #endif | 367 | #endif | ||
362 | 368 | | |||
369 | #if KCOMPLETION_ENABLE_DEPRECATED_SINCE(5, 46) | ||||
363 | /** | 370 | /** | ||
364 | * This makes the line edit display an icon on one side of the line edit | 371 | * This makes the line edit display an icon on one side of the line edit | ||
365 | * which, when clicked, clears the contents of the line edit. | 372 | * which, when clicked, clears the contents of the line edit. | ||
366 | * This is useful for such things as location or search bars. | 373 | * This is useful for such things as location or search bars. | ||
367 | * | 374 | * | ||
368 | * @deprecated since 5.46 Use QLineEdit::setClearButtonEnabled | 375 | * @deprecated since 5.46 Use QLineEdit::setClearButtonEnabled | ||
369 | **/ | 376 | **/ | ||
370 | #ifndef KCOMPLETION_NO_DEPRECATED | 377 | KCOMPLETION_DEPRECATED_VERSION(5, 46, "Use QLineEdit::setClearButtonEnabled(bool)") | ||
371 | KCOMPLETION_DEPRECATED void setClearButtonShown(bool show); | 378 | void setClearButtonShown(bool show); | ||
372 | #endif | 379 | #endif | ||
373 | 380 | | |||
381 | #if KCOMPLETION_ENABLE_DEPRECATED_SINCE(5, 46) | ||||
374 | /** | 382 | /** | ||
375 | * @return whether or not the clear button is shown | 383 | * @return whether or not the clear button is shown | ||
376 | * | 384 | * | ||
377 | * @deprecated since 5.46 Use QLineEdit::isClearButtonEnabled | 385 | * @deprecated since 5.46 Use QLineEdit::isClearButtonEnabled | ||
378 | **/ | 386 | **/ | ||
379 | #ifndef KCOMPLETION_NO_DEPRECATED | 387 | KCOMPLETION_DEPRECATED_VERSION(5, 46, "Use QLineEdit::isClearButtonEnabled()") | ||
380 | KCOMPLETION_DEPRECATED bool isClearButtonShown() const; | 388 | bool isClearButtonShown() const; | ||
381 | #endif | 389 | #endif | ||
382 | 390 | | |||
383 | /** | 391 | /** | ||
384 | * @return the size used by the clear button | 392 | * @return the size used by the clear button | ||
385 | * @since 4.1 | 393 | * @since 4.1 | ||
386 | **/ | 394 | **/ | ||
387 | QSize clearButtonUsedSize() const; | 395 | QSize clearButtonUsedSize() const; | ||
388 | 396 | | |||
Show All 31 Lines | 406 | Q_SIGNALS: | |||
420 | */ | 428 | */ | ||
421 | void completion(const QString &); | 429 | void completion(const QString &); | ||
422 | 430 | | |||
423 | /** | 431 | /** | ||
424 | * Emitted when the shortcut for substring completion is pressed. | 432 | * Emitted when the shortcut for substring completion is pressed. | ||
425 | */ | 433 | */ | ||
426 | void substringCompletion(const QString &); | 434 | void substringCompletion(const QString &); | ||
427 | 435 | | |||
436 | #if KCOMPLETION_ENABLE_DEPRECATED_SINCE(4, 5) | ||||
428 | /** | 437 | /** | ||
429 | * Emitted when the text is changed NOT by the suggested autocompletion: | 438 | * Emitted when the text is changed NOT by the suggested autocompletion: | ||
430 | * either when the user is physically typing keys, or when the text is changed programmatically, | 439 | * either when the user is physically typing keys, or when the text is changed programmatically, | ||
431 | * for example, by calling setText(). | 440 | * for example, by calling setText(). | ||
432 | * But not when automatic completion changes the text temporarily. | 441 | * But not when automatic completion changes the text temporarily. | ||
433 | * | 442 | * | ||
434 | * @since 4.2.2 | 443 | * @since 4.2.2 | ||
435 | * @deprecated since 4.5. You probably want to connect to textEdited() instead, | 444 | * @deprecated since 4.5. You probably want to connect to textEdited() instead, | ||
436 | * which is emitted whenever the text is actually changed by the user | 445 | * which is emitted whenever the text is actually changed by the user | ||
437 | * (by typing or accepting autocompletion), without side effects from | 446 | * (by typing or accepting autocompletion), without side effects from | ||
438 | * suggested autocompletion either. userTextChanged isn't needed anymore. | 447 | * suggested autocompletion either. userTextChanged isn't needed anymore. | ||
439 | */ | 448 | */ | ||
440 | #ifndef KCOMPLETION_NO_DEPRECATED | 449 | KCOMPLETION_DEPRECATED_VERSION(4, 5, "Use QLineEdit::textEdited(const QString&)") | ||
441 | QT_MOC_COMPAT void userTextChanged(const QString &); | 450 | QT_MOC_COMPAT void userTextChanged(const QString &); | ||
442 | #endif | 451 | #endif | ||
443 | 452 | | |||
444 | /** | 453 | /** | ||
445 | * Emitted when the text rotation key-bindings are pressed. | 454 | * Emitted when the text rotation key-bindings are pressed. | ||
446 | * | 455 | * | ||
447 | * The argument indicates which key-binding was pressed. | 456 | * The argument indicates which key-binding was pressed. | ||
448 | * In KLineEdit's case this can be either one of two values: | 457 | * In KLineEdit's case this can be either one of two values: | ||
▲ Show 20 Lines • Show All 196 Lines • Show Last 20 Lines |