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

Kate

  • kde-4.14
  • applications
  • kate
  • part
  • completion
  • expandingtree
expandingwidgetmodel.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries and the Kate part.
2  *
3  * Copyright (C) 2007 David Nolden <david.nolden.kdevelop@art-master.de>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
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 "expandingwidgetmodel.h"
22 
23 #include <QTreeView>
24 #include <QModelIndex>
25 #include <QBrush>
26 
27 #include <ktexteditor/codecompletionmodel.h>
28 #include <kiconloader.h>
29 #include <ktextedit.h>
30 #include "kcolorutils.h"
31 
32 #include "expandingdelegate.h"
33 #include <qapplication.h>
34 
35 QIcon ExpandingWidgetModel::m_expandedIcon;
36 QIcon ExpandingWidgetModel::m_collapsedIcon;
37 
38 using namespace KTextEditor;
39 
40 inline QModelIndex firstColumn( const QModelIndex& index ) {
41  return index.sibling(index.row(), 0);
42 }
43 
44 ExpandingWidgetModel::ExpandingWidgetModel( QWidget* parent ) :
45  QAbstractTableModel(parent)
46 {
47 }
48 
49 ExpandingWidgetModel::~ExpandingWidgetModel() {
50  clearExpanding();
51 }
52 
53 static QColor doAlternate(QColor color) {
54  QColor background = QApplication::palette().background().color();
55  return KColorUtils::mix(color, background, 0.15);
56 }
57 
58 uint ExpandingWidgetModel::matchColor(const QModelIndex& index) const {
59 
60  int matchQuality = contextMatchQuality( index.sibling(index.row(), 0) );
61 
62  if( matchQuality > 0 )
63  {
64  bool alternate = index.row() & 1;
65 
66  QColor badMatchColor(0xff00aa44); //Blue-ish green
67  QColor goodMatchColor(0xff00ff00); //Green
68 
69  QColor background = treeView()->palette().light().color();
70 
71  QColor totalColor = KColorUtils::mix(badMatchColor, goodMatchColor, ((float)matchQuality)/10.0);
72 
73  if(alternate)
74  totalColor = doAlternate(totalColor);
75 
76  const float dynamicTint = 0.2;
77  const float minimumTint = 0.2;
78  double tintStrength = (dynamicTint*matchQuality)/10;
79  if(tintStrength)
80  tintStrength += minimumTint; //Some minimum tinting strength, else it's not visible any more
81 
82  return KColorUtils::tint(background, totalColor, tintStrength ).rgb();
83  }else{
84  return 0;
85  }
86 }
87 
88 QVariant ExpandingWidgetModel::data( const QModelIndex & index, int role ) const
89 {
90  switch( role ) {
91  case Qt::BackgroundRole:
92  {
93  if( index.column() == 0 ) {
94  //Highlight by match-quality
95  uint color = matchColor(index);
96  if( color )
97  return QBrush( color );
98  }
99  //Use a special background-color for expanded items
100  if( isExpanded(index) ) {
101  if( index.row() & 1 ) {
102  return doAlternate(treeView()->palette().toolTipBase().color());
103  } else {
104  return treeView()->palette().toolTipBase();
105  }
106  }
107  }
108  }
109  return QVariant();
110 }
111 
112 void ExpandingWidgetModel::clearMatchQualities() {
113  m_contextMatchQualities.clear();
114 }
115 
116 QModelIndex ExpandingWidgetModel::partiallyExpandedRow() const {
117  if( m_partiallyExpanded.isEmpty() )
118  return QModelIndex();
119  else
120  return m_partiallyExpanded.constBegin().key();
121 }
122 
123 void ExpandingWidgetModel::clearExpanding() {
124 
125  clearMatchQualities();
126  QMap<QModelIndex,ExpandingWidgetModel::ExpandingType> oldExpandState = m_expandState;
127  foreach( const QPointer<QWidget> &widget, m_expandingWidgets )
128  if(widget)
129  widget->deleteLater(); // By using deleteLater, we prevent crashes when an action within a widget makes the completion cancel
130  m_expandingWidgets.clear();
131  m_expandState.clear();
132  m_partiallyExpanded.clear();
133 
134  for( QMap<QModelIndex, ExpandingWidgetModel::ExpandingType>::const_iterator it = oldExpandState.constBegin(); it != oldExpandState.constEnd(); ++it )
135  if(it.value() == Expanded)
136  emit dataChanged(it.key(), it.key());
137 }
138 
139 ExpandingWidgetModel::ExpansionType ExpandingWidgetModel::isPartiallyExpanded(const QModelIndex& index) const {
140  if( m_partiallyExpanded.contains(firstColumn(index)) )
141  return m_partiallyExpanded[firstColumn(index)];
142  else
143  return NotExpanded;
144 }
145 
146 void ExpandingWidgetModel::partiallyUnExpand(const QModelIndex& idx_)
147 {
148  QModelIndex index( firstColumn(idx_) );
149  m_partiallyExpanded.remove(index);
150  m_partiallyExpanded.remove(idx_);
151 }
152 
153 int ExpandingWidgetModel::partiallyExpandWidgetHeight() const {
154  return 60;
155 }
156 
157 void ExpandingWidgetModel::rowSelected(const QModelIndex& idx_)
158 {
159  QModelIndex idx( firstColumn(idx_) );
160  if( !m_partiallyExpanded.contains( idx ) )
161  {
162  QModelIndex oldIndex = partiallyExpandedRow();
163  //Unexpand the previous partially expanded row
164  if( !m_partiallyExpanded.isEmpty() )
165  {
166  while( !m_partiallyExpanded.isEmpty() )
167  m_partiallyExpanded.erase(m_partiallyExpanded.begin());
168  //partiallyUnExpand( m_partiallyExpanded.begin().key() );
169  }
170  //Notify the underlying models that the item was selected, and eventually get back the text for the expanding widget.
171  if( !idx.isValid() ) {
172  //All items have been unselected
173  if( oldIndex.isValid() )
174  emit dataChanged(oldIndex, oldIndex);
175  } else {
176  QVariant variant = data(idx, CodeCompletionModel::ItemSelected);
177 
178  if( !isExpanded(idx) && variant.type() == QVariant::String) {
179 
180  //Either expand upwards or downwards, choose in a way that
181  //the visible fields of the new selected entry are not moved.
182  if( oldIndex.isValid() && (oldIndex < idx || (!(oldIndex < idx) && oldIndex.parent() < idx.parent()) ) )
183  m_partiallyExpanded.insert(idx, ExpandUpwards);
184  else
185  m_partiallyExpanded.insert(idx, ExpandDownwards);
186 
187  //Say that one row above until one row below has changed, so no items will need to be moved(the space that is taken from one item is given to the other)
188  if( oldIndex.isValid() && oldIndex < idx ) {
189  emit dataChanged(oldIndex, idx);
190 
191  if( treeView()->verticalScrollMode() == QAbstractItemView::ScrollPerItem )
192  {
193  //Qt fails to correctly scroll in ScrollPerItem mode, so the selected index is completely visible,
194  //so we do the scrolling by hand.
195  QRect selectedRect = treeView()->visualRect(idx);
196  QRect frameRect = treeView()->frameRect();
197 
198  if( selectedRect.bottom() > frameRect.bottom() ) {
199  int diff = selectedRect.bottom() - frameRect.bottom();
200  //We need to scroll down
201  QModelIndex newTopIndex = idx;
202 
203  QModelIndex nextTopIndex = idx;
204  QRect nextRect = treeView()->visualRect(nextTopIndex);
205  while( nextTopIndex.isValid() && nextRect.isValid() && nextRect.top() >= diff ) {
206  newTopIndex = nextTopIndex;
207  nextTopIndex = treeView()->indexAbove(nextTopIndex);
208  if( nextTopIndex.isValid() )
209  nextRect = treeView()->visualRect(nextTopIndex);
210  }
211  treeView()->scrollTo( newTopIndex, QAbstractItemView::PositionAtTop );
212  }
213  }
214 
215  //This is needed to keep the item we are expanding completely visible. Qt does not scroll the view to keep the item visible.
216  //But we must make sure that it isn't too expensive.
217  //We need to make sure that scrolling is efficient, and the whole content is not repainted.
218  //Since we are scrolling anyway, we can keep the next line visible, which might be a cool feature.
219 
220  //Since this also doesn't work smoothly, leave it for now
221  //treeView()->scrollTo( nextLine, QAbstractItemView::EnsureVisible );
222  } else if( oldIndex.isValid() && idx < oldIndex ) {
223  emit dataChanged(idx, oldIndex);
224 
225  //For consistency with the down-scrolling, we keep one additional line visible above the current visible.
226 
227  //Since this also doesn't work smoothly, leave it for now
228 /* QModelIndex prevLine = idx.sibling(idx.row()-1, idx.column());
229  if( prevLine.isValid() )
230  treeView()->scrollTo( prevLine );*/
231  } else
232  emit dataChanged(idx, idx);
233  } else if( oldIndex.isValid() ) {
234  //We are not partially expanding a new row, but we previously had a partially expanded row. So signalize that it has been unexpanded.
235 
236  emit dataChanged(oldIndex, oldIndex);
237  }
238  }
239  }else{
240  kDebug( 13035 ) << "ExpandingWidgetModel::rowSelected: Row is already partially expanded";
241  }
242 }
243 
244 QString ExpandingWidgetModel::partialExpandText(const QModelIndex& idx) const {
245  if( !idx.isValid() )
246  return QString();
247 
248  return data(firstColumn(idx), CodeCompletionModel::ItemSelected).toString();
249 }
250 
251 QRect ExpandingWidgetModel::partialExpandRect(const QModelIndex& idx_) const
252 {
253  QModelIndex idx(firstColumn(idx_));
254 
255  if( !idx.isValid() )
256  return QRect();
257 
258  ExpansionType expansion = ExpandDownwards;
259 
260  if( m_partiallyExpanded.find(idx) != m_partiallyExpanded.constEnd() )
261  expansion = m_partiallyExpanded[idx];
262 
263  //Get the whole rectangle of the row:
264  QModelIndex rightMostIndex = idx;
265  QModelIndex tempIndex = idx;
266  while( (tempIndex = rightMostIndex.sibling(rightMostIndex.row(), rightMostIndex.column()+1)).isValid() )
267  rightMostIndex = tempIndex;
268 
269  QRect rect = treeView()->visualRect(idx);
270  QRect rightMostRect = treeView()->visualRect(rightMostIndex);
271 
272  rect.setLeft( rect.left() + 20 );
273  rect.setRight( rightMostRect.right() - 5 );
274 
275  //These offsets must match exactly those used in ExpandingDelegate::sizeHint()
276  int top = rect.top() + 5;
277  int bottom = rightMostRect.bottom() - 5 ;
278 
279  if( expansion == ExpandDownwards )
280  top += basicRowHeight(idx);
281  else
282  bottom -= basicRowHeight(idx);
283 
284  rect.setTop( top );
285  rect.setBottom( bottom );
286 
287  return rect;
288 }
289 
290 bool ExpandingWidgetModel::isExpandable(const QModelIndex& idx_) const
291 {
292  QModelIndex idx(firstColumn(idx_));
293 
294  if( !m_expandState.contains(idx) )
295  {
296  m_expandState.insert(idx, NotExpandable);
297  QVariant v = data(idx, CodeCompletionModel::IsExpandable);
298  if( v.canConvert<bool>() && v.value<bool>() )
299  m_expandState[idx] = Expandable;
300  }
301 
302  return m_expandState[idx] != NotExpandable;
303 }
304 
305 bool ExpandingWidgetModel::isExpanded(const QModelIndex& idx_) const
306 {
307  QModelIndex idx(firstColumn(idx_));
308  return m_expandState.contains(idx) && m_expandState[idx] == Expanded;
309 }
310 
311 void ExpandingWidgetModel::setExpanded(QModelIndex idx_, bool expanded)
312 {
313  QModelIndex idx(firstColumn(idx_));
314 
315  //kDebug( 13035 ) << "Setting expand-state of row " << idx.row() << " to " << expanded;
316  if( !idx.isValid() )
317  return;
318 
319  if( isExpandable(idx) ) {
320  if( !expanded && m_expandingWidgets.contains(idx) && m_expandingWidgets[idx] ) {
321  m_expandingWidgets[idx]->hide();
322  }
323 
324  m_expandState[idx] = expanded ? Expanded : Expandable;
325 
326  if( expanded )
327  partiallyUnExpand(idx);
328 
329  if( expanded && !m_expandingWidgets.contains(idx) )
330  {
331  QVariant v = data(idx, CodeCompletionModel::ExpandingWidget);
332 
333  if( v.canConvert<QWidget*>() ) {
334  m_expandingWidgets[idx] = v.value<QWidget*>();
335  } else if( v.canConvert<QString>() ) {
336  //Create a html widget that shows the given string
337  KTextEdit* edit = new KTextEdit( v.value<QString>() );
338  edit->setReadOnly(true);
339  edit->resize(200, 50); //Make the widget small so it embeds nicely.
340  m_expandingWidgets[idx] = edit;
341  } else {
342  m_expandingWidgets[idx] = 0;
343  }
344  }
345 
346  //Eventually partially expand the row
347  if( !expanded && firstColumn(treeView()->currentIndex()) == idx && !isPartiallyExpanded(idx) )
348  rowSelected(idx); //Partially expand the row.
349 
350  emit dataChanged(idx, idx);
351 
352  if(treeView())
353  treeView()->scrollTo(idx);
354  }
355 }
356 
357 int ExpandingWidgetModel::basicRowHeight( const QModelIndex& idx_ ) const
358 {
359  QModelIndex idx(firstColumn(idx_));
360 
361  ExpandingDelegate* delegate = dynamic_cast<ExpandingDelegate*>( treeView()->itemDelegate(idx) );
362  if( !delegate || !idx.isValid() ) {
363  kDebug( 13035 ) << "ExpandingWidgetModel::basicRowHeight: Could not get delegate";
364  return 15;
365  }
366  return delegate->basicSizeHint( idx ).height();
367 }
368 
369 
370 void ExpandingWidgetModel::placeExpandingWidget(const QModelIndex& idx_)
371 {
372  QModelIndex idx(firstColumn(idx_));
373 
374  QWidget* w = 0;
375  if( m_expandingWidgets.contains(idx) )
376  w = m_expandingWidgets[idx];
377 
378  if( w && isExpanded(idx) ) {
379  if( !idx.isValid() )
380  return;
381 
382  QRect rect = treeView()->visualRect(idx);
383 
384  if( !rect.isValid() || rect.bottom() < 0 || rect.top() >= treeView()->height() ) {
385  //The item is currently not visible
386  w->hide();
387  return;
388  }
389 
390  QModelIndex rightMostIndex = idx;
391  QModelIndex tempIndex = idx;
392  while( (tempIndex = rightMostIndex.sibling(rightMostIndex.row(), rightMostIndex.column()+1)).isValid() )
393  rightMostIndex = tempIndex;
394 
395  QRect rightMostRect = treeView()->visualRect(rightMostIndex);
396 
397  //Find out the basic height of the row
398  rect.setLeft( rect.left() + 20 );
399  rect.setRight( rightMostRect.right() - 5 );
400 
401  //These offsets must match exactly those used in KateCompletionDeleage::sizeHint()
402  rect.setTop( rect.top() + basicRowHeight(idx) + 5 );
403  rect.setHeight( w->height() );
404 
405  if( w->parent() != treeView()->viewport() || w->geometry() != rect || !w->isVisible() ) {
406  w->setParent( treeView()->viewport() );
407 
408  w->setGeometry(rect);
409  w->show();
410  }
411  }
412 }
413 
414 void ExpandingWidgetModel::placeExpandingWidgets() {
415  for( QMap<QModelIndex, QPointer<QWidget> >::const_iterator it = m_expandingWidgets.constBegin(); it != m_expandingWidgets.constEnd(); ++it ) {
416  placeExpandingWidget(it.key());
417  }
418 }
419 
420 int ExpandingWidgetModel::expandingWidgetsHeight() const
421 {
422  int sum = 0;
423  for( QMap<QModelIndex, QPointer<QWidget> >::const_iterator it = m_expandingWidgets.constBegin(); it != m_expandingWidgets.constEnd(); ++it ) {
424  if( isExpanded(it.key() ) && (*it) )
425  sum += (*it)->height();
426  }
427  return sum;
428 }
429 
430 
431 QWidget* ExpandingWidgetModel::expandingWidget(const QModelIndex& idx_) const
432 {
433  QModelIndex idx(firstColumn(idx_));
434 
435  if( m_expandingWidgets.contains(idx) )
436  return m_expandingWidgets[idx];
437  else
438  return 0;
439 }
440 
441 void ExpandingWidgetModel::cacheIcons() const {
442  if( m_expandedIcon.isNull() )
443  m_expandedIcon = KIconLoader::global()->loadIcon("arrow-down", KIconLoader::Small, 10);
444 
445  if( m_collapsedIcon.isNull() )
446  m_collapsedIcon = KIconLoader::global()->loadIcon("arrow-right", KIconLoader::Small, 10);
447 }
448 
449 QList<QVariant> mergeCustomHighlighting( int leftSize, const QList<QVariant>& left, int rightSize, const QList<QVariant>& right )
450 {
451  QList<QVariant> ret = left;
452  if( left.isEmpty() ) {
453  ret << QVariant(0);
454  ret << QVariant(leftSize);
455  ret << QTextFormat(QTextFormat::CharFormat);
456  }
457 
458  if( right.isEmpty() ) {
459  ret << QVariant(leftSize);
460  ret << QVariant(rightSize);
461  ret << QTextFormat(QTextFormat::CharFormat);
462  } else {
463  QList<QVariant>::const_iterator it = right.constBegin();
464  while( it != right.constEnd() ) {
465  {
466  QList<QVariant>::const_iterator testIt = it;
467  for(int a = 0; a < 2; a++) {
468  ++testIt;
469  if(testIt == right.constEnd()) {
470  kWarning() << "Length of input is not multiple of 3";
471  break;
472  }
473  }
474  }
475 
476  ret << QVariant( (*it).toInt() + leftSize );
477  ++it;
478  ret << QVariant( (*it).toInt() );
479  ++it;
480  ret << *it;
481  if(!(*it).value<QTextFormat>().isValid())
482  kDebug( 13035 ) << "Text-format is invalid";
483  ++it;
484  }
485  }
486  return ret;
487 }
488 
489 //It is assumed that between each two strings, one space is inserted
490 QList<QVariant> mergeCustomHighlighting( QStringList strings, QList<QVariantList> highlights, int grapBetweenStrings )
491 {
492  if(strings.isEmpty()) {
493  kWarning() << "List of strings is empty";
494  return QList<QVariant>();
495  }
496 
497  if(highlights.isEmpty()) {
498  kWarning() << "List of highlightings is empty";
499  return QList<QVariant>();
500  }
501 
502  if(strings.count() != highlights.count()) {
503  kWarning() << "Length of string-list is " << strings.count() << " while count of highlightings is " << highlights.count() << ", should be same";
504  return QList<QVariant>();
505  }
506 
507  //Merge them together
508  QString totalString = strings[0];
509  QVariantList totalHighlighting = highlights[0];
510 
511  strings.pop_front();
512  highlights.pop_front();
513 
514  while( !strings.isEmpty() ) {
515  totalHighlighting = mergeCustomHighlighting( totalString.length(), totalHighlighting, strings[0].length(), highlights[0] );
516  totalString += strings[0];
517 
518  for(int a = 0; a < grapBetweenStrings; a++)
519  totalString += ' ';
520 
521  strings.pop_front();
522  highlights.pop_front();
523 
524  }
525  //Combine the custom-highlightings
526  return totalHighlighting;
527 }
528 #include "expandingwidgetmodel.moc"
529 
QVariant::canConvert
bool canConvert(Type t) const
QModelIndex
QRect::setBottom
void setBottom(int y)
QWidget
QWidget::palette
palette
ExpandingWidgetModel::partiallyUnExpand
void partiallyUnExpand(const QModelIndex &index)
Definition: expandingwidgetmodel.cpp:146
ExpandingWidgetModel::NotExpandable
Definition: expandingwidgetmodel.h:44
QMap::erase
iterator erase(iterator pos)
ExpandingWidgetModel::rowSelected
virtual void rowSelected(const QModelIndex &row)
Notifies underlying models that the item was selected, collapses any previous partially expanded line...
Definition: expandingwidgetmodel.cpp:157
QMap::contains
bool contains(const Key &key) const
ExpandingWidgetModel::partiallyExpandedRow
QModelIndex partiallyExpandedRow() const
Returns the first row that is currently partially expanded.
Definition: expandingwidgetmodel.cpp:116
ExpandingWidgetModel::clearExpanding
void clearExpanding()
Unexpand all rows and clear all cached information about them(this includes deleting the expanding-wi...
Definition: expandingwidgetmodel.cpp:123
ExpandingWidgetModel::placeExpandingWidgets
void placeExpandingWidgets()
Place or hides all expanding-widgets to the correct positions. Should be called after the view was sc...
Definition: expandingwidgetmodel.cpp:414
QRect::right
int right() const
QAbstractTableModel::index
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
QList::length
int length() const
ExpandingWidgetModel::treeView
virtual QTreeView * treeView() const =0
QAbstractTableModel
mergeCustomHighlighting
QList< QVariant > mergeCustomHighlighting(int leftSize, const QList< QVariant > &left, int rightSize, const QList< QVariant > &right)
Definition: expandingwidgetmodel.cpp:449
QMap::constBegin
const_iterator constBegin() const
ExpandingWidgetModel::partialExpandText
QString partialExpandText(const QModelIndex &row) const
Definition: expandingwidgetmodel.cpp:244
QMap
ExpandingWidgetModel::ExpansionType
ExpansionType
Definition: expandingwidgetmodel.h:65
QPointer< QWidget >
QWidget::isVisible
bool isVisible() const
ExpandingWidgetModel::isPartiallyExpanded
ExpansionType isPartiallyExpanded(const QModelIndex &index) const
Returns whether the given index is currently partially expanded. Does not do any other checks like ca...
Definition: expandingwidgetmodel.cpp:139
QFrame::frameRect
frameRect
QVariant::value
T value() const
ExpandingWidgetModel::m_collapsedIcon
static QIcon m_collapsedIcon
Definition: expandingwidgetmodel.h:136
QAbstractScrollArea::viewport
QWidget * viewport() const
QBrush
QTreeView::visualRect
virtual QRect visualRect(const QModelIndex &index) const
QMap::clear
void clear()
expandingwidgetmodel.h
ExpandingWidgetModel::isExpandable
bool isExpandable(const QModelIndex &index) const
Definition: expandingwidgetmodel.cpp:290
QWidget::setParent
void setParent(QWidget *parent)
QList::const_iterator
ExpandingWidgetModel::Expanded
Definition: expandingwidgetmodel.h:46
QWidget::geometry
geometry
QBrush::color
const QColor & color() const
ExpandingWidgetModel::placeExpandingWidget
void placeExpandingWidget(const QModelIndex &row)
Places and shows the expanding-widget for the given row, if it should be visible and is valid...
Definition: expandingwidgetmodel.cpp:370
QRect
QModelIndex::isValid
bool isValid() const
QList::count
int count(const T &value) const
QList::pop_front
void pop_front()
ExpandingWidgetModel::data
virtual QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
Does not request data from index, this only returns local data like highlighting for expanded rows an...
Definition: expandingwidgetmodel.cpp:88
QAbstractItemModel::dataChanged
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
QRect::top
int top() const
ExpandingWidgetModel::Expandable
Definition: expandingwidgetmodel.h:45
QRect::setTop
void setTop(int y)
QRect::left
int left() const
ExpandingWidgetModel::contextMatchQuality
virtual int contextMatchQuality(const QModelIndex &index) const =0
ExpandingWidgetModel::expandingWidget
QWidget * expandingWidget(const QModelIndex &row) const
Definition: expandingwidgetmodel.cpp:431
QList::isEmpty
bool isEmpty() const
QMap::constEnd
const_iterator constEnd() const
QModelIndex::row
int row() const
QPalette::background
const QBrush & background() const
QAbstractItemView::itemDelegate
QAbstractItemDelegate * itemDelegate() const
QMap::const_iterator
ExpandingWidgetModel::matchColor
uint matchColor(const QModelIndex &index) const
Returns the match-color for the given index, or zero if match-quality could not be computed...
Definition: expandingwidgetmodel.cpp:58
QString
QList
QWidget::hide
void hide()
QColor
QModelIndex::parent
QModelIndex parent() const
QApplication::palette
QPalette palette()
QMap::begin
iterator begin()
ExpandingDelegate::basicSizeHint
QSize basicSizeHint(const QModelIndex &index) const
Definition: expandingdelegate.cpp:121
QStringList
ExpandingWidgetModel::isExpanded
bool isExpanded(const QModelIndex &row) const
Definition: expandingwidgetmodel.cpp:305
ExpandingWidgetModel::ExpandingWidgetModel
ExpandingWidgetModel(QWidget *parent)
Definition: expandingwidgetmodel.cpp:44
QTextFormat
ExpandingWidgetModel::partiallyExpandWidgetHeight
int partiallyExpandWidgetHeight() const
Amount by which the height of a row increases when it is partially expanded.
Definition: expandingwidgetmodel.cpp:153
QTreeView::scrollTo
virtual void scrollTo(const QModelIndex &index, ScrollHint hint)
QRect::isValid
bool isValid() const
ExpandingWidgetModel::clearMatchQualities
void clearMatchQualities()
Definition: expandingwidgetmodel.cpp:112
QRect::setRight
void setRight(int x)
ExpandingWidgetModel::NotExpanded
Definition: expandingwidgetmodel.h:66
ExpandingDelegate
This is a delegate that cares, together with ExpandingWidgetModel, about embedded widgets in tree-vie...
Definition: expandingdelegate.h:42
doAlternate
static QColor doAlternate(QColor color)
Definition: expandingwidgetmodel.cpp:53
ExpandingWidgetModel::setExpanded
void setExpanded(QModelIndex index, bool expanded)
Change the expand-state of the row given through index. The display will be updated.
Definition: expandingwidgetmodel.cpp:311
QIcon::isNull
bool isNull() const
QModelIndex::sibling
QModelIndex sibling(int row, int column) const
QRect::setHeight
void setHeight(int height)
ExpandingWidgetModel::~ExpandingWidgetModel
virtual ~ExpandingWidgetModel()
Definition: expandingwidgetmodel.cpp:49
QSize::height
int height() const
expandingdelegate.h
firstColumn
QModelIndex firstColumn(const QModelIndex &index)
Definition: expandingwidgetmodel.cpp:40
QRect::bottom
int bottom() const
QModelIndex::column
int column() const
QString::length
int length() const
QMap::insert
iterator insert(const Key &key, const T &value)
QWidget::show
void show()
QMap::isEmpty
bool isEmpty() const
QList::constEnd
const_iterator constEnd() const
QList::constBegin
const_iterator constBegin() const
QVariant::type
Type type() const
ExpandingWidgetModel::ExpandDownwards
Definition: expandingwidgetmodel.h:67
QObject::parent
QObject * parent() const
ExpandingWidgetModel::m_expandedIcon
static QIcon m_expandedIcon
Definition: expandingwidgetmodel.h:135
QVariant::toString
QString toString() const
QRect::setLeft
void setLeft(int x)
QTextFormat::isValid
bool isValid() const
QTreeView::indexAbove
QModelIndex indexAbove(const QModelIndex &index) const
QMap::find
iterator find(const Key &key)
ExpandingWidgetModel::expandingWidgetsHeight
int expandingWidgetsHeight() const
Returns the total height added through all open expanding-widgets.
Definition: expandingwidgetmodel.cpp:420
ExpandingWidgetModel::cacheIcons
void cacheIcons() const
Definition: expandingwidgetmodel.cpp:441
QWidget::height
height
ExpandingWidgetModel::basicRowHeight
int basicRowHeight(const QModelIndex &index) const
Definition: expandingwidgetmodel.cpp:357
QIcon
QMap::remove
int remove(const Key &key)
QVariant
ExpandingWidgetModel::partialExpandRect
QRect partialExpandRect(const QModelIndex &row) const
Returns the rectangle for the partially expanded part of the given row.
Definition: expandingwidgetmodel.cpp:251
ExpandingWidgetModel::ExpandUpwards
Definition: expandingwidgetmodel.h:68
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:57 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Kate

Skip menu "Kate"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

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