• 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.h
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 #ifndef KOPETEITEMDELEGATE_H
20 #define KOPETEITEMDELEGATE_H
21 
22 #include <QStyledItemDelegate>
23 #include <QSize>
24 
25 #include "contactlistlayoutitemconfig.h"
26 
27 #include <kopete_export.h>
28 
29 class QPainter;
30 class QAbstractItemView;
31 
32 namespace Kopete { class Contact; }
33 
34 class KOPETE_CONTACT_LIST_EXPORT KopeteItemDelegate : public QStyledItemDelegate
35 {
36  Q_OBJECT
37 public:
38  KopeteItemDelegate( QAbstractItemView* parent = 0 );
39  ~KopeteItemDelegate();
40 
41  static QFont normalFont( const QFont& naturalFont );
42  static QFont smallFont( const QFont& naturalFont );
43 
44  virtual void paint ( QPainter * painter,
45  const QStyleOptionViewItem & option,
46  const QModelIndex & index ) const;
47  virtual QSize sizeHint ( const QStyleOptionViewItem & option,
48  const QModelIndex & index ) const;
49 
50  Kopete::Contact* contactAt( const QStyleOptionViewItem& option, const QModelIndex& index, const QPoint& point ) const;
51 
52 public slots:
53  bool helpEvent( QHelpEvent* event, QAbstractItemView* view, const QStyleOptionViewItem& option, const QModelIndex& index );
54 
55 private:
56  void paintItem( ContactList::LayoutItemConfig config, QPainter* painter,
57  const QStyleOptionViewItem& option, const QModelIndex& index,
58  QList<QPair<QRect, Kopete::Contact*> >* contactPositionList ) const;
59 
60  QPointF centerImage( const QImage& image, const QRectF& rect ) const;
61  QPointF centerImage( const QPixmap& pixmap, const QRectF& rect ) const;
62  qreal calculateRowHeight( const ContactList::LayoutItemConfigRow &row, const QFont &normal, const QFont &small ) const;
63  QList<Kopete::Contact*> filterContacts( const QList<Kopete::Contact*> contacts ) const;
64 
65  enum LayoutType { LayoutAuto = 0, LayoutNormal, LayoutFixed };
66  struct DynamicLayoutItem {
67  bool dirty;
68  LayoutType type;
69  qreal width;
70 
71  // Caching
72  QString text;
73  QFont font;
74  };
75 };
76 
77 #endif
78 
QModelIndex
QAbstractItemView
QFont
QPoint
ContactList::LayoutItemConfig
This class wraps the data needed to paint a LayoutItemDelegate.
Definition: contactlistlayoutitemconfig.h:73
ContactList::LayoutItemConfigRow
Definition: contactlistlayoutitemconfig.h:59
QPointF
QStyleOptionViewItem
QStyledItemDelegate::paint
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
QPainter
KopeteItemDelegate
Definition: kopeteitemdelegate.h:34
QStyledItemDelegate::sizeHint
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
QString
QList
QPair
QPixmap
contactlistlayoutitemconfig.h
QSize
QImage
QAbstractItemDelegate::helpEvent
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index)
QRectF
QHelpEvent
QStyledItemDelegate
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