From 087738d5c08881241a21be0c214588c44a46120d Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Thu, 5 Nov 2015 15:35:43 +0100 Subject: [PATCH] Minor updates (includes, changes in function names) --- src/adaptors/UBThumbnailAdaptor.cpp | 2 +- src/board/UBBoardView.cpp | 18 +++++++++--------- src/core/UBApplicationController.cpp | 3 ++- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/adaptors/UBThumbnailAdaptor.cpp b/src/adaptors/UBThumbnailAdaptor.cpp index 1f8565a9..96545d0f 100644 --- a/src/adaptors/UBThumbnailAdaptor.cpp +++ b/src/adaptors/UBThumbnailAdaptor.cpp @@ -95,7 +95,7 @@ const QPixmap* UBThumbnailAdaptor::get(UBDocumentProxy* proxy, int pageIndex) if (file.exists()) { //Warning. Works only with modified Qt -#ifdef Q_WS_X11 +#ifdef Q_OS_LINUX pix->load(fileName, 0, Qt::AutoColor); #else pix->load(fileName, 0, Qt::AutoColor, false); diff --git a/src/board/UBBoardView.cpp b/src/board/UBBoardView.cpp index 3de52352..af301930 100644 --- a/src/board/UBBoardView.cpp +++ b/src/board/UBBoardView.cpp @@ -750,13 +750,13 @@ void UBBoardView::handleItemMousePress(QMouseEvent *event) if (itemShouldReceiveMousePressEvent(movingItem)){ QGraphicsView::mousePressEvent (event); - QGraphicsItem* item = determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint()), transform())); + QGraphicsItem* item = determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), transform())); //use QGraphicsView::transform() to use not deprecated QGraphicsScene::itemAt() method if (item && (item->type() == QGraphicsProxyWidget::Type) && item->parentObject() && item->parentObject()->type() != QGraphicsProxyWidget::Type) { //Clean up children - QList children = item->children(); + QList children = item->childItems(); for( QList::iterator it = children.begin(); it != children.end(); ++it ) if ((*it)->pos().x() < 0 || (*it)->pos().y() < 0) @@ -905,7 +905,7 @@ QWidget *UBBoardView::widgetForTabletEvent(QWidget *w, const QPoint &pos) QWidget *childAtPos = NULL; - QList childs = w->children(); + QList childs = w->childItems(); foreach(QObject *child, childs) { QWidget *childWidget = qobject_cast(child); @@ -972,7 +972,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) } mMouseDownPos = event->pos (); - movingItem = scene()->itemAt(this->mapToScene(event->posF().toPoint())); + movingItem = scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform()); if (event->button () == Qt::LeftButton && isInteractive()) { @@ -993,7 +993,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) case UBStylusTool::Hand : viewport()->setCursor(QCursor (Qt::ClosedHandCursor)); - mPreviousPoint = event->posF(); + mPreviousPoint = event->localPos(); event->accept(); break; @@ -1107,7 +1107,7 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event) if (!mMouseButtonIsPressed && !mTabletStylusIsPressed) { break; } - QPointF eventPosition = event->posF (); + QPointF eventPosition = event->localPos(); qreal dx = eventPosition.x () - mPreviousPoint.x (); qreal dy = eventPosition.y () - mPreviousPoint.y (); mController->handScroll (dx, dy); @@ -1230,7 +1230,7 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event) graphicsItem->Delegate()->commitUndoStep(); bool bReleaseIsNeed = true; - if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint())))) + if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform()))) { movingItem = NULL; bReleaseIsNeed = false; @@ -1299,7 +1299,7 @@ void UBBoardView::mouseReleaseEvent (QMouseEvent *event) graphicsItem->Delegate()->commitUndoStep(); bool bReleaseIsNeed = true; - if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->posF().toPoint())))) + if (movingItem != determineItemToPress(scene()->itemAt(this->mapToScene(event->localPos().toPoint()), QTransform()))) { movingItem = NULL; bReleaseIsNeed = false; @@ -1475,7 +1475,7 @@ void UBBoardView::wheelEvent (QWheelEvent *wheelEvent) QPointF scenePos = mapToScene(wheelEvent->pos()); QList itemsList = scene()->items(scenePos); - QBool isSelectedAndMouseHower = itemsList.contains(selItem); + bool isSelectedAndMouseHower = itemsList.contains(selItem); if(isSelectedAndMouseHower) { QGraphicsView::wheelEvent(wheelEvent); diff --git a/src/core/UBApplicationController.cpp b/src/core/UBApplicationController.cpp index bb93f0cc..5d7e5ce6 100644 --- a/src/core/UBApplicationController.cpp +++ b/src/core/UBApplicationController.cpp @@ -22,7 +22,8 @@ * along with OpenBoard. If not, see . */ - +#include +#include #include "UBApplicationController.h"