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

KDEUI

klineedit.h

Go to the documentation of this file.
00001 /*  This file is part of the KDE libraries
00002 
00003     This class was originally inspired by Torben Weis'
00004     fileentry.cpp for KFM II.
00005 
00006     Copyright (C) 1997 Sven Radej <sven.radej@iname.com>
00007     Copyright (c) 1999 Patrick Ward <PAT_WARD@HP-USA-om5.om.hp.com>
00008     Copyright (c) 1999 Preston Brown <pbrown@kde.org>
00009 
00010     Completely re-designed:
00011     Copyright (c) 2000,2001 Dawit Alemayehu <adawit@kde.org>
00012 
00013     This library is free software; you can redistribute it and/or
00014     modify it under the terms of the GNU Lesser General Public
00015     License (LGPL) as published by the Free Software Foundation;
00016     either version 2 of the License, or (at your option) any later
00017     version.
00018 
00019     This library is distributed in the hope that it will be useful,
00020     but WITHOUT ANY WARRANTY; without even the implied warranty of
00021     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00022     Lesser General Public License for more details.
00023 
00024     You should have received a copy of the GNU Lesser General Public License
00025     along with this library; see the file COPYING.LIB.  If not, write to
00026     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00027     Boston, MA 02110-1301, USA.
00028 */
00029 
00030 #ifndef KLINEEDIT_H
00031 #define KLINEEDIT_H
00032 
00033 #include <QtGui/QLineEdit>
00034 
00035 #include <kcompletion.h>
00036 
00037 class QAction;
00038 class QMenu;
00039 class KCompletionBox;
00040 class KUrl;
00041 class KLineEditPrivate;
00042 
00147 class KDEUI_EXPORT KLineEdit : public QLineEdit, public KCompletionBase //krazy:exclude=qclasses
00148 {
00149     friend class KComboBox;
00150     friend class KLineEditStyle;
00151 
00152     Q_OBJECT
00153     Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled )
00154     Q_PROPERTY( bool urlDropsEnabled READ urlDropsEnabled WRITE setUrlDropsEnabled )
00155     Q_PROPERTY( bool trapEnterKeyEvent READ trapReturnKey WRITE setTrapReturnKey )
00156     Q_PROPERTY( bool squeezedTextEnabled READ isSqueezedTextEnabled WRITE setSqueezedTextEnabled )
00157     Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
00158     Q_PROPERTY( bool showClearButton READ isClearButtonShown WRITE setClearButtonShown )
00159     Q_PROPERTY( bool passwordMode READ passwordMode WRITE setPasswordMode )
00160 
00161 public:
00162 
00170     explicit KLineEdit( const QString &string, QWidget *parent = 0 );
00171 
00176     explicit KLineEdit( QWidget *parent = 0 );
00177 
00181     virtual ~KLineEdit ();
00182 
00187     void setUrl( const KUrl& url );
00188 
00197     virtual void setCompletionMode( KGlobalSettings::Completion mode );
00198 
00205     void setCompletionModeDisabled( KGlobalSettings::Completion mode, bool disable = true );
00206 
00222     virtual KDE_DEPRECATED void setContextMenuEnabled( bool showMenu );
00223 
00228     KDE_DEPRECATED bool isContextMenuEnabled() const;
00229 
00237     void setUrlDropsEnabled( bool enable );
00238 
00242     bool urlDropsEnabled() const;
00243 
00254     void setTrapReturnKey( bool trap );
00255 
00262     bool trapReturnKey() const;
00263 
00272     KCompletionBox * completionBox( bool create = true );
00273 
00277     virtual void setCompletionObject( KCompletion *, bool hsig = true );
00278 
00282     virtual void copy() const;
00283 
00294     void setSqueezedTextEnabled( bool enable );
00295 
00300     bool isSqueezedTextEnabled() const;
00301 
00309     QString originalText() const;
00310 
00318     void setCompletionBox( KCompletionBox *box );
00319 
00325     void setClickMessage( const QString &msg );
00326 
00330     QString clickMessage() const;
00331 
00337     void setClearButtonShown(bool show);
00338 
00342     bool isClearButtonShown() const;
00343     
00348     QSize clearButtonUsedSize() const;
00349 
00350 Q_SIGNALS:
00351 
00355     void completionBoxActivated (const QString &);
00356 
00364     void returnPressed( const QString& );
00365 
00373     void completion( const QString& );
00374 
00378     void substringCompletion( const QString& );
00379 
00391     void textRotation( KCompletionBase::KeyBindingType );
00392 
00397     void completionModeChanged( KGlobalSettings::Completion );
00398 
00411     void aboutToShowContextMenu( QMenu * p );
00412 
00416     void clearButtonClicked();
00417 
00418 public Q_SLOTS:
00419 
00423     virtual void setReadOnly(bool);
00424 
00435     void rotateText( KCompletionBase::KeyBindingType type );
00436 
00440     virtual void setCompletedText( const QString& );
00441 
00450     void setCompletedItems( const QStringList& items, bool autoSuggest = true );
00451 
00456     virtual void clear(); // ### KDE 5: check if still required
00457 
00462     void setSqueezedText( const QString &text);
00463 
00467     virtual void setText ( const QString& );
00468 
00474     void setPasswordMode( bool b = true );
00475 
00479     bool passwordMode( ) const;
00480 
00481 
00482 protected Q_SLOTS:
00483 
00488     virtual void makeCompletion( const QString& );
00489 
00495     void userCancelled(const QString & cancelText);
00496 
00497 protected:
00498 
00502     virtual bool event( QEvent * );
00503 
00509     virtual void resizeEvent( QResizeEvent * );
00510 
00516     virtual void keyPressEvent( QKeyEvent * );
00517 
00523     virtual void mousePressEvent( QMouseEvent * );
00524 
00530     virtual void mouseReleaseEvent( QMouseEvent * );
00531 
00537     virtual void mouseDoubleClickEvent( QMouseEvent * );
00538 
00544     virtual void contextMenuEvent( QContextMenuEvent * );
00545 
00551     QMenu* createStandardContextMenu();
00552 
00558     virtual void dropEvent( QDropEvent * );
00559 
00568     virtual void setCompletedText( const QString& /*text*/, bool /*marked*/ );
00569 
00570 
00575     void setUserSelection( bool userSelection );
00576 
00580     virtual void create( WId = 0, bool initializeWindow = true,
00581                          bool destroyOldWindow = true );
00582 
00586     bool autoSuggest() const;
00587 
00588     virtual void paintEvent( QPaintEvent *ev );
00589 
00590     virtual void focusInEvent( QFocusEvent *ev );
00591 
00592     virtual void focusOutEvent( QFocusEvent *ev );
00593 
00594 private Q_SLOTS:
00595     void completionMenuActivated( QAction *act );
00596     void tripleClickTimeout();  // resets possibleTripleClick
00597     void slotRestoreSelectionColors();
00598     void setTextWorkaround( const QString& text );
00599 
00603     void updateClearButtonIcon(const QString&);
00604 
00605 private:
00606 
00607 
00611     void init();
00612 
00613     bool copySqueezedText( bool clipboard ) const;
00614 
00619     void setSqueezedText ();
00620 
00624     void updateClearButton();
00625 
00626 private:
00627     friend class KLineEditPrivate;
00628     KLineEditPrivate *const d;
00629 
00630     Q_PRIVATE_SLOT( d, void _k_slotSettingsChanged( int category ) )
00631 };
00632 
00633 #endif

KDEUI

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
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