diff --git a/src/document/UBDocumentController.cpp b/src/document/UBDocumentController.cpp index 9d1f8d42..5aafded1 100644 --- a/src/document/UBDocumentController.cpp +++ b/src/document/UBDocumentController.cpp @@ -1150,11 +1150,10 @@ void UBDocumentController::moveSceneToIndex(UBDocumentProxy* proxy, int source, UBMetadataDcSubsetAdaptor::persist(proxy); refreshDocumentThumbnailsView(); - // NOTE [Didier]: I think that selecting the thumbnail is not the role of the documentController - mDocumentUI->thumbnailWidget->selectItemAt(target); - // Notify the move to anyone interested in knowing it emit movedToIndex(target); + + UBApplication::boardController->setActiveDocumentScene(proxy, target); } diff --git a/src/domain/UBGraphicsTextItemDelegate.cpp b/src/domain/UBGraphicsTextItemDelegate.cpp index c430d84d..ea031cf1 100644 --- a/src/domain/UBGraphicsTextItemDelegate.cpp +++ b/src/domain/UBGraphicsTextItemDelegate.cpp @@ -305,10 +305,11 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta) bool bEndofTheSameBlock; int iBlockLen; int iPointSize; - int inewPointSize; + int iNextPointSize; int iCursorPos = startPos; // we search continuous blocks of the text with the same PointSize and allpy new settings for them. + cursor.setPosition (startPos, QTextCursor::MoveAnchor); while(iCursorPos < endPos) { bEndofTheSameBlock = false; @@ -326,17 +327,18 @@ void UBGraphicsTextItemDelegate::ChangeTextSize(int delta) iBlockLen++; cursor.setPosition (iCursorPos+iBlockLen+1, QTextCursor::KeepAnchor); - inewPointSize = cursor.charFormat().font().pointSize(); + iNextPointSize = cursor.charFormat().font().pointSize(); cursor.setPosition (iCursorPos+iBlockLen, QTextCursor::KeepAnchor); - if ((iPointSize != inewPointSize)||(iCursorPos+iBlockLen >= endPos)) + if ((iPointSize != iNextPointSize)||(iCursorPos+iBlockLen >= endPos)) bEndofTheSameBlock = true; }while(!bEndofTheSameBlock); //setting new parameners - curFont.setPointSize(iPointSize + delta); + int iNewPointSize = iPointSize + delta; + curFont.setPointSize( (iNewPointSize > 0)?iNewPointSize:1); textFormat.setFont(curFont); cursor.mergeCharFormat(textFormat); diff --git a/src/gui/UBDockPalette.cpp b/src/gui/UBDockPalette.cpp index 82f28d76..b168663f 100644 --- a/src/gui/UBDockPalette.cpp +++ b/src/gui/UBDockPalette.cpp @@ -697,7 +697,7 @@ void UBDockPalette::moveTabs() void UBDockPalette::resizeTabs() { int numTabs = mTabWidgets.size(); - mTabPalette->resize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing()); + mTabPalette->setFixedSize(2 * border(), (numTabs * TABSIZE) + qMax(numTabs - 1, 0) * tabSpacing()); } QRect UBDockPalette::getTabPaletteRect() { diff --git a/src/gui/UBDocumentNavigator.cpp b/src/gui/UBDocumentNavigator.cpp index 4efea020..0f6b6eff 100644 --- a/src/gui/UBDocumentNavigator.cpp +++ b/src/gui/UBDocumentNavigator.cpp @@ -391,17 +391,13 @@ void UBDocumentNavigator::mousePressEvent(QMouseEvent *event) mCrntItem = pCrntItem; } - // HACK: for an unknown reason, the mousePressEvent of the item is not - // called when a click occurs on it. So I created this method in - // order to handle the click. - mCrntItem->notifyClick(mapToScene(event->pos())); - // Then display the related page emit changeCurrentPage(); refreshScene(); } bNavig = false; } + QGraphicsView::mousePressEvent(event); } /** @@ -448,7 +444,8 @@ void UBDocumentNavigator::onMovedToIndex(int index) UBSceneThumbnailNavigPixmap* pItem = dynamic_cast(mThumbnails.at(index)); if(NULL != pItem) { - mCrntItem = pItem; + if(mCrntItem) mCrntItem->setSelected(false);//deselecting previous one + mCrntItem = pItem; mCrntItem->setSelected(true); centerOn(mCrntItem); } diff --git a/src/gui/UBLibPathViewer.cpp b/src/gui/UBLibPathViewer.cpp index 2dff5098..ca79f7c0 100644 --- a/src/gui/UBLibPathViewer.cpp +++ b/src/gui/UBLibPathViewer.cpp @@ -284,7 +284,7 @@ void UBLibPathViewer::showBack() if(NULL != pLastElem) { mpBackElem->setPath(pLastElem->element()->path()); - mpBackElem->setType(eUBLibElementType_Folder); + mpBackElem->setType(pLastElem->element()->type()); mpBackElem->setName(pLastElem->element()->name()); } diff --git a/src/gui/UBResources.cpp b/src/gui/UBResources.cpp index be2e7dcc..f1eb64ab 100644 --- a/src/gui/UBResources.cpp +++ b/src/gui/UBResources.cpp @@ -51,7 +51,6 @@ void UBResources::init() // Cursors penCursor = QCursor(Qt::CrossCursor); eraserCursor = QCursor(QPixmap(":/images/cursors/eraser.png"), 21, 21); - magnifierCursor = QCursor(QPixmap(":/images/cursors/magnifier.png"), 9, 9); markerCursor = QCursor(QPixmap(":/images/cursors/marker.png"), 3, 30); pointerCursor = QCursor(QPixmap(":/images/cursors/laser.png"), 2, 1); handCursor = QCursor(Qt::OpenHandCursor); @@ -60,5 +59,5 @@ void UBResources::init() arrowCursor = QCursor(Qt::ArrowCursor); textCursor = QCursor(Qt::ArrowCursor); rotateCursor = QCursor(QPixmap(":/images/cursors/rotate.png"), 16, 16); - drawLineRulerCursor = QCursor(QPixmap(":/images/cursors/drawRulerLine.png"), 3, 12); + drawLineRulerCursor = QCursor(QPixmap(":/images/cursors/drawRulerLine.png"), 3, 12); } diff --git a/src/gui/UBResources.h b/src/gui/UBResources.h index fd32fa6d..bae4eee6 100644 --- a/src/gui/UBResources.h +++ b/src/gui/UBResources.h @@ -37,7 +37,6 @@ class UBResources : public QObject QCursor penCursor; QCursor eraserCursor; - QCursor magnifierCursor; QCursor markerCursor; QCursor pointerCursor; QCursor handCursor; diff --git a/src/gui/UBThumbnailWidget.cpp b/src/gui/UBThumbnailWidget.cpp index e589300b..c7821ab9 100644 --- a/src/gui/UBThumbnailWidget.cpp +++ b/src/gui/UBThumbnailWidget.cpp @@ -740,25 +740,21 @@ void UBSceneThumbnailNavigPixmap::paint(QPainter *painter, const QStyleOptionGra void UBSceneThumbnailNavigPixmap::mousePressEvent(QGraphicsSceneMouseEvent *event) { - // INFO: This implementation should work but this method is not called on a mousePressEvent, why? - // PLEASE DO NOT REMOVE THIS METHOD! We should reactivate this code when we will fix - // the mousePressEvent-not-called issue! - -// QPointF p = event->pos(); - -// // Here we check the position of the click and verify if it has to trig an action or not. -// if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE) -// { -// deletePage(); -// } -// if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE) -// { -// moveUpPage(); -// } -// if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE) -// { -// moveDownPage(); -// } + QPointF p = event->pos(); + + // Here we check the position of the click and verify if it has to trig an action or not. + if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE) + { + deletePage(); + } + if(bCanMoveUp && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= 2*BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE) + { + moveUpPage(); + } + if(bCanMoveDown && p.x() >= 2*(BUTTONSIZE + BUTTONSPACING) && p.x() <= 2*(BUTTONSIZE + BUTTONSPACING) + BUTTONSIZE && p.y() >= 0 && p.y() <= BUTTONSIZE) + { + moveDownPage(); + } event->accept(); } @@ -809,32 +805,3 @@ void UBSceneThumbnailNavigPixmap::moveDownPage() { UBApplication::documentController->moveSceneToIndex(proxy(), sceneIndex(), sceneIndex() + 1); } - -void UBSceneThumbnailNavigPixmap::notifyClick(QPointF clickedScenePos) -{ - QPointF p = clickedPos(clickedScenePos); - - // Here we check the position of the click and verify if it has to trig an action or not. - if(bCanDelete && p.x() >= 0 && p.x() <= BUTTONSIZE/2 && p.y() >= 0 && p.y() <= BUTTONSIZE/2) - { - deletePage(); - } - if(bCanMoveUp && p.x() >= (BUTTONSIZE + BUTTONSPACING)/2 && p.x() <= BUTTONSIZE + BUTTONSPACING && p.y() >= 0 && p.y() <= BUTTONSIZE/2) - { - moveUpPage(); - } - if(bCanMoveDown && p.x() >= BUTTONSIZE + BUTTONSPACING && p.x() <= BUTTONSIZE + BUTTONSPACING + BUTTONSIZE/2 && p.y() >= 0 && p.y() <= BUTTONSIZE/2) - { - moveDownPage(); - } -} - -QPointF UBSceneThumbnailNavigPixmap::clickedPos(QPointF clickedScenePos) -{ - QPointF p; - - p.setX(clickedScenePos.x() - scenePos().x()); - p.setY(clickedScenePos.y() - scenePos().y()); - - return p; -} diff --git a/src/gui/UBThumbnailWidget.h b/src/gui/UBThumbnailWidget.h index f3f25d6a..ed47869b 100644 --- a/src/gui/UBThumbnailWidget.h +++ b/src/gui/UBThumbnailWidget.h @@ -292,7 +292,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap public: UBSceneThumbnailNavigPixmap(const QPixmap& pix, UBDocumentProxy* proxy, int pSceneIndex); ~UBSceneThumbnailNavigPixmap(); - void notifyClick(QPointF clickedScenePos); protected: void hoverEnterEvent(QGraphicsSceneHoverEvent *event); @@ -305,7 +304,6 @@ class UBSceneThumbnailNavigPixmap : public UBSceneThumbnailPixmap void deletePage(); void moveUpPage(); void moveDownPage(); - QPointF clickedPos(QPointF clickedScenePos); bool bButtonsVisible; bool bCanDelete;