2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2011-04-04 14:39:29 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2011-04-04 14:39:29 +02:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QStyledItemDelegate>
|
2011-04-04 14:39:29 +02:00
|
|
|
|
2011-05-23 13:50:28 +02:00
|
|
|
namespace Valgrind {
|
2011-04-04 14:39:29 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class CostDelegate : public QStyledItemDelegate
|
|
|
|
|
{
|
|
|
|
|
public:
|
2018-12-10 08:11:18 +01:00
|
|
|
explicit CostDelegate(QObject *parent = nullptr);
|
|
|
|
|
~CostDelegate() override;
|
2011-04-04 14:39:29 +02:00
|
|
|
|
2018-12-10 08:11:18 +01:00
|
|
|
void paint(QPainter *painter, const QStyleOptionViewItem &option,
|
|
|
|
|
const QModelIndex &index) const override;
|
|
|
|
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
2011-04-04 14:39:29 +02:00
|
|
|
|
2011-04-05 11:11:57 +02:00
|
|
|
void setModel(QAbstractItemModel *model);
|
2011-04-04 14:39:29 +02:00
|
|
|
|
|
|
|
|
enum CostFormat {
|
|
|
|
|
/// show absolute numbers
|
|
|
|
|
FormatAbsolute,
|
|
|
|
|
/// show percentages relative to the total inclusive cost
|
|
|
|
|
FormatRelative,
|
|
|
|
|
/// show percentages relative to the parent cost
|
|
|
|
|
FormatRelativeToParent
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void setFormat(CostFormat format);
|
|
|
|
|
CostFormat format() const;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
class Private;
|
|
|
|
|
Private *d;
|
|
|
|
|
};
|
|
|
|
|
|
2011-05-23 13:50:28 +02:00
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Valgrind
|
2011-04-04 14:39:29 +02:00
|
|
|
|
2011-05-23 13:50:28 +02:00
|
|
|
Q_DECLARE_METATYPE(Valgrind::Internal::CostDelegate::CostFormat)
|