• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • 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 
00149 class KDEUI_EXPORT KLineEdit : public QLineEdit, public KCompletionBase //krazy:exclude=qclasses
00150 {
00151     friend class KComboBox;
00152     friend class KLineEditStyle;
00153 
00154     Q_OBJECT
00155 #ifndef KDE_NO_DEPRECATED
00156     Q_PROPERTY( bool contextMenuEnabled READ isContextMenuEnabled WRITE setContextMenuEnabled )
00157 #endif
00158     Q_PROPERTY( bool urlDropsEnabled READ urlDropsEnabled WRITE setUrlDropsEnabled )
00159     Q_PROPERTY( bool trapEnterKeyEvent READ trapReturnKey WRITE setTrapReturnKey )
00160     Q_PROPERTY( bool squeezedTextEnabled READ isSqueezedTextEnabled WRITE setSqueezedTextEnabled )
00161     Q_PROPERTY( QString clickMessage READ clickMessage WRITE setClickMessage )
00162     Q_PROPERTY( bool showClearButton READ isClearButtonShown WRITE setClearButtonShown )
00163     Q_PROPERTY( bool passwordMode READ passwordMode WRITE setPasswordMode )
00164 
00165 public:
00166 
00174     explicit KLineEdit( const QString &string, QWidget *parent = 0 );
00175 
00180     explicit KLineEdit( QWidget *parent = 0 );
00181 
00185     virtual ~KLineEdit ();
00186 
00191     void setUrl( const KUrl& url );
00192 
00201     virtual void setCompletionMode( KGlobalSettings::Completion mode );
00202 
00209     void setCompletionModeDisabled( KGlobalSettings::Completion mode, bool disable = true );
00210 
00226 #ifndef KDE_NO_DEPRECATED
00227     virtual KDE_DEPRECATED void setContextMenuEnabled( bool showMenu );
00228 #endif
00229 
00234 #ifndef KDE_NO_DEPRECATED
00235     KDE_DEPRECATED bool isContextMenuEnabled() const;
00236 #endif
00237 
00245     void setUrlDropsEnabled( bool enable );
00246 
00250     bool urlDropsEnabled() const;
00251 
00262     void setTrapReturnKey( bool trap );
00263 
00270     bool trapReturnKey() const;
00271 
00280     KCompletionBox * completionBox( bool create = true ); // KDE5 TODO: make virtual, so konq can reimplement i
00281 
00285     virtual void setCompletionObject( KCompletion *, bool hsig = true );
00286 
00290     virtual void copy() const;
00291 
00302     void setSqueezedTextEnabled( bool enable );
00303 
00308     bool isSqueezedTextEnabled() const;
00309 
00317     QString originalText() const;
00318 
00325     QString userText() const;
00326 
00334     void setCompletionBox( KCompletionBox *box );
00335 
00341     void setClickMessage( const QString &msg );
00342 
00346     QString clickMessage() const;
00347 
00353     void setClearButtonShown(bool show);
00354 
00358     bool isClearButtonShown() const;
00359 
00364     QSize clearButtonUsedSize() const;
00365 
00373     void doCompletion(const QString& txt);
00374 
00375 Q_SIGNALS:
00376 
00380     void completionBoxActivated (const QString &);
00381 
00389     void returnPressed( const QString& );
00390 
00398     void completion( const QString& );
00399 
00403     void substringCompletion( const QString& );
00404 
00417 #ifndef KDE_NO_DEPRECATED
00418     QT_MOC_COMPAT void userTextChanged( const QString & );
00419 #endif
00420 
00432     void textRotation( KCompletionBase::KeyBindingType );
00433 
00438     void completionModeChanged( KGlobalSettings::Completion );
00439 
00452     void aboutToShowContextMenu(QMenu* menu);
00453 
00457     void clearButtonClicked();
00458 
00459 public Q_SLOTS:
00460 
00465     virtual void setReadOnly(bool);
00466 
00477     void rotateText( KCompletionBase::KeyBindingType type );
00478 
00482     virtual void setCompletedText( const QString& );
00483 
00492     void setCompletedItems( const QStringList& items, bool autoSuggest = true );
00493 
00498     virtual void clear(); // ### KDE 5: check if still required
00499 
00504     void setSqueezedText( const QString &text);
00505 
00509     virtual void setText ( const QString& );
00510 
00516     void setPasswordMode( bool b = true );
00517 
00521     bool passwordMode( ) const;
00522 
00523 
00524 protected Q_SLOTS:
00525 
00530     virtual void makeCompletion( const QString& );
00531 
00537     void userCancelled(const QString & cancelText);
00538 
00539 protected:
00540 
00544     virtual bool event( QEvent * );
00545 
00551     virtual void resizeEvent( QResizeEvent * );
00552 
00558     virtual void keyPressEvent( QKeyEvent * );
00559 
00565     virtual void mousePressEvent( QMouseEvent * );
00566 
00572     virtual void mouseReleaseEvent( QMouseEvent * );
00573 
00579     virtual void mouseDoubleClickEvent( QMouseEvent * );
00580 
00586     virtual void contextMenuEvent( QContextMenuEvent * );
00587 
00593     QMenu* createStandardContextMenu();
00594 
00600     virtual void dropEvent( QDropEvent * );
00601 
00610     virtual void setCompletedText( const QString& /*text*/, bool /*marked*/ );
00611 
00612 
00617     void setUserSelection( bool userSelection );
00618 
00622     virtual void create( WId = 0, bool initializeWindow = true,
00623                          bool destroyOldWindow = true );
00624 
00628     bool autoSuggest() const;
00629 
00630     virtual void paintEvent( QPaintEvent *ev );
00631 
00632     virtual void focusInEvent( QFocusEvent *ev );
00633 
00634     virtual void focusOutEvent( QFocusEvent *ev );
00635 
00636 private Q_SLOTS:
00637     void completionMenuActivated( QAction *act );
00638     void tripleClickTimeout();  // resets possibleTripleClick
00639     void slotRestoreSelectionColors();
00640     void _k_slotCompletionBoxTextChanged( const QString& text );
00641 
00645     void updateClearButtonIcon(const QString&);
00646 
00647 private:
00648 
00649 
00653     void init();
00654 
00655     bool copySqueezedText( bool clipboard ) const;
00656 
00661     void setSqueezedText ();
00662 
00666     void updateClearButton();
00667 
00668 private:
00669     friend class KLineEditPrivate;
00670     KLineEditPrivate *const d;
00671 
00672     Q_PRIVATE_SLOT( d, void _k_slotSettingsChanged( int category ) )
00673     Q_PRIVATE_SLOT( d, void _k_textChanged(const QString&) )
00674 };
00675 
00676 #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
  • 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.3
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