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

lokalize

  • sources
  • kde-4.14
  • kdesdk
  • lokalize
  • src
  • common
fastsizehintitemdelegate.h
Go to the documentation of this file.
1 /* ****************************************************************************
2  This file is part of Lokalize
3 
4  Copyright (C) 2007-2012 by Nick Shaforostoff <shafff@ukr.net>
5 
6  This program is free software; you can redistribute it and/or
7  modify it under the terms of the GNU General Public License as
8  published by the Free Software Foundation; either version 2 of
9  the License or (at your option) version 3 or any later version
10  accepted by the membership of KDE e.V. (or its successor approved
11  by the membership of KDE e.V.), which shall act as a proxy
12  defined in Section 14 of version 3 of the license.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program. If not, see <http://www.gnu.org/licenses/>.
21 
22 **************************************************************************** */
23 
24 
25 #ifndef FASTSIZEHINTITEMDELEGATE_H
26 #define FASTSIZEHINTITEMDELEGATE_H
27 
28 #include <QItemDelegate>
29 #include <QStaticText>
30 #include <QCache>
31 
32 #include <KColorScheme>
33 
34 QString convertToHtml(QString string, bool italics=false);
35 
42 class FastSizeHintItemDelegate: public QItemDelegate
43 {
44  Q_OBJECT
45 
46 public:
47  enum Roles
48  {
49  HtmlDisplayRole=Qt::UserRole+5
50  };
51 
52  FastSizeHintItemDelegate(QObject *parent, const QVector<bool>& slc, const QVector<bool>& rtc);
53  ~FastSizeHintItemDelegate(){}
54 
55  void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
56  QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
57 
58 public slots:
59  void reset();
60 
61 private:
62  QVector<bool> singleLineColumns;
63  QVector<bool> richTextColumns;
64 
65  struct RowColumn
66  {
67  short row:16;
68  short column:16;
69  };
70  union RowColumnUnion
71  {
72  RowColumn index;
73  int v;
74  };
75  mutable QCache<int, QStaticText> cache;
76 
77  KColorScheme activeScheme;
78 };
79 #endif // FASTSIZEHINTITEMDELEGATE_H
80 
QModelIndex
FastSizeHintItemDelegate::~FastSizeHintItemDelegate
~FastSizeHintItemDelegate()
Definition: fastsizehintitemdelegate.h:53
FastSizeHintItemDelegate::sizeHint
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: fastsizehintitemdelegate.cpp:43
convertToHtml
QString convertToHtml(QString string, bool italics=false)
Definition: fastsizehintitemdelegate.cpp:119
FastSizeHintItemDelegate::FastSizeHintItemDelegate
FastSizeHintItemDelegate(QObject *parent, const QVector< bool > &slc, const QVector< bool > &rtc)
Definition: fastsizehintitemdelegate.cpp:31
QStyleOptionViewItem
QObject
FastSizeHintItemDelegate::Roles
Roles
Definition: fastsizehintitemdelegate.h:47
QPainter
QItemDelegate
QString
FastSizeHintItemDelegate
remember to connect appropriate signals to reset slot for delegate to have actual cache ...
Definition: fastsizehintitemdelegate.h:42
QCache< int, QStaticText >
QSize
QVector< bool >
FastSizeHintItemDelegate::HtmlDisplayRole
Definition: fastsizehintitemdelegate.h:49
QObject::parent
QObject * parent() const
FastSizeHintItemDelegate::reset
void reset()
Definition: fastsizehintitemdelegate.cpp:38
FastSizeHintItemDelegate::paint
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: fastsizehintitemdelegate.cpp:60
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

lokalize

Skip menu "lokalize"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

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