Issue Sankore 1554

preferencesAboutTextFull
Nicolas Nenon 11 years ago committed by -f
parent cb64a03751
commit eb60133355
  1. 1
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 25
      src/board/UBBoardView.cpp
  3. 16
      src/domain/UBGraphicsScene.cpp
  4. 1
      src/domain/UBGraphicsScene.h
  5. 17
      src/domain/UBGraphicsTextItem.cpp
  6. 4
      src/domain/UBGraphicsTextItem.h

@ -29,6 +29,7 @@
#include <QtCore>
#include <QtXml>
#include <QGraphicsTextItem>
#include "domain/UBGraphicsSvgItem.h"
#include "domain/UBGraphicsPixmapItem.h"

@ -497,30 +497,7 @@ void UBBoardView::handleItemsSelection(QGraphicsItem *item)
// only with UB items.
if ((UBGraphicsItemType::UserTypesCount > item->type()) && (item->type() > QGraphicsItem::UserType))
{
// if Item can be selected at mouse press - then we need to deselect all other items.
foreach(QGraphicsItem *iter_item, scene()->selectedItems())
{
if (iter_item != item)
{
iter_item->setSelected(false);
}
}
}
}
}else{
// Deselect the other items
foreach(QGraphicsItem* it, scene()->selectedItems()){
UBGraphicsGroupContainerItem* pGroup = dynamic_cast<UBGraphicsGroupContainerItem*>(it);
if(NULL != pGroup){
foreach(QGraphicsItem* pGIt, pGroup->childItems()){
UBGraphicsTextItem* pTxt = dynamic_cast<UBGraphicsTextItem*>(pGIt);
if(NULL != pTxt){
// We must clear the text selection
QTextCursor t = pTxt->textCursor();
t.clearSelection();
pTxt->setTextCursor(t);
}
}
scene()->deselectAllItemsExcept(item);
}
}
}

@ -1685,6 +1685,22 @@ void UBGraphicsScene::deselectAllItems()
if (mSelectionFrame) {
mSelectionFrame->setEnclosedItems(QList<QGraphicsItem*>());
}
UBGraphicsTextItem* textItem = dynamic_cast<UBGraphicsTextItem*>(gi);
if(textItem)
textItem->activateTextEditor(false);
}
}
void UBGraphicsScene::deselectAllItemsExcept(QGraphicsItem* item)
{
foreach(QGraphicsItem* eachItem,selectedItems()){
if(eachItem != item){
eachItem->setSelected(false);
UBGraphicsTextItem* textItem = dynamic_cast<UBGraphicsTextItem*>(eachItem);
if(textItem)
textItem->activateTextEditor(false);
}
}
}

@ -317,6 +317,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void clearSelectionFrame();
UBBoardView *controlView();
void notifyZChanged(QGraphicsItem *item, qreal zValue);
void deselectAllItemsExcept(QGraphicsItem* graphicsItem);
public slots:
void updateSelectionFrame();

@ -47,6 +47,7 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
, mMultiClickState(0)
, mLastMousePressTime(QTime::currentTime())
, mTypeTextHereLabel(tr("<Type Text Here>"))
, isActivatedTextEditor(true)
{
setDelegate(new UBGraphicsTextItemDelegate(this, 0));
@ -152,6 +153,7 @@ void UBGraphicsTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (mMultiClickState == 1)
{
activateTextEditor(true);
QGraphicsTextItem::mousePressEvent(event);
setFocus();
}
@ -373,8 +375,17 @@ void UBGraphicsTextItem::documentSizeChanged(const QSizeF & newSize)
resize(newSize.width(), newSize.height());
}
void UBGraphicsTextItem::setHtml(const QString &text)
void UBGraphicsTextItem::activateTextEditor(bool activate)
{
QGraphicsTextItem::setHtml(text);
setTextInteractionFlags(Qt::NoTextInteraction);
qDebug() << textInteractionFlags();
this->isActivatedTextEditor = activate;
if(!activate){
setTextInteractionFlags(Qt::TextSelectableByMouse);
}else{
setTextInteractionFlags(Qt::TextEditorInteraction);
}
qDebug() << textInteractionFlags();
}

@ -94,8 +94,7 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
virtual void clearSource(){;}
virtual void setUuid(const QUuid &pUuid);
void setHtml(const QString &text);
void activateTextEditor(bool activate);
void setSelected(bool selected);
QString mTypeTextHereLabel;
@ -126,6 +125,7 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
QColor mColorOnDarkBackground;
QColor mColorOnLightBackground;
bool isActivatedTextEditor;
};
#endif /* UBGRAPHICSTEXTITEM_H_ */

Loading…
Cancel
Save