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

kopete/kopete

  • sources
  • kde-4.14
  • kdenetwork
  • kopete
  • kopete
  • contactlist
kopeteitemdelegate.cpp
Go to the documentation of this file.
1 /*
2  Kopete View Item Delegate
3 
4  Copyright (c) 2007 by Matt Rogers <mattr@kde.org>
5  Copyright (c) 2009 by Roman Jarosz <kedgedev@gmail.com>
6 
7  Kopete (c) 2002-2009 by the Kopete developers <kopete-devel@kde.org>
8 
9  *************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  *************************************************************************
17 */
18 
19 #include "kopeteitemdelegate.h"
20 #include "kopeteitembase.h"
21 
22 #include <QPainter>
23 #include <QStyleOptionViewItem>
24 #include <QModelIndex>
25 #include <QAbstractItemView>
26 #include <QApplication>
27 #include <QVector>
28 #include <QHelpEvent>
29 #include <QToolTip>
30 
31 #include <qimageblitz.h>
32 
33 #include <KIconLoader>
34 
35 #include "kopetemetacontact.h"
36 #include "kopetecontact.h"
37 #include "kopeteappearancesettings.h"
38 #include "contactlistlayoutmanager.h"
39 #include "contactlistproxymodel.h"
40 
41 const qreal MARGIN = 2.0;
42 const qreal MARGINH = 4.0;
43 const qreal PADDING = 1.0;
44 
45 KopeteItemDelegate::KopeteItemDelegate( QAbstractItemView* parent )
46 : QStyledItemDelegate( parent )
47 {
48 }
49 
50 KopeteItemDelegate::~KopeteItemDelegate()
51 {
52 }
53 
54 QFont KopeteItemDelegate::normalFont( const QFont& naturalFont )
55 {
56  if ( Kopete::AppearanceSettings::self()->contactListUseCustomFont() )
57  return Kopete::AppearanceSettings::self()->contactListNormalFont();
58  else
59  return naturalFont;
60 }
61 
62 QFont KopeteItemDelegate::smallFont( const QFont& naturalFont )
63 {
64  if ( Kopete::AppearanceSettings::self()->contactListUseCustomFont() )
65  return Kopete::AppearanceSettings::self()->contactListSmallFont();
66 
67  QFont font( naturalFont );
68  if ( font.pixelSize() != -1 )
69  font.setPixelSize( (font.pixelSize() * 3) / 4 );
70  else
71  font.setPointSizeF( font.pointSizeF() * 0.75 );
72  return font;
73 }
74 
75 QSize KopeteItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
76 {
77  if ( index.data( Kopete::Items::TypeRole ) == Kopete::Items::MetaContact )
78  {
79  QFont normal = normalFont( option.font );
80  QFont small = smallFont( option.font );
81 
82  qreal height = 0;
83 
84  ContactList::ContactListLayout layout = ContactList::LayoutManager::instance()->activeLayout();
85  int rowCount = layout.layout().rows();
86  for ( int i = 0; i < rowCount; i++ )
87  height += calculateRowHeight( layout.layout().row( i ), normal, small );
88 
89  height += MARGIN * 2 + ( rowCount - 1 ) * PADDING;
90  return QSize( 120, height );
91 
92  }
93  else
94  return QStyledItemDelegate::sizeHint( option, index );
95 }
96 
97 Kopete::Contact* KopeteItemDelegate::contactAt( const QStyleOptionViewItem& option, const QModelIndex& index, const QPoint& point ) const
98 {
99  if ( index.data( Kopete::Items::TypeRole ) == Kopete::Items::MetaContact )
100  {
101  ContactList::ContactListLayout layout = ContactList::LayoutManager::instance()->activeLayout();
102  QList< QPair<QRect, Kopete::Contact*> > contactPositionList;
103  paintItem( layout.layout(), 0, option, index, &contactPositionList );
104 
105  QPoint delegatePoint = point - option.rect.topLeft();
106  for ( int i = 0; i < contactPositionList.size(); ++i )
107  {
108  if ( contactPositionList.at(i).first.contains( delegatePoint ) )
109  return contactPositionList.at(i).second;
110  }
111  }
112  return 0;
113 }
114 
115 bool KopeteItemDelegate::helpEvent( QHelpEvent* event, QAbstractItemView* view, const QStyleOptionViewItem& option, const QModelIndex& index )
116 {
117  if ( !event || !view )
118  return false;
119 
120  if ( event->type() == QEvent::ToolTip )
121  {
122  Kopete::Contact* contact = contactAt( option, index, event->pos() );
123  if ( contact )
124  {
125  QToolTip::showText( event->globalPos(), contact->toolTip(), view );
126  return true;
127  }
128 
129  QVariant tooltip = index.data( Qt::ToolTipRole );
130  if ( qVariantCanConvert<QString>(tooltip) )
131  {
132  QToolTip::showText( event->globalPos(), tooltip.toString(), view );
133  return true;
134  }
135  return false;
136  }
137 
138  return QStyledItemDelegate::helpEvent(event, view, option, index);
139 }
140 
141 void KopeteItemDelegate::paint( QPainter* painter,
142  const QStyleOptionViewItem& option,
143  const QModelIndex& index ) const
144 {
145  //pull in contact settings: idleContactColor, greyIdleMetaContacts
146  //pull in contact list settings: contactListDisplayMode
147  QStyleOptionViewItem opt = option;
148 
149  if ( index.data( Kopete::Items::TypeRole ) == Kopete::Items::MetaContact )
150  {
151  ContactList::ContactListLayout layout = ContactList::LayoutManager::instance()->activeLayout();
152 
153  painter->save();
154 
155  // Draw background
156  QApplication::style()->drawPrimitive( QStyle::PE_PanelItemViewItem, &option, painter );
157 
158  painter->translate( option.rect.topLeft() );
159 
160  QPalette::ColorGroup cg = QPalette::Active;
161  if (!(option.state & QStyle::State_Enabled))
162  cg = QPalette::Disabled;
163  else if (!(option.state & QStyle::State_Active))
164  cg = QPalette::Inactive;
165 
166  if ( Kopete::AppearanceSettings::self()->greyIdleMetaContacts() && index.data( Kopete::Items::IdleTimeRole ).toInt() > 0 )
167  painter->setPen( Kopete::AppearanceSettings::self()->idleContactColor() ); //apply the appropriate idle color
168  else if ( option.state & QStyle::State_Selected )
169  painter->setPen( option.palette.color( cg, QPalette::HighlightedText ) );
170  else
171  painter->setPen( option.palette.color( cg, QPalette::Text ) );
172 
173  paintItem( layout.layout(), painter, option, index, 0 );
174 
175  painter->restore();
176  }
177  else if ( index.data( Kopete::Items::TypeRole ) == Kopete::Items::Group )
178  {
179  QColor gc( Kopete::AppearanceSettings::self()->groupNameColor() );
180  opt.palette.setColor( QPalette::Text, gc );
181  QStyledItemDelegate::paint( painter, opt, index );
182  }
183  else
184  {
185  QStyledItemDelegate::paint( painter, opt, index );
186  }
187 }
188 
189 QList<Kopete::Contact*> KopeteItemDelegate::filterContacts( const QList<Kopete::Contact*> contacts ) const
190 {
191  if ( Kopete::AppearanceSettings::self()->showOfflineUsers() ||
192  Kopete::AppearanceSettings::self()->showOfflineGrouped() )
193  return contacts;
194 
195  QAbstractItemView* itemView = qobject_cast<QAbstractItemView*>(parent());
196  if ( itemView )
197  {
198  QSortFilterProxyModel* proxyModel = qobject_cast<QSortFilterProxyModel*>(itemView->model());
199  if ( proxyModel && !proxyModel->filterRegExp().isEmpty() )
200  return contacts;
201  }
202 
203  QList<Kopete::Contact*> filtered;
204 
205  foreach( Kopete::Contact *contact, contacts )
206  {
207  if ( contact->isOnline() )
208  filtered << contact;
209  }
210 
211  return filtered;
212 }
213 
214 void KopeteItemDelegate::paintItem( ContactList::LayoutItemConfig config, QPainter* painter,
215  const QStyleOptionViewItem& option, const QModelIndex& index,
216  QList<QPair<QRect, Kopete::Contact*> >* contactPositionList ) const
217 {
218  int rowCount = config.rows();
219  if ( rowCount == 0 )
220  return;
221 
222  const int hBorderMargin = MARGIN * 2;
223  //const int hMargins = hBorderMargin + ( rowCount - 1 ) * PADDING;
224 
225  int rowOffsetX = MARGIN;
226  int rowOffsetY = MARGIN;
227 
228  if ( config.showIcon() )
229  {
230  int imageSize = option.rect.height() - hBorderMargin;
231 
232  if ( painter )
233  {
234  QRectF nominalImageRect( rowOffsetX, rowOffsetY, imageSize, imageSize );
235 
236  QVariant metaContactPicture;
237  if ( index.data( Kopete::Items::HasNewMessageRole ).toBool() )
238  metaContactPicture = QString::fromUtf8( "mail-unread" );
239  else
240  metaContactPicture = index.data( Kopete::Items::MetaContactImageRole );
241 
242  if ( metaContactPicture.type() == QVariant::Image )
243  {
244  // We have contact photo
245  QImage metaContactImage = metaContactPicture.value<QImage>();
246  if ( !metaContactImage.isNull() )
247  {
248  metaContactImage = metaContactImage.scaled( imageSize, imageSize, Qt::KeepAspectRatio, Qt::SmoothTransformation );
249 
250  int metaContactStatus = index.data( Kopete::Items::OnlineStatusRole ).toInt();
251  if ( metaContactStatus == Kopete::OnlineStatus::Offline )
252  Blitz::grayscale( metaContactImage );
253 
254  switch ( metaContactStatus )
255  {
256  case Kopete::OnlineStatus::Online:
257  break;
258  case Kopete::OnlineStatus::Away:
259  case Kopete::OnlineStatus::Busy:
260  Blitz::fade( metaContactImage, 0.5, Qt::white );
261  break;
262  case Kopete::OnlineStatus::Offline:
263  Blitz::fade( metaContactImage, 0.4, Qt::white );
264  break;
265  case Kopete::OnlineStatus::Unknown:
266  default:
267  Blitz::fade( metaContactImage, 0.8, Qt::white );
268  }
269 
270  QPixmap photoPixmap;
271  bool roundedIcons = Kopete::AppearanceSettings::self()->contactListIconRounded();
272  if ( roundedIcons )
273  {
274  photoPixmap = QPixmap( metaContactImage.width(), metaContactImage.height() );
275  photoPixmap.fill( Qt::transparent );
276  QPainter p( &photoPixmap );
277  p.setRenderHint( QPainter::Antialiasing );
278  p.setPen( Qt::NoPen );
279  p.setBrush( QBrush( metaContactImage ) );
280  QRectF rectangle( 0.5, 0.5, photoPixmap.width()-1, photoPixmap.height()-1 );
281  p.drawRoundedRect( rectangle, 25, 25, Qt::RelativeSize );
282  }
283  else
284  {
285  photoPixmap = QPixmap::fromImage( metaContactImage );
286  }
287 
288  if ( Kopete::AppearanceSettings::self()->contactListIconBorders() )
289  {
290  QPainter p( &photoPixmap );
291  p.setPen( Qt::black );
292 
293  if ( roundedIcons )
294  {
295  p.setRenderHint( QPainter::Antialiasing );
296  QRectF rectangle( 0.5, 0.5, photoPixmap.width()-1, photoPixmap.height()-1 );
297  p.drawRoundedRect( rectangle, 25, 25, Qt::RelativeSize );
298  }
299  else
300  {
301  p.drawRect( 0, 0, photoPixmap.width()-1, photoPixmap.height()-1 );
302  }
303  }
304  //offset cover if non square
305  QPointF offset = centerImage( photoPixmap, nominalImageRect );
306  QRectF imageRect( nominalImageRect.x() + offset.x(),
307  nominalImageRect.y() + offset.y(),
308  nominalImageRect.width() - offset.x() * 2,
309  nominalImageRect.height() - offset.y() * 2 );
310 
311  painter->drawPixmap( imageRect.topLeft(), photoPixmap );
312  }
313  }
314  else
315  {
316  // We have icon
317  QString metaContactImageName = metaContactPicture.value<QString>();
318  QPixmap metaContactImage = SmallIcon( metaContactImageName, imageSize );
319  if ( !metaContactImage.isNull() )
320  {
321  //offset cover if non square
322  QPointF offset = centerImage( metaContactImage, nominalImageRect );
323  QRectF imageRect( nominalImageRect.x() + offset.x(),
324  nominalImageRect.y() + offset.y(),
325  nominalImageRect.width() - offset.x() * 2,
326  nominalImageRect.height() - offset.y() * 2 );
327 
328  painter->drawPixmap( imageRect.topLeft(), metaContactImage );
329  }
330  }
331  }
332 
333  rowOffsetX += imageSize + MARGINH;
334  }
335 
336  QFont normal = normalFont( option.font );
337  QFont small = smallFont( option.font );
338 
339  QObject* metaContactObject = qVariantValue<QObject*>( index.data( Kopete::Items::ObjectRole ) );
340  Kopete::MetaContact* metaContact = qobject_cast<Kopete::MetaContact*>(metaContactObject);
341  QList<Kopete::Contact*> contactList = filterContacts( metaContact->contacts() );
342 
343  for ( int i = 0; i < rowCount; i++ )
344  {
345  ContactList::LayoutItemConfigRow row = config.row( i );
346  const int rowHeight = calculateRowHeight( row, normal, small );
347  qreal itemOffsetX = rowOffsetX;
348  const int elementCount = row.count();
349  qreal rowWidth = option.rect.width() - ( rowOffsetX + MARGIN );
350 
351  QRectF rowBox( itemOffsetX, rowOffsetY, rowWidth, rowHeight );
352  int currentItemX = itemOffsetX;
353 
354  const qreal IconMarginH = 2.0;
355  const qreal IconMarginV = 1.0;
356  const qreal IconSize = rowHeight - 2 * IconMarginV;
357 
358  QVector<DynamicLayoutItem> dynamicLayoutData( elementCount );
359  bool hasFixedTypeItem = false;
360 
361  // Figure out width of items
362  for ( int j = 0; j < elementCount; ++j )
363  {
364  ContactList::LayoutItemConfigRowElement element = row.element( j );
365  const int value = element.value();
366  DynamicLayoutItem& dlItem = dynamicLayoutData[j];
367 
368  dlItem.dirty = true;
369  if ( value != ContactList::LayoutManager::ContactIcons && value != ContactList::LayoutManager::PlaceHolder )
370  {
371  dlItem.font = QFont( ( element.small() ) ? small : normal );
372  dlItem.font.setBold( element.bold() );
373  dlItem.font.setItalic( element.italic() );
374 
375  const int role = ContactList::LayoutManager::instance()->token( value ).mModelRole;
376  QString text = ( role > -1 ) ? index.data( role ).toString() : QString();
377  dlItem.text = element.prefix() + text + element.suffix();
378  }
379 
380  if ( element.optimalSize() )
381  {
382  qreal idealWidth = 0;
383  if ( value == ContactList::LayoutManager::ContactIcons )
384  {
385  const int contactListSize = contactList.size();
386  idealWidth = contactListSize * IconSize;
387  if ( contactListSize > 1 )
388  idealWidth += (contactListSize - 1) * IconMarginH;
389 
390  hasFixedTypeItem = true;
391  dlItem.type = LayoutFixed;
392  }
393  else if ( value == ContactList::LayoutManager::PlaceHolder )
394  {
395  dlItem.type = LayoutNormal;
396  }
397  else
398  {
399  QFontMetricsF fm( dlItem.font );
400  idealWidth = fm.width( dlItem.text );
401  dlItem.type = LayoutNormal;
402  }
403 
404  if ( element.size() >= 0.001 )
405  {
406  const qreal maxWidth = rowWidth * element.size();
407  if ( maxWidth < idealWidth)
408  idealWidth = maxWidth;
409  }
410  dlItem.width = idealWidth;
411  }
412  else
413  {
414  if ( element.size() >= 0.001 )
415  {
416  dlItem.type = LayoutNormal;
417  dlItem.width = rowWidth * element.size();
418  }
419  else
420  {
421  dlItem.type = LayoutAuto;
422  dlItem.width = 0;
423  }
424  }
425  }
426 
427  // Check width of fixed items
428  qreal availableWidth = rowWidth;
429  if ( hasFixedTypeItem )
430  {
431  for ( int j = 0; j < elementCount; ++j )
432  {
433  DynamicLayoutItem& dlItem = dynamicLayoutData[j];
434  if ( dlItem.type == LayoutFixed )
435  {
436  availableWidth -= dlItem.width;
437  dlItem.dirty = false;
438  if ( availableWidth < 0 )
439  {
440  dlItem.width += availableWidth;
441  availableWidth = 0;
442  break;
443  }
444  }
445  }
446  }
447 
448  // Check width of normal items and count auto items
449  int layoutAutoItemCount = 0;
450  if ( availableWidth > 0 )
451  {
452  for ( int j = 0; j < elementCount; ++j )
453  {
454  DynamicLayoutItem& dlItem = dynamicLayoutData[j];
455  if ( dlItem.type == LayoutAuto )
456  {
457  layoutAutoItemCount++;
458  }
459  else if ( dlItem.dirty )
460  {
461  dlItem.dirty = false;
462  availableWidth -= dlItem.width;
463  if ( availableWidth < 0 )
464  {
465  dlItem.width += availableWidth;
466  availableWidth = 0;
467  break;
468  }
469  }
470  }
471  }
472 
473  const qreal layoutAutoItemWidth = ( layoutAutoItemCount > 0 ) ? (availableWidth / (qreal)layoutAutoItemCount) : 0;
474  for ( int j = 0; j < elementCount; ++j )
475  {
476  // Set auto items width
477  DynamicLayoutItem& dlItem = dynamicLayoutData[j];
478  if ( dlItem.dirty )
479  {
480  if ( availableWidth > 0 )
481  dlItem.width = layoutAutoItemWidth;
482  else
483  dlItem.width = 0;
484  }
485 
486  qreal itemWidth = dlItem.width;
487  if ( itemWidth > 0 )
488  {
489  ContactList::LayoutItemConfigRowElement element = row.element( j );
490 
491  const int value = element.value();
492  //const int role = ContactList::LayoutManager::instance()->token( value ).mModelRole;
493  const int alignment = element.alignment();
494 
495  if ( painter )
496  painter->setFont( dlItem.font );
497 
498  //special case for painting the ContactIcons...
499  if ( value == ContactList::LayoutManager::ContactIcons )
500  {
501  if ( contactList.size() > 0 )
502  {
503  const qreal IconMarginH = 2.0;
504  const qreal IconMarginV = 1.0;
505  const qreal IconSize = rowHeight - 2 * IconMarginV;
506  qreal iconsWidth = contactList.size() * IconSize;
507  if ( contactList.size() > 1 )
508  iconsWidth += (contactList.size() - 1) * IconMarginH;
509 
510  if (iconsWidth > itemWidth)
511  iconsWidth = itemWidth;
512 
513  QRectF drawingRect( currentItemX, rowOffsetY + IconMarginV, iconsWidth, IconSize );
514  if ( (alignment & Qt::AlignRight) == Qt::AlignRight )
515  drawingRect.moveRight( currentItemX + itemWidth );
516  else if ( (alignment & Qt::AlignHCenter) == Qt::AlignHCenter )
517  drawingRect.moveLeft( currentItemX + (itemWidth - iconsWidth) / 2.0 );
518 
519  double offsetX = 0;
520  foreach ( Kopete::Contact *contact, contactList )
521  {
522  QIcon contactIcon = contact->onlineStatus().iconFor( contact );
523  if ( contactIcon.isNull() )
524  continue;
525 
526  QRectF pixmapRect( drawingRect.x() + offsetX, drawingRect.y(),
527  IconSize, IconSize );
528 
529  if ( contactPositionList )
530  contactPositionList->append( QPair<QRect, Kopete::Contact*>( pixmapRect.toRect(), contact ) );
531 
532  if ( painter )
533  {
534  QPixmap contactPixmap = contactIcon.pixmap( IconSize, IconSize );
535  painter->setClipRect( pixmapRect.intersected( drawingRect ) );
536  painter->drawPixmap( pixmapRect.topLeft(), contactPixmap );
537  }
538 
539  offsetX += IconSize + IconMarginH;
540  }
541  }
542  }
543  else if ( value == ContactList::LayoutManager::PlaceHolder )
544  {
545  // Do nothing
546  }
547  else
548  {
549  if ( painter )
550  {
551  QString text = QFontMetricsF( dlItem.font ).elidedText( dlItem.text, Qt::ElideRight, itemWidth );
552  QRectF drawRect( currentItemX, rowOffsetY, itemWidth, rowHeight );
553  painter->setClipRect( drawRect );
554  painter->drawText( drawRect, alignment, text );
555  }
556  }
557 
558  currentItemX += itemWidth;
559  }
560  }
561  rowOffsetY += rowHeight + PADDING;
562  }
563 }
564 
565 QPointF KopeteItemDelegate::centerImage( const QImage& image, const QRectF& rect ) const
566 {
567  qreal imageRatio = ( qreal )image.width() / ( qreal )image.height();
568 
569  qreal moveByX = 0.0;
570  qreal moveByY = 0.0;
571 
572  if ( imageRatio >= 1 )
573  moveByY = ( rect.height() - ( rect.width() / imageRatio ) ) / 2.0;
574  else
575  moveByX = ( rect.width() - ( rect.height() * imageRatio ) ) / 2.0;
576 
577  return QPointF( moveByX, moveByY );
578 }
579 
580 QPointF KopeteItemDelegate::centerImage( const QPixmap& pixmap, const QRectF& rect ) const
581 {
582  qreal pixmapRatio = ( qreal )pixmap.width() / ( qreal )pixmap.height();
583 
584  qreal moveByX = 0.0;
585  qreal moveByY = 0.0;
586 
587  if ( pixmapRatio >= 1 )
588  moveByY = ( rect.height() - ( rect.width() / pixmapRatio ) ) / 2.0;
589  else
590  moveByX = ( rect.width() - ( rect.height() * pixmapRatio ) ) / 2.0;
591 
592  return QPointF( moveByX, moveByY );
593 }
594 
595 qreal KopeteItemDelegate::calculateRowHeight( const ContactList::LayoutItemConfigRow &row, const QFont &normal, const QFont &small ) const
596 {
597  qreal rowHeight = 0;
598 
599  const int elementCount = row.count();
600  for ( int i = 0; i < elementCount; ++i )
601  {
602  ContactList::LayoutItemConfigRowElement element = row.element( i );
603  QFont elementFont( ( element.small() ) ? small : normal );
604  elementFont.setItalic( element.italic() );
605  elementFont.setBold( element.bold() );
606  rowHeight = qMax( rowHeight, QFontMetricsF( elementFont ).height() );
607  }
608  return rowHeight;
609 }
610 
611 #include "kopeteitemdelegate.moc"
ContactList::LayoutItemConfigRowElement::suffix
QString suffix() const
Definition: contactlistlayoutitemconfig.h:44
QModelIndex
ContactList::LayoutItemConfigRowElement::alignment
Qt::Alignment alignment() const
Definition: contactlistlayoutitemconfig.h:42
MARGINH
const qreal MARGINH
Definition: kopeteitemdelegate.cpp:42
QEvent::type
Type type() const
ContactList::LayoutItemConfig::row
LayoutItemConfigRow row(int at) const
Definition: contactlistlayoutitemconfig.cpp:74
contactlistproxymodel.h
PADDING
const qreal PADDING
Definition: kopeteitemdelegate.cpp:43
QPixmap::width
int width() const
QFont::pixelSize
int pixelSize() const
QAbstractItemView
KopeteItemDelegate::normalFont
static QFont normalFont(const QFont &naturalFont)
Definition: kopeteitemdelegate.cpp:54
ContactList::LayoutItemConfigRowElement::small
bool small() const
Definition: contactlistlayoutitemconfig.h:45
QPixmap::fill
void fill(const QColor &color)
kopeteitembase.h
Contains definitions common between model items.
contactlistlayoutmanager.h
ContactList::LayoutItemConfigRowElement::optimalSize
bool optimalSize() const
Definition: contactlistlayoutitemconfig.h:46
QFont::pointSizeF
qreal pointSizeF() const
ContactList::LayoutItemConfigRowElement::size
qreal size() const
Definition: contactlistlayoutitemconfig.h:39
QFont
ContactList::LayoutItemConfigRowElement::prefix
QString prefix() const
Definition: contactlistlayoutitemconfig.h:43
QList::at
const T & at(int i) const
QString::size
int size() const
QPainter::save
void save()
QHelpEvent::pos
const QPoint & pos() const
QVariant::value
T value() const
QPixmap::fromImage
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
ContactList::LayoutItemConfig::rows
int rows() const
Definition: contactlistlayoutitemconfig.cpp:68
QBrush
KopeteItemDelegate::sizeHint
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: kopeteitemdelegate.cpp:75
Kopete::Items::OnlineStatusRole
const int OnlineStatusRole
Definition: kopeteitembase.h:36
QPoint
Kopete::Items::IdleTimeRole
const int IdleTimeRole
Definition: kopeteitembase.h:37
QImage::isNull
bool isNull() const
QtConcurrent::filtered
QFuture< T > filtered(const Sequence &sequence, FilterFunction filterFunction)
QToolTip::showText
void showText(const QPoint &pos, const QString &text, QWidget *w)
QIcon::pixmap
QPixmap pixmap(const QSize &size, Mode mode, State state) const
QList::size
int size() const
ContactList::LayoutItemConfig
This class wraps the data needed to paint a LayoutItemDelegate.
Definition: contactlistlayoutitemconfig.h:73
ContactList::LayoutItemConfigRow
Definition: contactlistlayoutitemconfig.h:59
QPointF
KopeteItemDelegate::paint
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: kopeteitemdelegate.cpp:141
ContactList::ContactListLayout
Definition: contactlistlayoutitemconfig.h:92
Kopete::Items::MetaContact
Definition: kopeteitembase.h:57
QFont::setPixelSize
void setPixelSize(int pixelSize)
QPainter::setFont
void setFont(const QFont &font)
ContactList::LayoutItemConfig::showIcon
bool showIcon() const
Definition: contactlistlayoutitemconfig.cpp:84
QFontMetricsF::elidedText
QString elidedText(const QString &text, Qt::TextElideMode mode, qreal width, int flags) const
QPointF::x
qreal x() const
QPointF::y
qreal y() const
QString::fromUtf8
QString fromUtf8(const char *str, int size)
Kopete::Items::Group
Definition: kopeteitembase.h:57
QVariant::toInt
int toInt(bool *ok) const
QStyleOptionViewItem
KopeteItemDelegate::helpEvent
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index)
Definition: kopeteitemdelegate.cpp:115
ContactList::LayoutManager::instance
static LayoutManager * instance()
Definition: contactlistlayoutmanager.cpp:47
QObject
QPainter::setPen
void setPen(const QColor &color)
QHelpEvent::globalPos
const QPoint & globalPos() const
QImage::width
int width() const
QStyledItemDelegate::paint
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
QPainter::drawPixmap
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
QPainter
ContactList::LayoutItemConfigRow::count
int count() const
Definition: contactlistlayoutitemconfig.cpp:46
Kopete::Items::TypeRole
const int TypeRole
Qt Model Role Definitions.
Definition: kopeteitembase.h:34
QStyledItemDelegate::sizeHint
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
KopeteItemDelegate::contactAt
Kopete::Contact * contactAt(const QStyleOptionViewItem &option, const QModelIndex &index, const QPoint &point) const
Definition: kopeteitemdelegate.cpp:97
QPainter::drawText
void drawText(const QPointF &position, const QString &text)
QString
QList
QColor
ContactList::LayoutManager::PlaceHolder
Definition: contactlistlayoutmanager.h:73
QPair
QPixmap
KopeteItemDelegate::~KopeteItemDelegate
~KopeteItemDelegate()
Definition: kopeteitemdelegate.cpp:50
QSize
QSortFilterProxyModel
QPixmap::height
int height() const
QImage
QFont::setPointSizeF
void setPointSizeF(qreal pointSize)
QAbstractItemDelegate::helpEvent
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index)
QPainter::restore
void restore()
ContactList::ContactListLayout::layout
LayoutItemConfig layout() const
Definition: contactlistlayoutitemconfig.cpp:97
ContactList::LayoutItemConfigRow::element
LayoutItemConfigRowElement element(int at) const
Definition: contactlistlayoutitemconfig.cpp:51
ContactList::LayoutItemConfigRowElement::bold
bool bold() const
Definition: contactlistlayoutitemconfig.h:40
QRectF::width
qreal width() const
QPainter::setClipRect
void setClipRect(const QRectF &rectangle, Qt::ClipOperation operation)
QVector
QModelIndex::data
QVariant data(int role) const
QApplication::style
QStyle * style()
ContactList::LayoutItemConfigRowElement::italic
bool italic() const
Definition: contactlistlayoutitemconfig.h:41
ContactList::LayoutManager::activeLayout
ContactListLayout activeLayout()
Definition: contactlistlayoutmanager.cpp:99
QRectF
QIcon::isNull
bool isNull() const
Kopete::Items::HasNewMessageRole
const int HasNewMessageRole
Definition: kopeteitembase.h:52
KopeteItemDelegate::KopeteItemDelegate
KopeteItemDelegate(QAbstractItemView *parent=0)
Definition: kopeteitemdelegate.cpp:45
QVariant::toBool
bool toBool() const
QPainter::translate
void translate(const QPointF &offset)
ContactList::LayoutItemConfigRowElement
Definition: contactlistlayoutitemconfig.h:31
QStyle::drawPrimitive
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
QRectF::height
qreal height() const
QImage::height
int height() const
QAbstractItemView::model
QAbstractItemModel * model() const
QVariant::type
Type type() const
Kopete::Items::ObjectRole
const int ObjectRole
Definition: kopeteitembase.h:50
Kopete::Items::MetaContactImageRole
const int MetaContactImageRole
Definition: kopeteitembase.h:44
QObject::parent
QObject * parent() const
QHelpEvent
ContactList::ContactListTokenConfig::mModelRole
int mModelRole
Definition: contactlistlayoutmanager.h:47
ContactList::LayoutItemConfigRowElement::value
int value() const
Definition: contactlistlayoutitemconfig.h:38
QVariant::toString
QString toString() const
MARGIN
const qreal MARGIN
Definition: kopeteitemdelegate.cpp:41
ContactList::LayoutManager::token
ContactListTokenConfig token(int tokenType) const
Definition: contactlistlayoutmanager.h:81
QImage::scaled
QImage scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
KopeteItemDelegate::smallFont
static QFont smallFont(const QFont &naturalFont)
Definition: kopeteitemdelegate.cpp:62
QIcon
kopeteitemdelegate.h
QSortFilterProxyModel::filterRegExp
filterRegExp
ContactList::LayoutManager::ContactIcons
Definition: contactlistlayoutmanager.h:77
QVariant
QStyledItemDelegate
QFontMetricsF
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:29:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kopete/kopete

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

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

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