Autotest: Use QStyleOptionViewItem instead of QStyleOptionViewItemV4.

Fixes warnings:
warning: 'QStyleOptionViewItemV4' is deprecated (declared at ../../../../qt-dev/qtbase/include/QtWidgets/../../src/widgets/styles/qstyleoption.h:390) [-Wdeprecated-declarations]

Change-Id: I41683dc7f449b7e738a6e058b8c0a1e051da6c50
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
This commit is contained in:
Friedemann Kleint
2016-02-03 13:37:34 +01:00
parent b3ac3ff933
commit 537a5c0067
2 changed files with 4 additions and 4 deletions

View File

@@ -85,7 +85,7 @@ QString TestResultDelegate::outputString(const TestResult &testResult, bool sele
void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
initStyleOption(&opt, index); initStyleOption(&opt, index);
// make sure we paint the complete delegate instead of keeping an offset // make sure we paint the complete delegate instead of keeping an offset
opt.rect.adjust(-opt.rect.x(), 0, 0, 0); opt.rect.adjust(-opt.rect.x(), 0, 0, 0);
@@ -113,7 +113,7 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
const TestResult &testResult = resultFilterModel->testResult(index); const TestResult &testResult = resultFilterModel->testResult(index);
// draw the indicator by ourself as we paint across it with the delegate // draw the indicator by ourself as we paint across it with the delegate
QStyleOptionViewItemV4 indicatorOpt = option; QStyleOptionViewItem indicatorOpt = option;
indicatorOpt.rect = QRect(0, opt.rect.y(), positions.indentation(), opt.rect.height()); indicatorOpt.rect = QRect(0, opt.rect.y(), positions.indentation(), opt.rect.height());
opt.widget->style()->drawPrimitive(QStyle::PE_IndicatorBranch, &indicatorOpt, painter); opt.widget->style()->drawPrimitive(QStyle::PE_IndicatorBranch, &indicatorOpt, painter);
@@ -174,7 +174,7 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op
QSize TestResultDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const QSize TestResultDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{ {
QStyleOptionViewItemV4 opt = option; QStyleOptionViewItem opt = option;
// make sure opt.rect is initialized correctly - otherwise we might get a width of 0 // make sure opt.rect is initialized correctly - otherwise we might get a width of 0
opt.initFrom(opt.widget); opt.initFrom(opt.widget);
initStyleOption(&opt, index); initStyleOption(&opt, index);

View File

@@ -60,7 +60,7 @@ private:
class LayoutPositions class LayoutPositions
{ {
public: public:
LayoutPositions(QStyleOptionViewItemV4 &options, TestResultFilterModel *filterModel) LayoutPositions(QStyleOptionViewItem &options, TestResultFilterModel *filterModel)
: m_totalWidth(options.rect.width()), : m_totalWidth(options.rect.width()),
m_top(options.rect.top()), m_top(options.rect.top()),
m_bottom(options.rect.bottom()) m_bottom(options.rect.bottom())