FougTools  0.7.0dev-046fb6a
Handy tools for C++, Qt and OpenCascade
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
proxy_styled_item_delegate.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** FougTools
3 ** Copyright Fougue (30 Mar. 2015)
4 ** contact@fougue.pro
5 **
6 ** This software is a computer program whose purpose is to provide utility
7 ** tools for the C++ language and the Qt toolkit.
8 **
9 ** This software is governed by the CeCILL-C license under French law and
10 ** abiding by the rules of distribution of free software. You can use,
11 ** modify and/ or redistribute the software under the terms of the CeCILL-C
12 ** license as circulated by CEA, CNRS and INRIA at the following URL
13 ** "http://www.cecill.info".
14 ****************************************************************************/
15 
16 #pragma once
17 
18 #include "gui.h"
19 
20 // QtWidgets
21 #include <QStyledItemDelegate>
22 
23 namespace qtgui {
24 
25 class QTTOOLS_GUI_EXPORT ProxyStyledItemDelegate : public QStyledItemDelegate
26 {
27 public:
28  ProxyStyledItemDelegate(QObject* parent = NULL);
29  ProxyStyledItemDelegate(QStyledItemDelegate* srcDelegate, QObject* parent = NULL);
30 
31  QStyledItemDelegate* sourceDelegate() const;
32  void setSourceDelegate(QStyledItemDelegate* srcDelegate);
33 
34  void paint(
35  QPainter *painter,
36  const QStyleOptionViewItem &option,
37  const QModelIndex &index) const Q_DECL_OVERRIDE;
38  QSize sizeHint(
39  const QStyleOptionViewItem &option,
40  const QModelIndex &index) const Q_DECL_OVERRIDE;
41  QString displayText(
42  const QVariant &value,
43  const QLocale &locale) const Q_DECL_OVERRIDE;
44 
45  QWidget *createEditor(
46  QWidget *parent,
47  const QStyleOptionViewItem &option,
48  const QModelIndex &index) const Q_DECL_OVERRIDE;
49  void setEditorData(
50  QWidget *editor, const QModelIndex &index) const Q_DECL_OVERRIDE;
51  void setModelData(
52  QWidget *editor,
53  QAbstractItemModel *model,
54  const QModelIndex &index) const Q_DECL_OVERRIDE;
55  void updateEditorGeometry(
56  QWidget *editor,
57  const QStyleOptionViewItem &option,
58  const QModelIndex &index) const Q_DECL_OVERRIDE;
59 
60 private:
61  QStyledItemDelegate* m_sourceDelegate;
62 };
63 
64 } // namespace qtgui
Definition: abstract_length_editor.cpp:20
Convenience class that simplifies dynamically overriding QStyledItemDelegate.
Definition: proxy_styled_item_delegate.h:25
#define QTTOOLS_GUI_EXPORT
Definition: gui.h:27