KDEUI
kcompletionbox.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 00003 Copyright (c) 2000 Carsten Pfeiffer <pfeiffer@kde.org> 00004 2000 Stefan Schimanski <1Stein@gmx.de> 00005 2000,2001,2002,2003,2004 Dawit Alemayehu <adawit@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License (LGPL) as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef KCOMPLETIONBOX_H 00024 #define KCOMPLETIONBOX_H 00025 00026 #include <klistwidget.h> 00027 00028 class QEvent; 00029 00043 class KDEUI_EXPORT KCompletionBox : public KListWidget 00044 { 00045 Q_OBJECT 00046 Q_PROPERTY( bool isTabHandling READ isTabHandling WRITE setTabHandling ) 00047 Q_PROPERTY(QString cancelledText READ cancelledText WRITE setCancelledText) 00048 Q_PROPERTY( bool activateOnSelect READ activateOnSelect WRITE setActivateOnSelect ) 00049 00050 public: 00057 explicit KCompletionBox( QWidget *parent = 0 ); 00058 00062 ~KCompletionBox(); 00063 00064 virtual QSize sizeHint() const; 00065 00069 bool activateOnSelect() const; 00070 00071 public Q_SLOTS: 00075 QStringList items() const; 00076 00082 void insertItems( const QStringList& items, int index = -1 ); 00083 00087 void setItems( const QStringList& items ); 00088 00100 virtual void popup(); 00101 00112 void setTabHandling( bool enable ); 00113 00122 bool isTabHandling() const; 00123 00134 void setCancelledText( const QString& txt); 00135 00139 QString cancelledText() const; 00140 00147 void setActivateOnSelect(bool state); 00148 00149 00153 void down(); 00154 00158 void up(); 00159 00163 void pageDown(); 00164 00168 void pageUp(); 00169 00173 void home(); 00174 00178 void end(); 00179 00184 virtual void setVisible( bool visible ); 00185 00186 Q_SIGNALS: 00191 void activated( const QString& ); 00192 00197 void userCancelled( const QString& ); 00198 00199 protected: 00205 QRect calculateGeometry() const; 00206 00210 void sizeAndPosition(); 00211 00216 virtual bool eventFilter( QObject *, QEvent * ); 00217 00222 virtual QPoint globalPositionHint() const; 00223 00224 protected Q_SLOTS: 00229 virtual void slotActivated( QListWidgetItem * ); 00230 00231 private Q_SLOTS: 00232 void canceled(); 00233 void slotItemClicked( QListWidgetItem * ); 00234 00235 private: 00236 class KCompletionBoxPrivate; 00237 KCompletionBoxPrivate* const d; 00238 }; 00239 00240 00241 #endif // KCOMPLETIONBOX_H
KDE 4.6 API Reference