Commit 5addb7c6 authored by hjk's avatar hjk

Valgrind: De-pimpl Valgrind::Internal::CostView

No need for that in internal classes.

Change-Id: Id2e2783972e068cef9873c248ae54c013b933530
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent ee8a0b30
......@@ -46,24 +46,10 @@ using namespace Valgrind::Callgrind;
namespace Valgrind {
namespace Internal {
class CostView::Private
{
public:
explicit Private(CostView *qq);
CostDelegate *m_costDelegate;
NameDelegate *m_nameDelegate;
};
CostView::Private::Private(CostView *qq)
: m_costDelegate(new CostDelegate(qq))
, m_nameDelegate(new NameDelegate(qq))
{}
CostView::CostView(QWidget *parent)
: Utils::BaseTreeView(parent)
, d(new Private(this))
, m_costDelegate(new CostDelegate(this))
, m_nameDelegate(new NameDelegate(this))
{
setSelectionMode(QAbstractItemView::ExtendedSelection);
setSelectionBehavior(QAbstractItemView::SelectRows);
......@@ -77,7 +63,6 @@ CostView::CostView(QWidget *parent)
CostView::~CostView()
{
delete d;
}
void CostView::setModel(QAbstractItemModel *model)
......@@ -86,36 +71,35 @@ void CostView::setModel(QAbstractItemModel *model)
forever {
QAbstractProxyModel *proxy = qobject_cast<QAbstractProxyModel *>(model);
if (proxy)
model = proxy->sourceModel();
else
if (!proxy)
break;
model = proxy->sourceModel();
}
setItemDelegate(new QStyledItemDelegate(this));
if (qobject_cast<CallModel *>(model)) {
setItemDelegateForColumn(CallModel::CalleeColumn, d->m_nameDelegate);
setItemDelegateForColumn(CallModel::CallerColumn, d->m_nameDelegate);
setItemDelegateForColumn(CallModel::CostColumn, d->m_costDelegate);
setItemDelegateForColumn(CallModel::CalleeColumn, m_nameDelegate);
setItemDelegateForColumn(CallModel::CallerColumn, m_nameDelegate);
setItemDelegateForColumn(CallModel::CostColumn, m_costDelegate);
} else if (qobject_cast<DataModel *>(model)) {
setItemDelegateForColumn(DataModel::InclusiveCostColumn, d->m_costDelegate);
setItemDelegateForColumn(DataModel::NameColumn, d->m_nameDelegate);
setItemDelegateForColumn(DataModel::SelfCostColumn, d->m_costDelegate);
setItemDelegateForColumn(DataModel::InclusiveCostColumn, m_costDelegate);
setItemDelegateForColumn(DataModel::NameColumn, m_nameDelegate);
setItemDelegateForColumn(DataModel::SelfCostColumn, m_costDelegate);
}
d->m_costDelegate->setModel(model);
m_costDelegate->setModel(model);
}
void CostView::setCostFormat(CostDelegate::CostFormat format)
{
d->m_costDelegate->setFormat(format);
m_costDelegate->setFormat(format);
viewport()->update();
}
CostDelegate::CostFormat CostView::costFormat() const
{
return d->m_costDelegate->format();
return m_costDelegate->format();
}
void CostView::contextMenuEvent(QContextMenuEvent *ev)
......
......@@ -37,6 +37,9 @@
namespace Valgrind {
namespace Internal {
class CostDelegate;
class NameDelegate;
class CostView : public Utils::BaseTreeView
{
Q_OBJECT
......@@ -60,8 +63,8 @@ public:
void contextMenuEvent(QContextMenuEvent *ev);
private:
class Private;
Private *d;
CostDelegate *m_costDelegate;
NameDelegate *m_nameDelegate;
};
} // namespace Internal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment