• Skip to content
  • Skip to link menu
KDE 4.7 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 
00225 #ifndef KDE_NO_DEPRECATED
00226     virtual KDE_DEPRECATED void setContextMenuEnabled( bool showMenu );
00227 #endif
00228 
00233 #ifndef KDE_NO_DEPRECATED
00234     KDE_DEPRECATED bool isContextMenuEnabled() const;
00235 #endif
00236 
00244     void setUrlDropsEnabled( bool enable );
00245 
00249     bool urlDropsEnabled() const;
00250 
00261     void setTrapReturnKey( bool trap );
00262 
00269     bool trapReturnKey() const;
00270 
00279     KCompletionBox * completionBox( bool create = true ); // KDE5 TODO: make virtual, so konq can reimplement i
00280 
00284     virtual void setCompletionObject( KCompletion *, bool hsig = true );
00285 
00289     virtual void copy() const;
00290 
00301     void setSqueezedTextEnabled( bool enable );
00302 
00307     bool isSqueezedTextEnabled() const;
00308 
00316     QString originalText() const;
00317 
00324     QString userText() const;
00325 
00333     void setCompletionBox( KCompletionBox *box );
00334 
00340     void setClickMessage( const QString &msg );
00341 
00345     QString clickMessage() const;
00346 
00352     void setClearButtonShown(bool show);
00353 
00357     bool isClearButtonShown() const;
00358 
00363     QSize clearButtonUsedSize() const;
00364 
00372     void doCompletion(const QString& txt);
00373 
00374 Q_SIGNALS:
00375 
00379     void completionBoxActivated (const QString &);
00380 
00388     void returnPressed( const QString& );
00389 
00397     void completion( const QString& );
00398 
00402     void substringCompletion( const QString& );
00403 
00416 #ifndef KDE_NO_DEPRECATED
00417     QT_MOC_COMPAT void userTextChanged( const QString & );
00418 #endif
00419 
00431     void textRotation( KCompletionBase::KeyBindingType );
00432 
00437     void completionModeChanged( KGlobalSettings::Completion );
00438 
00451     void aboutToShowContextMenu(QMenu* menu);
00452 
00456     void clearButtonClicked();
00457 
00458 public Q_SLOTS:
00459 
00464     virtual void setReadOnly(bool);
00465 
00476     void rotateText( KCompletionBase::KeyBindingType type );
00477 
00481     virtual void setCompletedText( const QString& );
00482 
00491     void setCompletedItems( const QStringList& items, bool autoSuggest = true );
00492 
00497     virtual void clear(); // ### KDE 5: check if still required
00498 
00503     void setSqueezedText( const QString &text);
00504 
00508     virtual void setText ( const QString& );
00509 
00515     void setPasswordMode( bool b = true );
00516 
00520     bool passwordMode( ) const;
00521 
00522 
00523 protected Q_SLOTS:
00524 
00529     virtual void makeCompletion( const QString& );
00530 
00536     void userCancelled(const QString & cancelText);
00537 
00538 protected:
00539 
00543     virtual bool event( QEvent * );
00544 
00550     virtual void resizeEvent( QResizeEvent * );
00551 
00557     virtual void keyPressEvent( QKeyEvent * );
00558 
00564     virtual void mousePressEvent( QMouseEvent * );
00565 
00571     virtual void mouseReleaseEvent( QMouseEvent * );
00572 
00578     virtual void mouseDoubleClickEvent( QMouseEvent * );
00579 
00585     virtual void contextMenuEvent( QContextMenuEvent * );
00586 
00592     QMenu* createStandardContextMenu();
00593 
00599     virtual void dropEvent( QDropEvent * );
00600 
00609     virtual void setCompletedText( const QString& /*text*/, bool /*marked*/ );
00610 
00611 
00616     void setUserSelection( bool userSelection );
00617 
00621     virtual void create( WId = 0, bool initializeWindow = true,
00622                          bool destroyOldWindow = true );
00623 
00627     bool autoSuggest() const;
00628 
00629     virtual void paintEvent( QPaintEvent *ev );
00630 
00631     virtual void focusInEvent( QFocusEvent *ev );
00632 
00633     virtual void focusOutEvent( QFocusEvent *ev );
00634 
00635 private Q_SLOTS:
00636     void completionMenuActivated( QAction *act );
00637     void tripleClickTimeout();  // resets possibleTripleClick
00638     void slotRestoreSelectionColors();
00639     void _k_slotCompletionBoxTextChanged( const QString& text );
00640 
00644     void updateClearButtonIcon(const QString&);
00645 
00646 private:
00647 
00648 
00652     void init();
00653 
00654     bool copySqueezedText( bool clipboard ) const;
00655 
00660     void setSqueezedText ();
00661 
00665     void updateClearButton();
00666 
00667 private:
00668     friend class KLineEditPrivate;
00669     KLineEditPrivate *const d;
00670 
00671     Q_PRIVATE_SLOT( d, void _k_slotSettingsChanged( int category ) )
00672     Q_PRIVATE_SLOT( d, void _k_textChanged(const QString&) )
00673 };
00674 
00675 #endif

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