X-Git-Url: http://cgit.sxemacs.org/?p=harmattan%2Fcameraplus;a=blobdiff_plain;f=src%2Fgridlines.cpp;h=b7cbe3df4f07aed06ca2f9449cf2d0695fa345d6;hp=693380ed5c517fd3208c28a247ba084a78d6e6be;hb=695e8f4f85218b41a7f27af281fcebe8238a33b7;hpb=26c667771f0ad6f46ff2db33989d6d0a21467c7f diff --git a/src/gridlines.cpp b/src/gridlines.cpp index 693380e..b7cbe3d 100644 --- a/src/gridlines.cpp +++ b/src/gridlines.cpp @@ -1,7 +1,7 @@ /*! * This file is part of CameraPlus. * - * Copyright (C) 2012 Mohammed Sameer + * Copyright (C) 2012-2013 Mohammed Sameer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -21,19 +21,31 @@ #include "gridlines.h" #include +#if defined(QT4) GridLines::GridLines(QDeclarativeItem *parent) : QDeclarativeItem(parent) { +#elif defined(QT5) +GridLines::GridLines(QQuickItem *parent) : + QQuickPaintedItem(parent) { +#endif +#if defined(QT4) setFlag(QGraphicsItem::ItemHasNoContents, false); +#endif } GridLines::~GridLines() { } -void GridLines::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) { - Q_UNUSED(option); - Q_UNUSED(widget); +#if defined(QT4) +void GridLines::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, + QWidget* widget) { + + QDeclarativeItem::paint(painter, option, widget); +#elif defined(QT5) +void GridLines::paint(QPainter* painter) { +#endif painter->save(); painter->setPen(QPen(Qt::black, 3)); @@ -45,7 +57,11 @@ void GridLines::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, } void GridLines::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) { +#if defined(QT4) QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); +#elif defined(QT5) + QQuickPaintedItem::geometryChanged(newGeometry, oldGeometry); +#endif qreal width = newGeometry.width(); qreal height = newGeometry.height();