~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/tools/engineexplorer/ktreeviewsearchline.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
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
   Copyright 2007 Pino Toscano <pino@kde.org>
 
6
 
 
7
   This library is free software; you can redistribute it and/or
 
8
   modify it under the terms of the GNU Library General Public
 
9
   License version 2 as published by the Free Software Foundation.
 
10
 
 
11
   This library is distributed in the hope that it will be useful,
 
12
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
   Library General Public License for more details.
 
15
 
 
16
   You should have received a copy of the GNU Library General Public License
 
17
   along with this library; see the file COPYING.LIB.  If not, write to
 
18
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
19
   Boston, MA 02110-1301, USA.
 
20
*/
 
21
 
 
22
#include "ktreeviewsearchline.h"
 
23
 
 
24
#include <QtCore/QList>
 
25
#include <QtCore/QTimer>
 
26
#include <QtGui/QApplication>
 
27
#include <QtGui/QContextMenuEvent>
 
28
#include <QtGui/QHBoxLayout>
 
29
#include <QtGui/QHeaderView>
 
30
#include <QtGui/QLabel>
 
31
#include <QtGui/QMenu>
 
32
#include <QtGui/QToolButton>
 
33
#include <QtGui/QTreeView>
 
34
 
 
35
#include <kdebug.h>
 
36
#include <kiconloader.h>
 
37
#include <klocale.h>
 
38
#include <ktoolbar.h>
 
39
#include <kvbox.h>
 
40
 
 
41
 
 
42
class KTreeViewSearchLine::Private
 
43
{
 
44
  public:
 
45
    Private( KTreeViewSearchLine *_parent )
 
46
      : parent( _parent ),
 
47
        caseSensitive( Qt::CaseInsensitive ),
 
48
        activeSearch( false ),
 
49
        keepParentsVisible( true ),
 
50
        canChooseColumns( true ),
 
51
        queuedSearches( 0 )
 
52
    {
 
53
    }
 
54
 
 
55
    KTreeViewSearchLine *parent;
 
56
    QList<QTreeView *> treeViews;
 
57
    Qt::CaseSensitivity caseSensitive;
 
58
    bool activeSearch;
 
59
    bool keepParentsVisible;
 
60
    bool canChooseColumns;
 
61
    QString search;
 
62
    int queuedSearches;
 
63
    QList<int> searchColumns;
 
64
 
 
65
    void rowsInserted(const QModelIndex & parent, int start, int end) const;
 
66
    void treeViewDeleted( QObject *treeView );
 
67
    void slotColumnActivated(QAction* action);
 
68
    void slotAllVisibleColumns();
 
69
 
 
70
    void checkColumns();
 
71
    void checkItemParentsNotVisible(QTreeView *treeView);
 
72
    bool checkItemParentsVisible(QTreeView *treeView, const QModelIndex &index);
 
73
};
 
74
 
 
75
////////////////////////////////////////////////////////////////////////////////
 
76
// private slots
 
77
////////////////////////////////////////////////////////////////////////////////
 
78
 
 
79
void KTreeViewSearchLine::Private::rowsInserted( const QModelIndex & parentIndex, int start, int end ) const
 
80
{
 
81
  QAbstractItemModel* model = qobject_cast<QAbstractItemModel*>( parent->sender() );
 
82
  if ( !model )
 
83
    return;
 
84
 
 
85
  QTreeView* widget = 0L;
 
86
  foreach ( QTreeView* tree, treeViews )
 
87
    if ( tree->model() == model ) {
 
88
      widget = tree;
 
89
      break;
 
90
    }
 
91
 
 
92
  if ( !widget )
 
93
    return;
 
94
 
 
95
  for ( int i = start; i <= end; ++i ) {
 
96
     widget->setRowHidden( i, parentIndex, !parent->itemMatches( parentIndex, i, parent->text() ) );
 
97
  }
 
98
}
 
99
 
 
100
void KTreeViewSearchLine::Private::treeViewDeleted( QObject *object )
 
101
{
 
102
  treeViews.removeAll( static_cast<QTreeView *>( object ) );
 
103
  parent->setEnabled( treeViews.isEmpty() );
 
104
}
 
105
 
 
106
void KTreeViewSearchLine::Private::slotColumnActivated( QAction *action )
 
107
{
 
108
  if ( !action )
 
109
    return;
 
110
 
 
111
  bool ok;
 
112
  int column = action->data().toInt( &ok );
 
113
 
 
114
  if ( !ok )
 
115
    return;
 
116
 
 
117
  if ( action->isChecked() ) {
 
118
    if ( !searchColumns.isEmpty() ) {
 
119
      if ( !searchColumns.contains( column ) )
 
120
        searchColumns.append( column );
 
121
 
 
122
      if ( searchColumns.count() == treeViews.first()->header()->count() - treeViews.first()->header()->hiddenSectionCount() )
 
123
        searchColumns.clear();
 
124
 
 
125
    } else {
 
126
      searchColumns.append( column );
 
127
    }
 
128
  } else {
 
129
    if ( searchColumns.isEmpty() ) {
 
130
      QHeaderView* const header = treeViews.first()->header();
 
131
 
 
132
      for ( int i = 0; i < header->count(); i++ ) {
 
133
        if ( i != column && !header->isSectionHidden( i ) )
 
134
          searchColumns.append( i );
 
135
      }
 
136
 
 
137
    } else if ( searchColumns.contains( column ) ) {
 
138
      searchColumns.removeAll( column );
 
139
    }
 
140
  }
 
141
 
 
142
  parent->updateSearch();
 
143
}
 
144
 
 
145
void KTreeViewSearchLine::Private::slotAllVisibleColumns()
 
146
{
 
147
  if ( searchColumns.isEmpty() )
 
148
    searchColumns.append( 0 );
 
149
  else
 
150
    searchColumns.clear();
 
151
 
 
152
  parent->updateSearch();
 
153
}
 
154
 
 
155
////////////////////////////////////////////////////////////////////////////////
 
156
// private methods
 
157
////////////////////////////////////////////////////////////////////////////////
 
158
 
 
159
 
 
160
void KTreeViewSearchLine::Private::checkColumns()
 
161
{
 
162
  canChooseColumns = parent->canChooseColumnsCheck();
 
163
}
 
164
 
 
165
void KTreeViewSearchLine::Private::checkItemParentsNotVisible( QTreeView *treeView )
 
166
{
 
167
    Q_UNUSED(treeView)
 
168
 
 
169
// TODO: PORT ME
 
170
#if 0
 
171
  QTreeWidgetItemIterator it( treeWidget );
 
172
 
 
173
  for ( ; *it; ++it ) {
 
174
    QTreeWidgetItem *item = *it;
 
175
    item->treeWidget()->setItemHidden( item, !parent->itemMatches( item, search ) );
 
176
  }
 
177
#endif
 
178
}
 
179
 
 
180
 
 
181
/** Check whether \p item, its siblings and their descendents should be shown. Show or hide the items as necessary.
 
182
 *
 
183
 *  \p item  The list view item to start showing / hiding items at. Typically, this is the first child of another item, or the
 
184
 *              the first child of the list view.
 
185
 *  \return \c true if an item which should be visible is found, \c false if all items found should be hidden. If this function
 
186
 *             returns true and \p highestHiddenParent was not 0, highestHiddenParent will have been shown.
 
187
 */
 
188
bool KTreeViewSearchLine::Private::checkItemParentsVisible( QTreeView *treeView, const QModelIndex &index )
 
189
{
 
190
  bool childMatch = false;
 
191
  const int rowcount = treeView->model()->rowCount( index );
 
192
  for ( int i = 0; i < rowcount; ++i )
 
193
    childMatch |= checkItemParentsVisible( treeView, treeView->model()->index( i, 0, index ) );
 
194
 
 
195
  // Should this item be shown? It should if any children should be, or if it matches.
 
196
  const QModelIndex parentindex = index.parent();
 
197
  if ( childMatch || parent->itemMatches( parentindex, index.row(), search ) ) {
 
198
    treeView->setRowHidden( index.row(), parentindex, false );
 
199
    return true;
 
200
  }
 
201
 
 
202
  treeView->setRowHidden( index.row(), parentindex, true );
 
203
 
 
204
  return false;
 
205
}
 
206
 
 
207
 
 
208
////////////////////////////////////////////////////////////////////////////////
 
209
// public methods
 
210
////////////////////////////////////////////////////////////////////////////////
 
211
 
 
212
KTreeViewSearchLine::KTreeViewSearchLine( QWidget *parent, QTreeView *treeView )
 
213
  : KLineEdit( parent ), d( new Private( this ) )
 
214
{
 
215
  connect( this, SIGNAL( textChanged( const QString& ) ),
 
216
           this, SLOT( queueSearch( const QString& ) ) );
 
217
 
 
218
  setClearButtonShown( true );
 
219
  setTreeView( treeView );
 
220
 
 
221
  if ( !treeView ) {
 
222
      setEnabled( false );
 
223
  }
 
224
}
 
225
 
 
226
KTreeViewSearchLine::KTreeViewSearchLine( QWidget *parent,
 
227
                                              const QList<QTreeView *> &treeViews )
 
228
  : KLineEdit( parent ), d( new Private( this ) )
 
229
{
 
230
  connect( this, SIGNAL( textChanged( const QString& ) ),
 
231
           this, SLOT( queueSearch( const QString& ) ) );
 
232
 
 
233
  setClearButtonShown( true );
 
234
  setTreeViews( treeViews );
 
235
}
 
236
 
 
237
KTreeViewSearchLine::~KTreeViewSearchLine()
 
238
{
 
239
  delete d;
 
240
}
 
241
 
 
242
Qt::CaseSensitivity KTreeViewSearchLine::caseSensitivity() const
 
243
{
 
244
  return d->caseSensitive;
 
245
}
 
246
 
 
247
QList<int> KTreeViewSearchLine::searchColumns() const
 
248
{
 
249
  if ( d->canChooseColumns )
 
250
    return d->searchColumns;
 
251
  else
 
252
    return QList<int>();
 
253
}
 
254
 
 
255
bool KTreeViewSearchLine::keepParentsVisible() const
 
256
{
 
257
  return d->keepParentsVisible;
 
258
}
 
259
 
 
260
QTreeView *KTreeViewSearchLine::treeView() const
 
261
{
 
262
  if ( d->treeViews.count() == 1 )
 
263
    return d->treeViews.first();
 
264
  else
 
265
    return 0;
 
266
}
 
267
 
 
268
QList<QTreeView *> KTreeViewSearchLine::treeViews() const
 
269
{
 
270
  return d->treeViews;
 
271
}
 
272
 
 
273
 
 
274
////////////////////////////////////////////////////////////////////////////////
 
275
// public slots
 
276
////////////////////////////////////////////////////////////////////////////////
 
277
 
 
278
void KTreeViewSearchLine::addTreeView( QTreeView *treeView )
 
279
{
 
280
  if ( treeView ) {
 
281
    connectTreeView( treeView );
 
282
 
 
283
    d->treeViews.append( treeView );
 
284
    setEnabled( !d->treeViews.isEmpty() );
 
285
 
 
286
    d->checkColumns();
 
287
  }
 
288
}
 
289
 
 
290
void KTreeViewSearchLine::removeTreeView( QTreeView *treeView )
 
291
{
 
292
  if ( treeView ) {
 
293
    int index = d->treeViews.indexOf( treeView );
 
294
 
 
295
    if ( index != -1 ) {
 
296
      d->treeViews.removeAt( index );
 
297
      d->checkColumns();
 
298
 
 
299
      disconnectTreeView( treeView );
 
300
 
 
301
      setEnabled( !d->treeViews.isEmpty() );
 
302
    }
 
303
  }
 
304
}
 
305
 
 
306
void KTreeViewSearchLine::updateSearch( const QString &pattern )
 
307
{
 
308
  d->search = pattern.isNull() ? text() : pattern;
 
309
 
 
310
  foreach ( QTreeView* treeView, d->treeViews )
 
311
    updateSearch( treeView );
 
312
}
 
313
 
 
314
void KTreeViewSearchLine::updateSearch( QTreeView *treeView )
 
315
{
 
316
  if ( !treeView || !treeView->model()->rowCount() )
 
317
    return;
 
318
 
 
319
 
 
320
  // If there's a selected item that is visible, make sure that it's visible
 
321
  // when the search changes too (assuming that it still matches).
 
322
 
 
323
  QModelIndex currentIndex = treeView->currentIndex();
 
324
 
 
325
  bool wasUpdateEnabled = treeView->updatesEnabled();
 
326
  treeView->setUpdatesEnabled( false );
 
327
  if ( d->keepParentsVisible )
 
328
    for ( int i = 0; i < treeView->model()->rowCount(); ++i )
 
329
      d->checkItemParentsVisible( treeView, treeView->rootIndex() );
 
330
  else
 
331
    d->checkItemParentsNotVisible( treeView );
 
332
  treeView->setUpdatesEnabled( wasUpdateEnabled );
 
333
 
 
334
  if ( currentIndex.isValid() )
 
335
    treeView->scrollTo( currentIndex );
 
336
}
 
337
 
 
338
void KTreeViewSearchLine::setCaseSensitivity( Qt::CaseSensitivity caseSensitive )
 
339
{
 
340
  if ( d->caseSensitive != caseSensitive ) {
 
341
    d->caseSensitive = caseSensitive;
 
342
    updateSearch();
 
343
  }
 
344
}
 
345
 
 
346
void KTreeViewSearchLine::setKeepParentsVisible( bool visible )
 
347
{
 
348
  if ( d->keepParentsVisible != visible ) {
 
349
    d->keepParentsVisible = visible;
 
350
    updateSearch();
 
351
  }
 
352
}
 
353
 
 
354
void KTreeViewSearchLine::setSearchColumns( const QList<int> &columns )
 
355
{
 
356
  if ( d->canChooseColumns )
 
357
    d->searchColumns = columns;
 
358
}
 
359
 
 
360
void KTreeViewSearchLine::setTreeView( QTreeView *treeView )
 
361
{
 
362
  setTreeViews( QList<QTreeView *>() );
 
363
  addTreeView( treeView );
 
364
}
 
365
 
 
366
void KTreeViewSearchLine::setTreeViews( const QList<QTreeView *> &treeViews )
 
367
{
 
368
  foreach ( QTreeView* treeView, d->treeViews )
 
369
    disconnectTreeView( treeView );
 
370
 
 
371
  d->treeViews = treeViews;
 
372
 
 
373
  foreach ( QTreeView* treeView, d->treeViews )
 
374
    connectTreeView( treeView );
 
375
 
 
376
  d->checkColumns();
 
377
 
 
378
  setEnabled( !d->treeViews.isEmpty() );
 
379
}
 
380
 
 
381
////////////////////////////////////////////////////////////////////////////////
 
382
// protected members
 
383
////////////////////////////////////////////////////////////////////////////////
 
384
 
 
385
bool KTreeViewSearchLine::itemMatches( const QModelIndex &index, int row, const QString &pattern ) const
 
386
{
 
387
  if ( pattern.isEmpty() )
 
388
    return true;
 
389
 
 
390
  if ( !index.isValid() )
 
391
    return false;
 
392
 
 
393
  // If the search column list is populated, search just the columns
 
394
  // specifified.  If it is empty default to searching all of the columns.
 
395
 
 
396
  const int columncount = index.model()->columnCount( index );
 
397
  if ( !d->searchColumns.isEmpty() ) {
 
398
    QList<int>::ConstIterator it = d->searchColumns.constBegin();
 
399
    for ( ; it != d->searchColumns.constEnd(); ++it ) {
 
400
      if ( *it < columncount &&
 
401
           index.child( row, *it ).data( Qt::DisplayRole ).toString().indexOf( pattern, 0, d->caseSensitive ) >= 0 )
 
402
        return true;
 
403
    }
 
404
  } else {
 
405
    for ( int i = 0; i < columncount; ++i) {
 
406
      if ( index.child( row, i ).data( Qt::DisplayRole ).toString().indexOf( pattern, 0, d->caseSensitive ) >= 0 )
 
407
        return true;
 
408
    }
 
409
  }
 
410
 
 
411
  return false;
 
412
}
 
413
 
 
414
void KTreeViewSearchLine::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( 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( slotColumnActivated( QAction* ) ) );
 
433
 
 
434
    QHeaderView* const header = d->treeViews.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 = header->model()->headerData( i, Qt::Horizontal, Qt::DisplayRole ).toString();
 
442
      QAction* columnAction = subMenu->addAction( qvariant_cast<QIcon>( header->model()->headerData( i, Qt::Horizontal, Qt::DecorationRole ) ), 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 KTreeViewSearchLine::connectTreeView( QTreeView *treeView )
 
466
{
 
467
  connect( treeView, SIGNAL( destroyed( QObject* ) ),
 
468
           this, SLOT( treeViewDeleted( QObject* ) ) );
 
469
 
 
470
  connect( treeView->model(), SIGNAL( rowsInserted( const QModelIndex&, int, int) ),
 
471
           this, SLOT( rowsInserted( const QModelIndex&, int, int ) ) );
 
472
}
 
473
 
 
474
void KTreeViewSearchLine::disconnectTreeView( QTreeView *treeView )
 
475
{
 
476
  disconnect( treeView, SIGNAL( destroyed( QObject* ) ),
 
477
              this, SLOT( treeViewDeleted( QObject* ) ) );
 
478
 
 
479
  disconnect( treeView->model(), SIGNAL( rowsInserted( const QModelIndex&, int, int) ),
 
480
              this, SLOT( rowsInserted( const QModelIndex&, int, int ) ) );
 
481
}
 
482
 
 
483
bool KTreeViewSearchLine::canChooseColumnsCheck()
 
484
{
 
485
  // This is true if either of the following is true:
 
486
 
 
487
  // there are no listviews connected
 
488
  if ( d->treeViews.isEmpty() )
 
489
    return false;
 
490
 
 
491
  const QTreeView *first = d->treeViews.first();
 
492
 
 
493
  const int numcols = first->model()->columnCount();
 
494
  // the listviews have only one column,
 
495
  if ( numcols < 2 )
 
496
    return false;
 
497
 
 
498
  QStringList headers;
 
499
  for ( int i = 0; i < numcols; ++i )
 
500
    headers.append( first->header()->model()->headerData( i, Qt::Horizontal, Qt::DisplayRole ).toString() );
 
501
 
 
502
  QList<QTreeView *>::ConstIterator it = d->treeViews.constBegin();
 
503
  for ( ++it /* skip the first one */; it != d->treeViews.constEnd(); ++it ) {
 
504
    // the listviews have different numbers of columns,
 
505
    if ( (*it)->model()->columnCount() != numcols )
 
506
      return false;
 
507
 
 
508
    // the listviews differ in column labels.
 
509
    QStringList::ConstIterator jt;
 
510
    int i;
 
511
    for ( i = 0, jt = headers.constBegin(); i < numcols; ++i, ++jt ) {
 
512
      Q_ASSERT( jt != headers.constEnd() );
 
513
 
 
514
      if ( (*it)->header()->model()->headerData( i, Qt::Horizontal, Qt::DisplayRole ).toString() != *jt )
 
515
        return false;
 
516
    }
 
517
  }
 
518
 
 
519
  return true;
 
520
}
 
521
 
 
522
////////////////////////////////////////////////////////////////////////////////
 
523
// protected slots
 
524
////////////////////////////////////////////////////////////////////////////////
 
525
 
 
526
void KTreeViewSearchLine::queueSearch( const QString &search )
 
527
{
 
528
  d->queuedSearches++;
 
529
  d->search = search;
 
530
 
 
531
  QTimer::singleShot( 200, this, SLOT( activateSearch() ) );
 
532
}
 
533
 
 
534
void KTreeViewSearchLine::activateSearch()
 
535
{
 
536
  --(d->queuedSearches);
 
537
 
 
538
  if ( d->queuedSearches == 0 )
 
539
    updateSearch( d->search );
 
540
}
 
541
 
 
542
////////////////////////////////////////////////////////////////////////////////
 
543
// KTreeViewSearchLineWidget
 
544
////////////////////////////////////////////////////////////////////////////////
 
545
 
 
546
class KTreeViewSearchLineWidget::Private
 
547
{
 
548
  public:
 
549
    Private()
 
550
      : treeView( 0 ),
 
551
        searchLine( 0 )
 
552
    {
 
553
    }
 
554
 
 
555
    QTreeView *treeView;
 
556
    KTreeViewSearchLine *searchLine;
 
557
};
 
558
 
 
559
KTreeViewSearchLineWidget::KTreeViewSearchLineWidget( QWidget *parent, QTreeView *treeView )
 
560
  : QWidget( parent ), d( new Private )
 
561
{
 
562
  d->treeView = treeView;
 
563
 
 
564
  QTimer::singleShot( 0, this, SLOT( createWidgets() ) );
 
565
}
 
566
 
 
567
KTreeViewSearchLineWidget::~KTreeViewSearchLineWidget()
 
568
{
 
569
  delete d;
 
570
}
 
571
 
 
572
KTreeViewSearchLine *KTreeViewSearchLineWidget::createSearchLine( QTreeView *treeView ) const
 
573
{
 
574
  return new KTreeViewSearchLine( const_cast<KTreeViewSearchLineWidget*>(this), treeView );
 
575
}
 
576
 
 
577
void KTreeViewSearchLineWidget::createWidgets()
 
578
{
 
579
  QLabel *label = new QLabel( i18n("S&earch:"), this );
 
580
  label->setObjectName( QLatin1String("kde toolbar widget") );
 
581
 
 
582
  searchLine()->show();
 
583
 
 
584
  label->setBuddy( d->searchLine );
 
585
  label->show();
 
586
 
 
587
  QHBoxLayout* layout = new QHBoxLayout( this );
 
588
  layout->setSpacing( 5 );
 
589
  layout->setMargin( 0 );
 
590
  layout->addWidget( label );
 
591
  layout->addWidget( d->searchLine );
 
592
}
 
593
 
 
594
KTreeViewSearchLine *KTreeViewSearchLineWidget::searchLine() const
 
595
{
 
596
  if ( !d->searchLine )
 
597
    d->searchLine = createSearchLine( d->treeView );
 
598
 
 
599
  return d->searchLine;
 
600
}
 
601
 
 
602
#include "ktreeviewsearchline.moc"