• Skip to content
  • Skip to link menu
KDE 4.3 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 
00317     QString userText() const;
00318 
00326     void setCompletionBox( KCompletionBox *box );
00327 
00333     void setClickMessage( const QString &msg );
00334 
00338     QString clickMessage() const;
00339 
00345     void setClearButtonShown(bool show);
00346 
00350     bool isClearButtonShown() const;
00351 
00356     QSize clearButtonUsedSize() const;
00357 
00365     void doCompletion(const QString& txt);
00366 
00367 Q_SIGNALS:
00368 
00372     void completionBoxActivated (const QString &);
00373 
00381     void returnPressed( const QString& );
00382 
00390     void completion( const QString& );
00391 
00395     void substringCompletion( const QString& );
00396 
00401     void userTextChanged( const QString & ); 
00402 
00414     void textRotation( KCompletionBase::KeyBindingType );
00415 
00420     void completionModeChanged( KGlobalSettings::Completion );
00421 
00434     void aboutToShowContextMenu( QMenu * p );
00435 
00439     void clearButtonClicked();
00440 
00441 public Q_SLOTS:
00442 
00446     virtual void setReadOnly(bool);
00447 
00458     void rotateText( KCompletionBase::KeyBindingType type );
00459 
00463     virtual void setCompletedText( const QString& );
00464 
00473     void setCompletedItems( const QStringList& items, bool autoSuggest = true );
00474 
00479     virtual void clear(); // ### KDE 5: check if still required
00480 
00485     void setSqueezedText( const QString &text);
00486 
00490     virtual void setText ( const QString& );
00491 
00497     void setPasswordMode( bool b = true );
00498 
00502     bool passwordMode( ) const;
00503 
00504 
00505 protected Q_SLOTS:
00506 
00511     virtual void makeCompletion( const QString& );
00512 
00518     void userCancelled(const QString & cancelText);
00519 
00520 protected:
00521 
00525     virtual bool event( QEvent * );
00526 
00532     virtual void resizeEvent( QResizeEvent * );
00533 
00539     virtual void keyPressEvent( QKeyEvent * );
00540 
00546     virtual void mousePressEvent( QMouseEvent * );
00547 
00553     virtual void mouseReleaseEvent( QMouseEvent * );
00554 
00560     virtual void mouseDoubleClickEvent( QMouseEvent * );
00561 
00567     virtual void contextMenuEvent( QContextMenuEvent * );
00568 
00574     QMenu* createStandardContextMenu();
00575 
00581     virtual void dropEvent( QDropEvent * );
00582 
00591     virtual void setCompletedText( const QString& /*text*/, bool /*marked*/ );
00592 
00593 
00598     void setUserSelection( bool userSelection );
00599 
00603     virtual void create( WId = 0, bool initializeWindow = true,
00604                          bool destroyOldWindow = true );
00605 
00609     bool autoSuggest() const;
00610 
00611     virtual void paintEvent( QPaintEvent *ev );
00612 
00613     virtual void focusInEvent( QFocusEvent *ev );
00614 
00615     virtual void focusOutEvent( QFocusEvent *ev );
00616 
00617 private Q_SLOTS:
00618     void completionMenuActivated( QAction *act );
00619     void tripleClickTimeout();  // resets possibleTripleClick
00620     void slotRestoreSelectionColors();
00621     void setTextWorkaround( const QString& text );
00622 
00626     void updateClearButtonIcon(const QString&);
00627 
00628 private:
00629 
00630 
00634     void init();
00635 
00636     bool copySqueezedText( bool clipboard ) const;
00637 
00642     void setSqueezedText ();
00643 
00647     void updateClearButton();
00648 
00649 private:
00650     friend class KLineEditPrivate;
00651     KLineEditPrivate *const d;
00652 
00653     Q_PRIVATE_SLOT( d, void _k_slotSettingsChanged( int category ) )
00654     Q_PRIVATE_SLOT( d, void _k_updateUserText(const QString&) )
00655 };
00656 
00657 #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
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
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