[Marble-commits] KDE/kdeedu/marble/src
Bastian Holst
bastianholst at gmx.de
Mon Jul 13 22:32:34 CEST 2009
SVN commit 996097 by bholst:
MarbleGraphicsItem now uses QPointF/QSizeF/QRectF instead of integer versions.
M +2 -1 lib/AbstractDataPluginModel.cpp
M +1 -1 lib/GeoGraphicsItem.cpp
M +1 -1 lib/GeoGraphicsItem.h
M +3 -3 lib/GeoGraphicsItem_p.h
M +7 -7 lib/MarbleGraphicsItem.cpp
M +11 -5 lib/MarbleGraphicsItem.h
M +8 -7 lib/MarbleGraphicsItem_p.h
M +2 -2 lib/ScreenGraphicsItem.cpp
M +2 -2 lib/ScreenGraphicsItem.h
M +3 -3 lib/ScreenGraphicsItem_p.h
M +1 -1 plugins/render/weather/WeatherItem.cpp
--- trunk/KDE/kdeedu/marble/src/lib/AbstractDataPluginModel.cpp #996096:996097
@@ -15,6 +15,7 @@
#include <QtCore/QUrl>
#include <QtCore/QDebug>
#include <QtCore/QTimer>
+#include <QtCore/QPointF>
#include <QtCore/QtAlgorithms>
#include <QtCore/QVariant>
@@ -218,7 +219,7 @@
QList<AbstractDataPluginItem *> itemsAt;
foreach( AbstractDataPluginItem* item, d->m_displayedItems ) {
- if( item && item->contains( curpos ) )
+ if( item && item->contains( QPointF( curpos ) ) )
itemsAt.append( item );
}
--- trunk/KDE/kdeedu/marble/src/lib/GeoGraphicsItem.cpp #996096:996097
@@ -61,7 +61,7 @@
p()->m_target = target;
}
-QList<QPoint> GeoGraphicsItem::positions() {
+QList<QPointF> GeoGraphicsItem::positions() {
return p()->positions();
}
--- trunk/KDE/kdeedu/marble/src/lib/GeoGraphicsItem.h #996096:996097
@@ -81,7 +81,7 @@
/**
* Returns all coordinates of the item in view coordinates according to the given projection.
*/
- QList<QPoint> positions();
+ QList<QPointF> positions();
/**
* Paints the item in item coordinates
--- trunk/KDE/kdeedu/marble/src/lib/GeoGraphicsItem_p.h #996096:996097
@@ -26,8 +26,8 @@
virtual ~GeoGraphicsItemPrivate() {
}
- QList<QPoint> positions() {
- QList<QPoint> list;
+ QList<QPointF> positions() {
+ QList<QPointF> list;
list.append( m_positions );
return list;
@@ -58,7 +58,7 @@
GeoDataCoordinates m_coordinate;
QString m_target;
- QList<QPoint> m_positions;
+ QList<QPointF> m_positions;
};
}
--- trunk/KDE/kdeedu/marble/src/lib/MarbleGraphicsItem.cpp #996096:996097
@@ -64,7 +64,7 @@
QPixmap cachePixmap;
bool pixmapAvailable = QPixmapCache::find( p()->m_cacheKey, cachePixmap );
if ( !pixmapAvailable ) {
- QSize neededPixmapSize = size() + QSize( 1, 1 ); // adding a pixel for rounding errors
+ QSize neededPixmapSize = size().toSize() + QSize( 1, 1 ); // adding a pixel for rounding errors
if ( cachePixmap.size() != neededPixmapSize ) {
if ( size().isValid() && !size().isNull() ) {
@@ -86,7 +86,7 @@
QPixmapCache::insert( p()->m_cacheKey, cachePixmap );
}
- foreach( QPoint position, p()->positions() ) {
+ foreach( QPointF position, p()->positions() ) {
painter->save();
painter->drawPixmap( position, cachePixmap );
@@ -95,7 +95,7 @@
}
}
else {
- foreach( QPoint position, p()->positions() ) {
+ foreach( QPointF position, p()->positions() ) {
painter->save();
painter->translate( position );
@@ -108,15 +108,15 @@
return successful;
}
-bool MarbleGraphicsItem::contains( const QPoint& point ) const {
- foreach( QRect rect, d->boundingRects() ) {
+bool MarbleGraphicsItem::contains( const QPointF& point ) const {
+ foreach( QRectF rect, d->boundingRects() ) {
if( rect.contains( point ) )
return true;
}
return false;
}
-QSize MarbleGraphicsItem::size() const {
+QSizeF MarbleGraphicsItem::size() const {
return p()->m_size;
}
@@ -136,7 +136,7 @@
p()->m_removeCachedPixmap = true;
}
-void MarbleGraphicsItem::setSize( const QSize& size ) {
+void MarbleGraphicsItem::setSize( const QSizeF& size ) {
p()->m_size = size;
update();
}
--- trunk/KDE/kdeedu/marble/src/lib/MarbleGraphicsItem.h #996096:996097
@@ -14,10 +14,10 @@
#include "marble_export.h"
#include <QtCore/QList>
-#include <QtCore/QSize>
+#include <QtCore/QSizeF>
class QEvent;
-class QPoint;
+class QPointF;
class QObject;
class QString;
@@ -52,12 +52,18 @@
/**
* Returns true if the Item contains @p point in view coordinates.
*/
- bool contains( const QPoint& point ) const;
+ bool contains( const QPointF& point ) const;
+
+ /**
+ * Returns true if the Item contains @p point in view coordinates.
+ * Overloaded member function provided for convenience.
+ */
+// bool contains( const QPoint& point ) const;
/**
* Returns the size of the item
*/
- QSize size() const;
+ QSizeF size() const;
/**
* Returns the cache mode of the item
@@ -89,7 +95,7 @@
/**
* Set the size of the item
*/
- void setSize( const QSize& size );
+ void setSize( const QSizeF& size );
MarbleGraphicsItemPrivate * const d;
--- trunk/KDE/kdeedu/marble/src/lib/MarbleGraphicsItem_p.h #996096:996097
@@ -17,6 +17,7 @@
// Qt
#include<QtCore/QList>
#include<QtCore/QSize>
+#include<QtCore/QSizeF>
#include<QtCore/QRect>
#include<QtGui/QPixmapCache>
@@ -33,8 +34,8 @@
virtual ~MarbleGraphicsItemPrivate() {
}
- virtual QList<QPoint> positions() {
- return QList<QPoint>();
+ virtual QList<QPointF> positions() {
+ return QList<QPointF>();
}
void ensureValidCacheKey() {
@@ -45,11 +46,11 @@
}
}
- QList<QRect> boundingRects() {
- QList<QRect> list;
+ QList<QRectF> boundingRects() {
+ QList<QRectF> list;
- foreach( QPoint point, positions() ) {
- QRect rect( point, m_size );
+ foreach( QPointF point, positions() ) {
+ QRectF rect( point, m_size );
if( rect.x() < 0 )
rect.setLeft( 0 );
if( rect.y() < 0 )
@@ -66,7 +67,7 @@
Q_UNUSED( viewport );
};
- QSize m_size;
+ QSizeF m_size;
QSize m_logicalCacheSize;
bool m_removeCachedPixmap;
--- trunk/KDE/kdeedu/marble/src/lib/ScreenGraphicsItem.cpp #996096:996097
@@ -27,11 +27,11 @@
ScreenGraphicsItem::~ScreenGraphicsItem() {
}
-QPoint ScreenGraphicsItem::position() const {
+QPointF ScreenGraphicsItem::position() const {
return p()->m_position;
}
-void ScreenGraphicsItem::setPosition( const QPoint& position ) {
+void ScreenGraphicsItem::setPosition( const QPointF& position ) {
p()->m_position = position;
}
--- trunk/KDE/kdeedu/marble/src/lib/ScreenGraphicsItem.h #996096:996097
@@ -39,12 +39,12 @@
/**
* Returns the postion of the item
*/
- QPoint position() const;
+ QPointF position() const;
/**
* Set the position of the item
*/
- void setPosition( const QPoint& position );
+ void setPosition( const QPointF& position );
protected:
/**
--- trunk/KDE/kdeedu/marble/src/lib/ScreenGraphicsItem_p.h #996096:996097
@@ -26,8 +26,8 @@
virtual ~ScreenGraphicsItemPrivate() {
}
- QList<QPoint> positions() {
- QList<QPoint> list;
+ QList<QPointF> positions() {
+ QList<QPointF> list;
list.append( m_position );
return list;
@@ -38,7 +38,7 @@
Q_UNUSED( viewport );
}
- QPoint m_position;
+ QPointF m_position;
};
}
--- trunk/KDE/kdeedu/marble/src/plugins/render/weather/WeatherItem.cpp #996096:996097
@@ -270,7 +270,7 @@
painter->setPen( Qt::SolidLine );
painter->setFont( d->s_font );
- painter->drawRoundedRect( QRect( QPoint( 0, 0 ), size() ), 4, 4 );
+ painter->drawRoundedRect( QRectF( QPointF( 0, 0 ), size() ), 4, 4 );
// Condition
if ( d->isConditionShown() ) {
More information about the Marble-commits
mailing list