KDEUI
ktreewidgetsearchline.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (c) 2003 Scott Wheeler <wheeler@kde.org> 00003 Copyright (c) 2005 Rafal Rzepecki <divide@users.sourceforge.net> 00004 Copyright (c) 2006 Hamish Rodda <rodda@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef KTREEWIDGETSEARCHLINE_H 00022 #define KTREEWIDGETSEARCHLINE_H 00023 00024 #include <klineedit.h> 00025 00026 class QModelIndex; 00027 class QTreeWidget; 00028 class QTreeWidgetItem; 00029 00038 class KDEUI_EXPORT KTreeWidgetSearchLine : public KLineEdit 00039 { 00040 Q_OBJECT 00041 00042 Q_PROPERTY( Qt::CaseSensitivity caseSensitity READ caseSensitivity WRITE setCaseSensitivity ) 00043 Q_PROPERTY( bool keepParentsVisible READ keepParentsVisible WRITE setKeepParentsVisible ) 00044 00045 00046 public: 00054 explicit KTreeWidgetSearchLine( QWidget *parent = 0, QTreeWidget *treeWidget = 0 ); 00055 00063 KTreeWidgetSearchLine( QWidget *parent, const QList<QTreeWidget *> &treeWidgets ); 00064 00065 00069 virtual ~KTreeWidgetSearchLine(); 00070 00076 Qt::CaseSensitivity caseSensitivity() const; 00077 00084 QList<int> searchColumns() const; 00085 00092 bool keepParentsVisible() const; 00093 00100 QTreeWidget *treeWidget() const; 00101 00108 QList<QTreeWidget *> treeWidgets() const; 00109 00110 Q_SIGNALS: 00115 void hiddenChanged(QTreeWidgetItem *, bool); 00116 00117 public Q_SLOTS: 00124 void addTreeWidget( QTreeWidget *treeWidget ); 00125 00133 void removeTreeWidget( QTreeWidget *treeWidget ); 00134 00139 virtual void updateSearch( const QString &pattern = QString() ); 00140 00146 void setCaseSensitivity( Qt::CaseSensitivity caseSensitivity ); 00147 00162 void setKeepParentsVisible( bool value ); 00163 00173 void setSearchColumns( const QList<int> &columns ); 00174 00182 void setTreeWidget( QTreeWidget *treeWidget ); 00183 00191 void setTreeWidgets( const QList<QTreeWidget *> &treeWidgets ); 00192 00193 00194 protected: 00200 virtual bool itemMatches( const QTreeWidgetItem *item, const QString &pattern ) const; 00201 00205 virtual void contextMenuEvent( QContextMenuEvent* ); 00206 00211 virtual void updateSearch( QTreeWidget *treeWidget ); 00212 00217 virtual void connectTreeWidget( QTreeWidget* ); 00218 00222 virtual void disconnectTreeWidget( QTreeWidget* ); 00223 00238 virtual bool canChooseColumnsCheck(); 00239 00243 virtual bool event(QEvent *event); 00244 private: 00245 class Private; 00246 Private* const d; 00247 00248 Q_PRIVATE_SLOT(d, void _k_rowsInserted(const QModelIndex&, int, int) const) 00249 Q_PRIVATE_SLOT(d, void _k_treeWidgetDeleted(QObject*)) 00250 Q_PRIVATE_SLOT(d, void _k_slotColumnActivated(QAction*)) 00251 Q_PRIVATE_SLOT(d, void _k_slotAllVisibleColumns()) 00252 Q_PRIVATE_SLOT(d, void _k_queueSearch(const QString&)) 00253 Q_PRIVATE_SLOT(d, void _k_activateSearch()) 00254 }; 00255 00260 class KDEUI_EXPORT KTreeWidgetSearchLineWidget : public QWidget 00261 { 00262 Q_OBJECT 00263 00264 public: 00269 explicit KTreeWidgetSearchLineWidget( QWidget *parent = 0, QTreeWidget *treeWidget = 0 ); 00270 00274 ~KTreeWidgetSearchLineWidget(); 00275 00279 KTreeWidgetSearchLine *searchLine() const; 00280 00281 protected Q_SLOTS: 00288 virtual void createWidgets(); 00289 00290 protected: 00298 virtual KTreeWidgetSearchLine *createSearchLine( QTreeWidget *treeWidget ) const; 00299 00300 private: 00301 class Private; 00302 Private* const d; 00303 }; 00304 00305 #endif
KDE 4.6 API Reference