• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • sources
  • kde-4.12
  • kdelibs
  • kdeui
  • itemviews
ktreewidgetsearchline.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (c) 2003 Scott Wheeler <wheeler@kde.org>
3  Copyright (c) 2005 Rafal Rzepecki <divide@users.sourceforge.net>
4  Copyright (c) 2006 Hamish Rodda <rodda@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License version 2 as published by the Free Software Foundation.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #include "ktreewidgetsearchline.h"
22 
23 #include <QtCore/QList>
24 #include <QtCore/QTimer>
25 #include <QtGui/QApplication>
26 #include <QtGui/QContextMenuEvent>
27 #include <QtGui/QHBoxLayout>
28 #include <QtGui/QHeaderView>
29 #include <QtGui/QLabel>
30 #include <QtGui/QMenu>
31 #include <QtGui/QToolButton>
32 #include <QtGui/QTreeWidget>
33 
34 #include <kdebug.h>
35 #include <klocale.h>
36 
37 class KTreeWidgetSearchLine::Private
38 {
39  public:
40  Private( KTreeWidgetSearchLine *_q )
41  : q( _q ),
42  caseSensitive( Qt::CaseInsensitive ),
43  keepParentsVisible( true ),
44  canChooseColumns( true ),
45  queuedSearches( 0 )
46  {
47  }
48 
49  KTreeWidgetSearchLine *q;
50  QList<QTreeWidget *> treeWidgets;
51  Qt::CaseSensitivity caseSensitive;
52  bool keepParentsVisible;
53  bool canChooseColumns;
54  QString search;
55  int queuedSearches;
56  QList<int> searchColumns;
57 
58  void _k_rowsInserted(const QModelIndex & parent, int start, int end) const;
59  void _k_treeWidgetDeleted( QObject *treeWidget );
60  void _k_slotColumnActivated(QAction* action);
61  void _k_slotAllVisibleColumns();
62  void _k_queueSearch(const QString&);
63  void _k_activateSearch();
64 
65  void checkColumns();
66  void checkItemParentsNotVisible(QTreeWidget *treeWidget);
67  bool checkItemParentsVisible(QTreeWidgetItem* item);
68 };
69 
71 // private slots
73 
74 // Hack to make a protected method public
75 class QTreeWidgetWorkaround : public QTreeWidget
76 {
77  public:
78  QTreeWidgetItem *itemFromIndex( const QModelIndex &index ) const
79  {
80  return QTreeWidget::itemFromIndex( index );
81  }
82 };
83 
84 void KTreeWidgetSearchLine::Private::_k_rowsInserted( const QModelIndex & parentIndex, int start, int end ) const
85 {
86  QAbstractItemModel* model = qobject_cast<QAbstractItemModel*>( q->sender() );
87  if ( !model )
88  return;
89 
90  QTreeWidget* widget = 0L;
91  foreach ( QTreeWidget* tree, treeWidgets )
92  if ( tree->model() == model ) {
93  widget = tree;
94  break;
95  }
96 
97  if ( !widget )
98  return;
99 
100  QTreeWidgetWorkaround* widgetW = static_cast<QTreeWidgetWorkaround *>(widget);
101  for (int i = start; i <= end; ++i) {
102  if (QTreeWidgetItem *item = widgetW->itemFromIndex(model->index(i, 0, parentIndex))) {
103  bool newHidden = !q->itemMatches(item, q->text());
104  if (item->isHidden() != newHidden) {
105  item->setHidden(newHidden);
106  emit q->hiddenChanged(item, newHidden);
107  }
108  }
109  }
110 }
111 
112 void KTreeWidgetSearchLine::Private::_k_treeWidgetDeleted( QObject *object )
113 {
114  treeWidgets.removeAll( static_cast<QTreeWidget *>( object ) );
115  q->setEnabled( treeWidgets.isEmpty() );
116 }
117 
118 void KTreeWidgetSearchLine::Private::_k_slotColumnActivated( QAction *action )
119 {
120  if ( !action )
121  return;
122 
123  bool ok;
124  int column = action->data().toInt( &ok );
125 
126  if ( !ok )
127  return;
128 
129  if ( action->isChecked() ) {
130  if ( !searchColumns.isEmpty() ) {
131  if ( !searchColumns.contains( column ) )
132  searchColumns.append( column );
133 
134  if ( searchColumns.count() == treeWidgets.first()->header()->count() - treeWidgets.first()->header()->hiddenSectionCount() )
135  searchColumns.clear();
136 
137  } else {
138  searchColumns.append( column );
139  }
140  } else {
141  if ( searchColumns.isEmpty() ) {
142  QHeaderView* const header = treeWidgets.first()->header();
143 
144  for ( int i = 0; i < header->count(); i++ ) {
145  if ( i != column && !header->isSectionHidden( i ) )
146  searchColumns.append( i );
147  }
148 
149  } else if ( searchColumns.contains( column ) ) {
150  searchColumns.removeAll( column );
151  }
152  }
153 
154  q->updateSearch();
155 }
156 
157 void KTreeWidgetSearchLine::Private::_k_slotAllVisibleColumns()
158 {
159  if ( searchColumns.isEmpty() )
160  searchColumns.append( 0 );
161  else
162  searchColumns.clear();
163 
164  q->updateSearch();
165 }
166 
168 // private methods
170 
171 
172 void KTreeWidgetSearchLine::Private::checkColumns()
173 {
174  canChooseColumns = q->canChooseColumnsCheck();
175 }
176 
177 void KTreeWidgetSearchLine::Private::checkItemParentsNotVisible(QTreeWidget *treeWidget)
178 {
179  for (QTreeWidgetItemIterator it(treeWidget); *it; ++it) {
180  QTreeWidgetItem *item = *it;
181  bool newHidden = !q->itemMatches(item, search);
182  if (item->isHidden() != newHidden) {
183  item->setHidden(newHidden);
184  emit q->hiddenChanged(item, newHidden);
185  }
186  }
187 }
188 
196 bool KTreeWidgetSearchLine::Private::checkItemParentsVisible(QTreeWidgetItem *item)
197 {
198  bool childMatch = false;
199  for (int i = 0; i < item->childCount(); ++i) {
200  childMatch |= checkItemParentsVisible(item->child(i));
201  }
202 
203  // Should this item be shown? It should if any children should be, or if it matches.
204  bool newHidden = !childMatch && !q->itemMatches(item, search);
205  if (item->isHidden() != newHidden) {
206  item->setHidden(newHidden);
207  emit q->hiddenChanged(item, newHidden);
208  }
209 
210  return !newHidden;
211 }
212 
213 
215 // public methods
217 
218 KTreeWidgetSearchLine::KTreeWidgetSearchLine( QWidget *q, QTreeWidget *treeWidget )
219  : KLineEdit( q ), d( new Private( this ) )
220 {
221  connect( this, SIGNAL(textChanged(QString)),
222  this, SLOT(_k_queueSearch(QString)) );
223 
224  setClearButtonShown( true );
225  setTreeWidget( treeWidget );
226 
227  if ( !treeWidget ) {
228  setEnabled( false );
229  }
230 }
231 
232 KTreeWidgetSearchLine::KTreeWidgetSearchLine( QWidget *q,
233  const QList<QTreeWidget *> &treeWidgets )
234  : KLineEdit( q ), d( new Private( this ) )
235 {
236  connect( this, SIGNAL(textChanged(QString)),
237  this, SLOT(_k_queueSearch(QString)) );
238 
239  setClearButtonShown( true );
240  setTreeWidgets( treeWidgets );
241 }
242 
243 KTreeWidgetSearchLine::~KTreeWidgetSearchLine()
244 {
245  delete d;
246 }
247 
248 Qt::CaseSensitivity KTreeWidgetSearchLine::caseSensitivity() const
249 {
250  return d->caseSensitive;
251 }
252 
253 QList<int> KTreeWidgetSearchLine::searchColumns() const
254 {
255  if ( d->canChooseColumns )
256  return d->searchColumns;
257  else
258  return QList<int>();
259 }
260 
261 bool KTreeWidgetSearchLine::keepParentsVisible() const
262 {
263  return d->keepParentsVisible;
264 }
265 
266 QTreeWidget *KTreeWidgetSearchLine::treeWidget() const
267 {
268  if ( d->treeWidgets.count() == 1 )
269  return d->treeWidgets.first();
270  else
271  return 0;
272 }
273 
274 QList<QTreeWidget *> KTreeWidgetSearchLine::treeWidgets() const
275 {
276  return d->treeWidgets;
277 }
278 
279 
281 // public slots
283 
284 void KTreeWidgetSearchLine::addTreeWidget( QTreeWidget *treeWidget )
285 {
286  if ( treeWidget ) {
287  connectTreeWidget( treeWidget );
288 
289  d->treeWidgets.append( treeWidget );
290  setEnabled( !d->treeWidgets.isEmpty() );
291 
292  d->checkColumns();
293  }
294 }
295 
296 void KTreeWidgetSearchLine::removeTreeWidget( QTreeWidget *treeWidget )
297 {
298  if ( treeWidget ) {
299  int index = d->treeWidgets.indexOf( treeWidget );
300 
301  if ( index != -1 ) {
302  d->treeWidgets.removeAt( index );
303  d->checkColumns();
304 
305  disconnectTreeWidget( treeWidget );
306 
307  setEnabled( !d->treeWidgets.isEmpty() );
308  }
309  }
310 }
311 
312 void KTreeWidgetSearchLine::updateSearch( const QString &pattern )
313 {
314  d->search = pattern.isNull() ? text() : pattern;
315 
316  foreach ( QTreeWidget* treeWidget, d->treeWidgets )
317  updateSearch( treeWidget );
318 }
319 
320 void KTreeWidgetSearchLine::updateSearch( QTreeWidget *treeWidget )
321 {
322  if ( !treeWidget || !treeWidget->topLevelItemCount() )
323  return;
324 
325 
326  // If there's a selected item that is visible, make sure that it's visible
327  // when the search changes too (assuming that it still matches).
328 
329  QTreeWidgetItem *currentItem = treeWidget->currentItem();
330 
331  if ( d->keepParentsVisible )
332  for ( int i = 0; i < treeWidget->topLevelItemCount(); ++i )
333  d->checkItemParentsVisible( treeWidget->topLevelItem( i ) );
334  else
335  d->checkItemParentsNotVisible( treeWidget );
336 
337  if ( currentItem )
338  treeWidget->scrollToItem( currentItem );
339 }
340 
341 void KTreeWidgetSearchLine::setCaseSensitivity( Qt::CaseSensitivity caseSensitive )
342 {
343  if ( d->caseSensitive != caseSensitive ) {
344  d->caseSensitive = caseSensitive;
345  updateSearch();
346  }
347 }
348 
349 void KTreeWidgetSearchLine::setKeepParentsVisible( bool visible )
350 {
351  if ( d->keepParentsVisible != visible ) {
352  d->keepParentsVisible = visible;
353  updateSearch();
354  }
355 }
356 
357 void KTreeWidgetSearchLine::setSearchColumns( const QList<int> &columns )
358 {
359  if ( d->canChooseColumns )
360  d->searchColumns = columns;
361 }
362 
363 void KTreeWidgetSearchLine::setTreeWidget( QTreeWidget *treeWidget )
364 {
365  setTreeWidgets( QList<QTreeWidget *>() );
366  addTreeWidget( treeWidget );
367 }
368 
369 void KTreeWidgetSearchLine::setTreeWidgets( const QList<QTreeWidget *> &treeWidgets )
370 {
371  foreach ( QTreeWidget* treeWidget, d->treeWidgets )
372  disconnectTreeWidget( treeWidget );
373 
374  d->treeWidgets = treeWidgets;
375 
376  foreach ( QTreeWidget* treeWidget, d->treeWidgets )
377  connectTreeWidget( treeWidget );
378 
379  d->checkColumns();
380 
381  setEnabled( !d->treeWidgets.isEmpty() );
382 }
383 
385 // protected members
387 
388 bool KTreeWidgetSearchLine::itemMatches( const QTreeWidgetItem *item, const QString &pattern ) const
389 {
390  if ( pattern.isEmpty() )
391  return true;
392 
393  // If the search column list is populated, search just the columns
394  // specified. If it is empty default to searching all of the columns.
395 
396  if ( !d->searchColumns.isEmpty() ) {
397  QList<int>::ConstIterator it = d->searchColumns.constBegin();
398  for ( ; it != d->searchColumns.constEnd(); ++it ) {
399  if ( *it < item->treeWidget()->columnCount() &&
400  item->text( *it ).indexOf( pattern, 0, d->caseSensitive ) >= 0 )
401  return true;
402  }
403  } else {
404  for ( int i = 0; i < item->treeWidget()->columnCount(); i++) {
405  if ( item->treeWidget()->columnWidth(i) > 0 &&
406  item->text( i ).indexOf( pattern, 0, d->caseSensitive ) >= 0 )
407  return true;
408  }
409  }
410 
411  return false;
412 }
413 
414 void KTreeWidgetSearchLine::contextMenuEvent( QContextMenuEvent *event )
415 {
416  QMenu *popup = KLineEdit::createStandardContextMenu();
417 
418  if ( d->canChooseColumns ) {
419  popup->addSeparator();
420  QMenu *subMenu = popup->addMenu( i18n("Search Columns") );
421 
422  QAction* allVisibleColumnsAction = subMenu->addAction( i18n("All Visible Columns"),
423  this, SLOT(_k_slotAllVisibleColumns()) );
424  allVisibleColumnsAction->setCheckable( true );
425  allVisibleColumnsAction->setChecked( !d->searchColumns.count() );
426  subMenu->addSeparator();
427 
428  bool allColumnsAreSearchColumns = true;
429 
430  QActionGroup* group = new QActionGroup( popup );
431  group->setExclusive( false );
432  connect( group, SIGNAL(triggered(QAction*)), SLOT(_k_slotColumnActivated(QAction*)) );
433 
434  QHeaderView* const header = d->treeWidgets.first()->header();
435  for ( int j = 0; j < header->count(); j++ ) {
436  int i = header->logicalIndex( j );
437 
438  if ( header->isSectionHidden( i ) )
439  continue;
440 
441  QString columnText = d->treeWidgets.first()->headerItem()->text( i );
442  QAction* columnAction = subMenu->addAction( d->treeWidgets.first()->headerItem()->icon( i ), columnText );
443  columnAction->setCheckable( true );
444  columnAction->setChecked( d->searchColumns.isEmpty() || d->searchColumns.contains( i ) );
445  columnAction->setData( i );
446  columnAction->setActionGroup( group );
447 
448  if ( d->searchColumns.isEmpty() || d->searchColumns.indexOf( i ) != -1 )
449  columnAction->setChecked( true );
450  else
451  allColumnsAreSearchColumns = false;
452  }
453 
454  allVisibleColumnsAction->setChecked( allColumnsAreSearchColumns );
455 
456  // searchColumnsMenuActivated() relies on one possible "all" representation
457  if ( allColumnsAreSearchColumns && !d->searchColumns.isEmpty() )
458  d->searchColumns.clear();
459  }
460 
461  popup->exec( event->globalPos() );
462  delete popup;
463 }
464 
465 void KTreeWidgetSearchLine::connectTreeWidget( QTreeWidget *treeWidget )
466 {
467  connect( treeWidget, SIGNAL(destroyed(QObject*)),
468  this, SLOT(_k_treeWidgetDeleted(QObject*)) );
469 
470  connect( treeWidget->model(), SIGNAL(rowsInserted(QModelIndex,int,int)),
471  this, SLOT(_k_rowsInserted(QModelIndex,int,int)) );
472 }
473 
474 void KTreeWidgetSearchLine::disconnectTreeWidget( QTreeWidget *treeWidget )
475 {
476  disconnect( treeWidget, SIGNAL(destroyed(QObject*)),
477  this, SLOT(_k_treeWidgetDeleted(QObject*)) );
478 
479  disconnect( treeWidget->model(), SIGNAL(rowsInserted(QModelIndex,int,int)),
480  this, SLOT(_k_rowsInserted(QModelIndex,int,int)) );
481 }
482 
483 bool KTreeWidgetSearchLine::canChooseColumnsCheck()
484 {
485  // This is true if either of the following is true:
486 
487  // there are no listviews connected
488  if ( d->treeWidgets.isEmpty() )
489  return false;
490 
491  const QTreeWidget *first = d->treeWidgets.first();
492 
493  const unsigned int numcols = first->columnCount();
494  // the listviews have only one column,
495  if ( numcols < 2 )
496  return false;
497 
498  QStringList headers;
499  for ( unsigned int i = 0; i < numcols; ++i )
500  headers.append( first->headerItem()->text( i ) );
501 
502  QList<QTreeWidget *>::ConstIterator it = d->treeWidgets.constBegin();
503  for ( ++it /* skip the first one */; it != d->treeWidgets.constEnd(); ++it ) {
504  // the listviews have different numbers of columns,
505  if ( (unsigned int) (*it)->columnCount() != numcols )
506  return false;
507 
508  // the listviews differ in column labels.
509  QStringList::ConstIterator jt;
510  unsigned int i;
511  for ( i = 0, jt = headers.constBegin(); i < numcols; ++i, ++jt ) {
512  Q_ASSERT( jt != headers.constEnd() );
513 
514  if ( (*it)->headerItem()->text( i ) != *jt )
515  return false;
516  }
517  }
518 
519  return true;
520 }
521 
522 bool KTreeWidgetSearchLine::event(QEvent *event) {
523 
524  if (event->type() == QEvent::KeyPress) {
525  QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
526  if(keyEvent->matches(QKeySequence::MoveToNextLine) || keyEvent->matches(QKeySequence::SelectNextLine) ||
527  keyEvent->matches(QKeySequence::MoveToPreviousLine) || keyEvent->matches(QKeySequence::SelectPreviousLine) ||
528  keyEvent->matches(QKeySequence::MoveToNextPage) || keyEvent->matches(QKeySequence::SelectNextPage) ||
529  keyEvent->matches(QKeySequence::MoveToPreviousPage) || keyEvent->matches(QKeySequence::SelectPreviousPage) ||
530  keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return)
531  {
532  QTreeWidget *first = d->treeWidgets.first();
533  if(first) {
534  QApplication::sendEvent(first, event);
535  return true;
536  }
537  }
538  }
539  return KLineEdit::event(event);
540 }
541 
543 // protected slots
545 
546 void KTreeWidgetSearchLine::Private::_k_queueSearch( const QString &_search )
547 {
548  queuedSearches++;
549  search = _search;
550 
551  QTimer::singleShot( 200, q, SLOT(_k_activateSearch()) );
552 }
553 
554 void KTreeWidgetSearchLine::Private::_k_activateSearch()
555 {
556  --queuedSearches;
557 
558  if ( queuedSearches == 0 )
559  q->updateSearch( search );
560 }
561 
563 // KTreeWidgetSearchLineWidget
565 
566 class KTreeWidgetSearchLineWidget::Private
567 {
568  public:
569  Private()
570  : treeWidget( 0 ),
571  searchLine( 0 )
572  {
573  }
574 
575  QTreeWidget *treeWidget;
576  KTreeWidgetSearchLine *searchLine;
577 };
578 
579 KTreeWidgetSearchLineWidget::KTreeWidgetSearchLineWidget( QWidget *parent, QTreeWidget *treeWidget )
580  : QWidget( parent ), d( new Private )
581 {
582  d->treeWidget = treeWidget;
583 
584  // can't call createWidgets directly because it calls virtual functions
585  // that might not work if called directly from here due to how inheritance works
586  QMetaObject::invokeMethod(this, "createWidgets", Qt::QueuedConnection);
587 }
588 
589 KTreeWidgetSearchLineWidget::~KTreeWidgetSearchLineWidget()
590 {
591  delete d;
592 }
593 
594 KTreeWidgetSearchLine *KTreeWidgetSearchLineWidget::createSearchLine( QTreeWidget *treeWidget ) const
595 {
596  return new KTreeWidgetSearchLine( const_cast<KTreeWidgetSearchLineWidget*>(this), treeWidget );
597 }
598 
599 void KTreeWidgetSearchLineWidget::createWidgets()
600 {
601  QLabel *label = new QLabel( i18n("S&earch:"), this );
602 
603  searchLine()->show();
604 
605  label->setBuddy( d->searchLine );
606  label->show();
607 
608  QHBoxLayout* layout = new QHBoxLayout( this );
609  layout->setMargin( 0 );
610  layout->addWidget( label );
611  layout->addWidget( d->searchLine );
612  setFocusProxy( searchLine() );
613 }
614 
615 KTreeWidgetSearchLine *KTreeWidgetSearchLineWidget::searchLine() const
616 {
617  if ( !d->searchLine )
618  d->searchLine = createSearchLine( d->treeWidget );
619 
620  return d->searchLine;
621 }
622 
623 #include "ktreewidgetsearchline.moc"
i18n
QString i18n(const char *text)
KTreeWidgetSearchLine
This class makes it easy to add a search line for filtering the items in listviews based on a simple ...
Definition: ktreewidgetsearchline.h:38
header
const char header[]
KTreeWidgetSearchLineWidget::searchLine
KTreeWidgetSearchLine * searchLine() const
Returns a pointer to the search line.
Definition: ktreewidgetsearchline.cpp:615
kdebug.h
KTreeWidgetSearchLine::event
virtual bool event(QEvent *event)
Re-implemented for internal reasons.
Definition: ktreewidgetsearchline.cpp:522
KTreeWidgetSearchLine::~KTreeWidgetSearchLine
virtual ~KTreeWidgetSearchLine()
Destroys the KTreeWidgetSearchLine.
Definition: ktreewidgetsearchline.cpp:243
QTreeWidget
group
KLineEdit::createStandardContextMenu
QMenu * createStandardContextMenu()
Re-implemented for internal reasons.
Definition: klineedit.cpp:1180
KStandardShortcut::label
QString label(StandardShortcut id)
Returns a localized label for user-visible display.
Definition: kstandardshortcut.cpp:267
QWidget
KTreeWidgetSearchLine::caseSensitivity
Qt::CaseSensitivity caseSensitivity() const
Returns true if the search is case sensitive.
Definition: ktreewidgetsearchline.cpp:248
KTreeWidgetSearchLine::KTreeWidgetSearchLine
KTreeWidgetSearchLine(QWidget *parent=0, QTreeWidget *treeWidget=0)
Constructs a KTreeWidgetSearchLine with treeWidget being the QTreeWidget to be filtered.
Definition: ktreewidgetsearchline.cpp:218
KTreeWidgetSearchLineWidget::KTreeWidgetSearchLineWidget
KTreeWidgetSearchLineWidget(QWidget *parent=0, QTreeWidget *treeWidget=0)
Creates a KTreeWidgetSearchLineWidget for treeWidget with parent as the parent.
Definition: ktreewidgetsearchline.cpp:579
QString
QObject
klocale.h
KTreeWidgetSearchLine::searchColumns
QList< int > searchColumns() const
Returns the current list of columns that will be searched.
Definition: ktreewidgetsearchline.cpp:253
KTreeWidgetSearchLine::canChooseColumnsCheck
virtual bool canChooseColumnsCheck()
Checks columns in all listviews and decides whether choosing columns to filter on makes any sense...
Definition: ktreewidgetsearchline.cpp:483
KTreeWidgetSearchLine::updateSearch
virtual void updateSearch(const QString &pattern=QString())
Updates search to only make visible the items that match pattern.
Definition: ktreewidgetsearchline.cpp:312
KTreeWidgetSearchLine::addTreeWidget
void addTreeWidget(QTreeWidget *treeWidget)
Adds a QTreeWidget to the list of listviews filtered by this search line.
Definition: ktreewidgetsearchline.cpp:284
QStringList
KTreeWidgetSearchLine::treeWidget
QTreeWidget * treeWidget() const
Returns the listview that is currently filtered by the search.
Definition: ktreewidgetsearchline.cpp:266
KTreeWidgetSearchLine::setTreeWidgets
void setTreeWidgets(const QList< QTreeWidget * > &treeWidgets)
Sets QTreeWidgets that are filtered by this search line, replacing any previously filtered listviews...
Definition: ktreewidgetsearchline.cpp:369
ktreewidgetsearchline.h
KTreeWidgetSearchLine::itemMatches
virtual bool itemMatches(const QTreeWidgetItem *item, const QString &pattern) const
Returns true if item matches the search pattern.
Definition: ktreewidgetsearchline.cpp:388
QAbstractItemModel
KTreeWidgetSearchLine::setTreeWidget
void setTreeWidget(QTreeWidget *treeWidget)
Sets the QTreeWidget that is filtered by this search line, replacing any previously filtered listview...
Definition: ktreewidgetsearchline.cpp:363
KTreeWidgetSearchLine::setCaseSensitivity
void setCaseSensitivity(Qt::CaseSensitivity caseSensitivity)
Make the search case sensitive or case insensitive.
Definition: ktreewidgetsearchline.cpp:341
KStandardGuiItem::ok
KGuiItem ok()
Returns the 'Ok' gui item.
Definition: kstandardguiitem.cpp:107
QMenu
KTreeWidgetSearchLine::treeWidgets
QList< QTreeWidget * > treeWidgets() const
Returns the list of pointers to listviews that are currently filtered by the search.
Definition: ktreewidgetsearchline.cpp:274
KLineEdit
An enhanced QLineEdit widget for inputting text.
Definition: klineedit.h:149
KTreeWidgetSearchLine::setKeepParentsVisible
void setKeepParentsVisible(bool value)
When a search is active on a list that's organized into a tree view if a parent or ancesestor of an i...
Definition: ktreewidgetsearchline.cpp:349
QLabel
KLineEdit::event
virtual bool event(QEvent *)
Re-implemented for internal reasons.
Definition: klineedit.cpp:1358
KTreeWidgetSearchLine::contextMenuEvent
virtual void contextMenuEvent(QContextMenuEvent *)
Re-implemented for internal reasons.
Definition: ktreewidgetsearchline.cpp:414
KLineEdit::setClearButtonShown
void setClearButtonShown(bool show)
This makes the line edit display an icon on one side of the line edit which, when clicked...
Definition: klineedit.cpp:284
KTreeWidgetSearchLine::setSearchColumns
void setSearchColumns(const QList< int > &columns)
Sets the list of columns to be searched.
Definition: ktreewidgetsearchline.cpp:357
KTreeWidgetSearchLineWidget::createWidgets
virtual void createWidgets()
Creates the widgets inside of the widget.
Definition: ktreewidgetsearchline.cpp:599
KTreeWidgetSearchLineWidget::~KTreeWidgetSearchLineWidget
~KTreeWidgetSearchLineWidget()
Destroys the KTreeWidgetSearchLineWidget.
Definition: ktreewidgetsearchline.cpp:589
KTreeWidgetSearchLine::connectTreeWidget
virtual void connectTreeWidget(QTreeWidget *)
Connects signals of this listview to the appropriate slots of the search line.
Definition: ktreewidgetsearchline.cpp:465
KTreeWidgetSearchLine::keepParentsVisible
bool keepParentsVisible() const
If this is true (the default) then the parents of matched items will also be shown.
KStandardShortcut::end
const KShortcut & end()
Goto end of the document.
Definition: kstandardshortcut.cpp:348
KTreeWidgetSearchLine::disconnectTreeWidget
virtual void disconnectTreeWidget(QTreeWidget *)
Disconnects signals of a listviews from the search line.
Definition: ktreewidgetsearchline.cpp:474
KTreeWidgetSearchLine::removeTreeWidget
void removeTreeWidget(QTreeWidget *treeWidget)
Removes a QTreeWidget from the list of listviews filtered by this search line.
Definition: ktreewidgetsearchline.cpp:296
QAction
KTreeWidgetSearchLineWidget::createSearchLine
virtual KTreeWidgetSearchLine * createSearchLine(QTreeWidget *treeWidget) const
Creates the search line.
Definition: ktreewidgetsearchline.cpp:594
QList< QTreeWidget * >
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:16 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

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 API Reference

Skip menu "kdelibs API Reference"
  • 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal