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

KDEUI

kcombobox.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002 
00003    Copyright (c) 2000,2001 Dawit Alemayehu <adawit@kde.org>
00004    Copyright (c) 2000,2001 Carsten Pfeiffer <pfeiffer@kde.org>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License (LGPL) as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019    Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #ifndef KCOMBOBOX_H
00023 #define KCOMBOBOX_H
00024 
00025 #include <QtGui/QComboBox>
00026 
00027 #include <kcompletion.h>
00028 
00029 class QLineEdit;
00030 class QMenu;
00031 
00032 class KCompletionBox;
00033 class KUrl;
00034 
00035 /*
00036  * ### KDE 5: On all methods that it is said that a prettyUrl will be used, it
00037  *            would be nice to add a flag to the method for forcing the pretty
00038  *            url or not. (ereslibre)
00039  */
00040 
00148 class KDEUI_EXPORT KComboBox : public QComboBox, public KCompletionBase //krazy:exclude=qclasses
00149 {
00150   Q_OBJECT
00151   Q_PROPERTY( bool autoCompletion READ autoCompletion WRITE setAutoCompletion )
00152   Q_PROPERTY( bool urlDropsEnabled READ urlDropsEnabled WRITE setUrlDropsEnabled )
00153   Q_PROPERTY( bool trapReturnKey READ trapReturnKey WRITE setTrapReturnKey )
00154 
00155 public:
00156 
00163     explicit KComboBox( QWidget *parent=0 );
00164 
00173     explicit KComboBox( bool rw, QWidget *parent=0 );
00174 
00178     virtual ~KComboBox();
00179 
00184 #ifndef KDE_NO_DEPRECATED
00185     KDE_DEPRECATED void insertURL( const KUrl& url, int index = -1 )
00186     { insertUrl( index < 0 ? count() : index, url ); }
00187     KDE_DEPRECATED void insertURL( const QPixmap& pixmap, const KUrl& url, int index = -1 )
00188     { insertUrl( index < 0 ? count() : index, QIcon(pixmap), url ); }
00189     KDE_DEPRECATED void changeURL( const KUrl& url, int index )
00190     { changeUrl( index, url ); }
00191     KDE_DEPRECATED void changeURL( const QPixmap& pixmap, const KUrl& url, int index )
00192     { changeUrl( index, QIcon(pixmap), url ); }
00193 #endif
00194 
00200     void setEditUrl( const KUrl& url );
00201 
00207     void addUrl( const KUrl& url );
00208 
00214     void addUrl( const QIcon& icon,  const KUrl& url );
00215 
00221     void insertUrl( int index, const KUrl& url );
00222 
00228     void insertUrl( int index, const QIcon& icon, const KUrl& url );
00229 
00235     void changeUrl( int index, const KUrl& url );
00236 
00242     void changeUrl( int index , const QIcon& icon, const KUrl& url);
00243 
00252     int cursorPosition() const;
00253 
00264     virtual void setAutoCompletion( bool autocomplete );
00265 
00275     bool autoCompletion() const;
00276 
00291 #ifndef KDE_NO_DEPRECATED
00292     virtual KDE_DEPRECATED void setContextMenuEnabled( bool showMenu );
00293 #endif
00294 
00302     void setUrlDropsEnabled( bool enable );
00303 
00307     bool urlDropsEnabled() const;
00308 
00318     bool contains( const QString& text ) const;
00319 
00333     void setTrapReturnKey( bool trap );
00334 
00341     bool trapReturnKey() const;
00342 
00346     virtual bool eventFilter( QObject *, QEvent * );
00347 
00357     KCompletionBox * completionBox( bool create = true );
00358 
00368     virtual void setLineEdit( QLineEdit * );
00369 
00377     void setEditable(bool editable);
00378 
00379 Q_SIGNALS:
00385     void returnPressed();
00386 
00396     void returnPressed( const QString& );
00397 
00406     void completion( const QString& );
00407 
00411     void substringCompletion( const QString& );
00412 
00424     void textRotation( KCompletionBase::KeyBindingType );
00425 
00430     void completionModeChanged( KGlobalSettings::Completion );
00431 
00441     void aboutToShowContextMenu( QMenu * p );
00442 
00443 public Q_SLOTS:
00444 
00462     void rotateText( KCompletionBase::KeyBindingType type );
00463 
00470     virtual void setCompletedText( const QString& );
00471 
00476     void setCompletedItems( const QStringList& items, bool autosubject = true );
00477 
00483     void setCurrentItem( const QString& item, bool insert = false, int index = -1 );
00484 
00485 protected Q_SLOTS:
00486 
00498     virtual void makeCompletion( const QString& );
00499 
00500 protected:
00501     /*
00502     * This function simply sets the lineedit text and
00503     * highlights the text appropriately if the boolean
00504     * value is set to true.
00505     *
00506     * @param
00507     * @param
00508     */
00509     virtual void setCompletedText( const QString& /* */, bool /*marked*/ );
00510 
00514     virtual void create( WId = 0, bool initializeWindow = true,
00515                          bool destroyOldWindow = true );
00516 
00517     virtual void wheelEvent( QWheelEvent *ev );
00518 
00519     virtual QSize minimumSizeHint() const;
00520 
00521 private Q_SLOTS:
00522     void lineEditDeleted();
00523 
00524 private:
00528     void init();
00529 
00530 private:
00531     class KComboBoxPrivate;
00532     KComboBoxPrivate* const d;
00533 };
00534 
00535 
00536 
00537 #endif
00538 

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

Skip menu "kdelibs"
  • 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
Generated for kdelibs by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal