• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • kdeui
  • widgets
kcombobox.h
Go to the documentation of this file.
1/* This file is part of the KDE libraries
2
3 Copyright (c) 2000,2001 Dawit Alemayehu <adawit@kde.org>
4 Copyright (c) 2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License (LGPL) as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
20*/
21
22#ifndef KCOMBOBOX_H
23#define KCOMBOBOX_H
24
25#include <QtGui/QComboBox>
26
27#include <kcompletion.h>
28
29class QLineEdit;
30class QMenu;
31
32class KCompletionBox;
33class KUrl;
34
35/*
36 * ### KDE 5: On all methods that it is said that a prettyUrl will be used, it
37 * would be nice to add a flag to the method for forcing the pretty
38 * url or not. (ereslibre)
39 */
40
148class KDEUI_EXPORT KComboBox : public QComboBox, public KCompletionBase //krazy:exclude=qclasses
149{
150 Q_OBJECT
151 Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion )
152 Q_PROPERTY( bool urlDropsEnabled READ urlDropsEnabled WRITE setUrlDropsEnabled )
153 Q_PROPERTY( bool trapReturnKey READ trapReturnKey WRITE setTrapReturnKey )
154
155public:
156
163 explicit KComboBox( QWidget *parent=0 );
164
173 explicit KComboBox( bool rw, QWidget *parent=0 );
174
178 virtual ~KComboBox();
179
184#ifndef KDE_NO_DEPRECATED
185 KDE_DEPRECATED void insertURL( const KUrl& url, int index = -1 )
186 { insertUrl( index < 0 ? count() : index, url ); }
187 KDE_DEPRECATED void insertURL( const QPixmap& pixmap, const KUrl& url, int index = -1 )
188 { insertUrl( index < 0 ? count() : index, QIcon(pixmap), url ); }
189 KDE_DEPRECATED void changeURL( const KUrl& url, int index )
190 { changeUrl( index, url ); }
191 KDE_DEPRECATED void changeURL( const QPixmap& pixmap, const KUrl& url, int index )
192 { changeUrl( index, QIcon(pixmap), url ); }
193#endif
194
200 void setEditUrl( const KUrl& url );
201
207 void addUrl( const KUrl& url );
208
214 void addUrl( const QIcon& icon, const KUrl& url );
215
221 void insertUrl( int index, const KUrl& url );
222
228 void insertUrl( int index, const QIcon& icon, const KUrl& url );
229
235 void changeUrl( int index, const KUrl& url );
236
242 void changeUrl( int index , const QIcon& icon, const KUrl& url);
243
252 int cursorPosition() const;
253
264 virtual void setAutoCompletion( bool autocomplete );
265
275 bool autoCompletion() const;
276
291#ifndef KDE_NO_DEPRECATED
292 virtual KDE_DEPRECATED void setContextMenuEnabled( bool showMenu );
293#endif
294
302 void setUrlDropsEnabled( bool enable );
303
307 bool urlDropsEnabled() const;
308
318 bool contains( const QString& text ) const;
319
333 void setTrapReturnKey( bool trap );
334
341 bool trapReturnKey() const;
342
346 virtual bool eventFilter( QObject *, QEvent * );
347
357 KCompletionBox * completionBox( bool create = true );
358
368 virtual void setLineEdit( QLineEdit * );
369
377 void setEditable(bool editable);
378
379Q_SIGNALS:
385 void returnPressed();
386
396 void returnPressed( const QString& );
397
406 void completion( const QString& );
407
411 void substringCompletion( const QString& );
412
424 void textRotation( KCompletionBase::KeyBindingType );
425
430 void completionModeChanged( KGlobalSettings::Completion );
431
441 void aboutToShowContextMenu( QMenu * p );
442
443public Q_SLOTS:
444
462 void rotateText( KCompletionBase::KeyBindingType type );
463
470 virtual void setCompletedText( const QString& );
471
476 void setCompletedItems( const QStringList& items, bool autosubject = true );
477
483 void setCurrentItem( const QString& item, bool insert = false, int index = -1 );
484
485protected Q_SLOTS:
486
498 virtual void makeCompletion( const QString& );
499
500protected:
501 /*
502 * This function simply sets the lineedit text and
503 * highlights the text appropriately if the boolean
504 * value is set to true.
505 *
506 * @param
507 * @param
508 */
509 virtual void setCompletedText( const QString& /* */, bool /*marked*/ );
510
514 virtual void create( WId = 0, bool initializeWindow = true,
515 bool destroyOldWindow = true );
516
517 virtual void wheelEvent( QWheelEvent *ev );
518
519 virtual QSize minimumSizeHint() const;
520
521private Q_SLOTS:
522 void lineEditDeleted();
523
524private:
528 void init();
529
530private:
531 class KComboBoxPrivate;
532 KComboBoxPrivate* const d;
533};
534
535
536
537#endif
538
KComboBox
An enhanced combo box.
Definition: kcombobox.h:149
KComboBox::returnPressed
void returnPressed(const QString &)
Emitted when the user presses the Enter key.
KComboBox::substringCompletion
void substringCompletion(const QString &)
Emitted when the shortcut for substring completion is pressed.
KComboBox::aboutToShowContextMenu
void aboutToShowContextMenu(QMenu *p)
Emitted before the context menu is displayed.
KComboBox::textRotation
void textRotation(KCompletionBase::KeyBindingType)
Emitted when the text rotation key-bindings are pressed.
KComboBox::completionModeChanged
void completionModeChanged(KGlobalSettings::Completion)
Emitted whenever the completion mode is changed by the user through the context menu.
KComboBox::changeURL
void changeURL(const QPixmap &pixmap, const KUrl &url, int index)
Definition: kcombobox.h:191
KComboBox::completion
void completion(const QString &)
Emitted when the completion key is pressed.
KComboBox::changeURL
void changeURL(const KUrl &url, int index)
Definition: kcombobox.h:189
KComboBox::insertURL
void insertURL(const KUrl &url, int index=-1)
Deprecated to reflect Qt api changes.
Definition: kcombobox.h:185
KComboBox::returnPressed
void returnPressed()
Emitted when the user presses the Enter key.
KComboBox::insertURL
void insertURL(const QPixmap &pixmap, const KUrl &url, int index=-1)
Definition: kcombobox.h:187
KCompletionBase
An abstract base class for adding a completion feature into widgets.
Definition: kcompletion.h:646
KCompletionBase::KeyBindingType
KeyBindingType
Constants that represent the items whose short-cut key-binding is programmable.
Definition: kcompletion.h:653
KCompletionBox
A helper widget for "completion-widgets" (KLineEdit, KComboBox))
Definition: kcompletionbox.h:44
KGlobalSettings::Completion
Completion
This enum describes the completion mode used for by the KCompletion class.
Definition: kglobalsettings.h:179
KUrl
QComboBox
QLineEdit
QMenu
QObject
QWidget
kcompletion.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal