forked from qt-creator/qt-creator
Valgrind: De-pimpl Valgrind::Internal::CostView
No need for that in internal classes. Change-Id: Id2e2783972e068cef9873c248ae54c013b933530 Reviewed-by: hjk <hjk121@nokiamail.com>
This commit is contained in:
@@ -46,24 +46,10 @@ using namespace Valgrind::Callgrind;
|
|||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
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)
|
CostView::CostView(QWidget *parent)
|
||||||
: Utils::BaseTreeView(parent)
|
: Utils::BaseTreeView(parent)
|
||||||
, d(new Private(this))
|
, m_costDelegate(new CostDelegate(this))
|
||||||
|
, m_nameDelegate(new NameDelegate(this))
|
||||||
{
|
{
|
||||||
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
@@ -77,7 +63,6 @@ CostView::CostView(QWidget *parent)
|
|||||||
|
|
||||||
CostView::~CostView()
|
CostView::~CostView()
|
||||||
{
|
{
|
||||||
delete d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CostView::setModel(QAbstractItemModel *model)
|
void CostView::setModel(QAbstractItemModel *model)
|
||||||
@@ -86,36 +71,35 @@ void CostView::setModel(QAbstractItemModel *model)
|
|||||||
|
|
||||||
forever {
|
forever {
|
||||||
QAbstractProxyModel *proxy = qobject_cast<QAbstractProxyModel *>(model);
|
QAbstractProxyModel *proxy = qobject_cast<QAbstractProxyModel *>(model);
|
||||||
if (proxy)
|
if (!proxy)
|
||||||
model = proxy->sourceModel();
|
|
||||||
else
|
|
||||||
break;
|
break;
|
||||||
|
model = proxy->sourceModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
setItemDelegate(new QStyledItemDelegate(this));
|
setItemDelegate(new QStyledItemDelegate(this));
|
||||||
|
|
||||||
if (qobject_cast<CallModel *>(model)) {
|
if (qobject_cast<CallModel *>(model)) {
|
||||||
setItemDelegateForColumn(CallModel::CalleeColumn, d->m_nameDelegate);
|
setItemDelegateForColumn(CallModel::CalleeColumn, m_nameDelegate);
|
||||||
setItemDelegateForColumn(CallModel::CallerColumn, d->m_nameDelegate);
|
setItemDelegateForColumn(CallModel::CallerColumn, m_nameDelegate);
|
||||||
setItemDelegateForColumn(CallModel::CostColumn, d->m_costDelegate);
|
setItemDelegateForColumn(CallModel::CostColumn, m_costDelegate);
|
||||||
} else if (qobject_cast<DataModel *>(model)) {
|
} else if (qobject_cast<DataModel *>(model)) {
|
||||||
setItemDelegateForColumn(DataModel::InclusiveCostColumn, d->m_costDelegate);
|
setItemDelegateForColumn(DataModel::InclusiveCostColumn, m_costDelegate);
|
||||||
setItemDelegateForColumn(DataModel::NameColumn, d->m_nameDelegate);
|
setItemDelegateForColumn(DataModel::NameColumn, m_nameDelegate);
|
||||||
setItemDelegateForColumn(DataModel::SelfCostColumn, d->m_costDelegate);
|
setItemDelegateForColumn(DataModel::SelfCostColumn, m_costDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->m_costDelegate->setModel(model);
|
m_costDelegate->setModel(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CostView::setCostFormat(CostDelegate::CostFormat format)
|
void CostView::setCostFormat(CostDelegate::CostFormat format)
|
||||||
{
|
{
|
||||||
d->m_costDelegate->setFormat(format);
|
m_costDelegate->setFormat(format);
|
||||||
viewport()->update();
|
viewport()->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
CostDelegate::CostFormat CostView::costFormat() const
|
CostDelegate::CostFormat CostView::costFormat() const
|
||||||
{
|
{
|
||||||
return d->m_costDelegate->format();
|
return m_costDelegate->format();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CostView::contextMenuEvent(QContextMenuEvent *ev)
|
void CostView::contextMenuEvent(QContextMenuEvent *ev)
|
||||||
|
|||||||
@@ -37,6 +37,9 @@
|
|||||||
namespace Valgrind {
|
namespace Valgrind {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
class CostDelegate;
|
||||||
|
class NameDelegate;
|
||||||
|
|
||||||
class CostView : public Utils::BaseTreeView
|
class CostView : public Utils::BaseTreeView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -60,8 +63,8 @@ public:
|
|||||||
void contextMenuEvent(QContextMenuEvent *ev);
|
void contextMenuEvent(QContextMenuEvent *ev);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Private;
|
CostDelegate *m_costDelegate;
|
||||||
Private *d;
|
NameDelegate *m_nameDelegate;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user