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

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • 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 
29 class QLineEdit;
30 class QMenu;
31 
32 class KCompletionBox;
33 class 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 
148 class 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 
155 public:
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 
379 Q_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 
443 public 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 
485 protected Q_SLOTS:
486 
498  virtual void makeCompletion( const QString& );
499 
500 protected:
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 
521 private Q_SLOTS:
522  void lineEditDeleted();
523 
524 private:
528  void init();
529 
530 private:
531  class KComboBoxPrivate;
532  KComboBoxPrivate* const d;
533 };
534 
535 
536 
537 #endif
538 
QEvent
QWidget
QComboBox::setLineEdit
void setLineEdit(QLineEdit *edit)
KComboBox::insertURL
void insertURL(const KUrl &url, int index=-1)
Deprecated to reflect Qt api changes.
Definition: kcombobox.h:185
KComboBox::changeURL
void changeURL(const KUrl &url, int index)
Definition: kcombobox.h:189
KCompletionBox
A helper widget for "completion-widgets" (KLineEdit, KComboBox))
Definition: kcompletionbox.h:43
QComboBox::setCurrentItem
void setCurrentItem(int index)
KStandardShortcut::substringCompletion
const KShortcut & substringCompletion()
Find a string within another string or list of strings.
Definition: kstandardshortcut.cpp:368
QWheelEvent
QComboBox::wheelEvent
virtual void wheelEvent(QWheelEvent *e)
KCompletionBase::setCompletedText
virtual void setCompletedText(const QString &text)=0
A pure virtual function that must be implemented by all inheriting classes.
QComboBox::setEditable
void setEditable(bool editable)
KUrl
KComboBox::changeURL
void changeURL(const QPixmap &pixmap, const KUrl &url, int index)
Definition: kcombobox.h:191
QComboBox::count
int count() const
QComboBox::minimumSizeHint
virtual QSize minimumSizeHint() const
KStandardShortcut::insert
const KShortcut & insert()
Toggle insert/overwrite (with visual feedback, e.g.
Definition: kstandardguiitem.cpp:264
QObject
QObject::eventFilter
virtual bool eventFilter(QObject *watched, QEvent *event)
QString
QStringList
QPixmap
kcompletion.h
QMenu
QSize
KCompletionBase
An abstract base class for adding a completion feature into widgets.
Definition: kcompletion.h:645
KComboBox::insertURL
void insertURL(const QPixmap &pixmap, const KUrl &url, int index=-1)
Definition: kcombobox.h:187
KStandardAction::create
KAction * create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
Creates an action corresponding to one of the KStandardAction::StandardAction actions, which is connected to the given object and slot, and is owned by parent.
Definition: kstandardaction.cpp:82
KComboBox
An enhanced combo box.
Definition: kcombobox.h:148
KGlobalSettings::Completion
Completion
This enum describes the completion mode used for by the KCompletion class.
Definition: kglobalsettings.h:179
KCompletionBase::KeyBindingType
KeyBindingType
Constants that represent the items whose short-cut key-binding is programmable.
Definition: kcompletion.h:653
QComboBox::setAutoCompletion
void setAutoCompletion(bool enable)
QLineEdit
KCompletionBase::setCompletedItems
virtual void setCompletedItems(const QStringList &items, bool autoSuggest=true)=0
A pure virtual function that must be implemented by all inheriting classes.
KStandardShortcut::completion
const KShortcut & completion()
Complete text in input widgets.
Definition: kstandardshortcut.cpp:363
QIcon
QComboBox
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:59 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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

Search



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