Commit c65efdee authored by Ilia Ryabokon's avatar Ilia Ryabokon

Selection process changed

parent a6ec6d7a
...@@ -1023,11 +1023,13 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) ...@@ -1023,11 +1023,13 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
} }
mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ())); mUBRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mUBRubberBand->show(); mUBRubberBand->show();
scene()->setMultipleSelectionProcess(true);
} }
else else
{ {
if(mUBRubberBand) if(mUBRubberBand)
mUBRubberBand->hide(); mUBRubberBand->hide();
scene()->setMultipleSelectionProcess(false);
} }
handleItemMousePress(event); handleItemMousePress(event);
...@@ -1061,6 +1063,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) ...@@ -1061,6 +1063,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mRubberBand->setGeometry (QRect (mMouseDownPos, QSize ())); mRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mRubberBand->show (); mRubberBand->show ();
mIsCreatingTextZone = true; mIsCreatingTextZone = true;
scene()->setMultipleSelectionProcess(true);
event->accept (); event->accept ();
} }
...@@ -1075,6 +1078,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event) ...@@ -1075,6 +1078,7 @@ void UBBoardView::mousePressEvent (QMouseEvent *event)
mRubberBand->setGeometry (QRect (mMouseDownPos, QSize ())); mRubberBand->setGeometry (QRect (mMouseDownPos, QSize ()));
mRubberBand->show (); mRubberBand->show ();
mIsCreatingSceneGrabZone = true; mIsCreatingSceneGrabZone = true;
scene()->setMultipleSelectionProcess(true);
event->accept (); event->accept ();
} }
...@@ -1283,6 +1287,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) ...@@ -1283,6 +1287,7 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
if (mUBRubberBand && mUBRubberBand->isVisible()) { if (mUBRubberBand && mUBRubberBand->isVisible()) {
mUBRubberBand->hide(); mUBRubberBand->hide();
scene()->setMultipleSelectionProcess(false);
} }
if (bReleaseIsNeed) if (bReleaseIsNeed)
...@@ -1316,8 +1321,11 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) ...@@ -1316,8 +1321,11 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
} }
else if (currentTool == UBStylusTool::Text) else if (currentTool == UBStylusTool::Text)
{ {
if (mRubberBand) if (mRubberBand) {
mRubberBand->hide (); mRubberBand->hide ();
scene()->setMultipleSelectionProcess(false);
}
if (scene () && mRubberBand && mIsCreatingTextZone) if (scene () && mRubberBand && mIsCreatingTextZone)
{ {
...@@ -1340,8 +1348,10 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event) ...@@ -1340,8 +1348,10 @@ UBBoardView::mouseReleaseEvent (QMouseEvent *event)
} }
else if (currentTool == UBStylusTool::Capture) else if (currentTool == UBStylusTool::Capture)
{ {
if (mRubberBand) if (mRubberBand) {
mRubberBand->hide (); mRubberBand->hide ();
scene()->setMultipleSelectionProcess(false);
}
if (scene () && mRubberBand && mIsCreatingSceneGrabZone && mRubberBand->geometry ().width () > 16) if (scene () && mRubberBand && mIsCreatingSceneGrabZone && mRubberBand->geometry ().width () > 16)
{ {
......
...@@ -59,7 +59,7 @@ const QString UBFeaturesController::webSearchPath = rootPath + "/Web search"; ...@@ -59,7 +59,7 @@ const QString UBFeaturesController::webSearchPath = rootPath + "/Web search";
void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet<QUrl> &pFavoriteSet) void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath, const QSet<QUrl> &pFavoriteSet)
{ {
Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists()); // Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists());
QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile()); QFileInfoList fileInfoList = UBFileSystemUtils::allElementsInDirectory(currentPath.toLocalFile());
......
...@@ -226,6 +226,16 @@ void UBGraphicsItemDelegate::init() ...@@ -226,6 +226,16 @@ void UBGraphicsItemDelegate::init()
setRotatable(false); setRotatable(false);
} }
void UBGraphicsItemDelegate::createControls()
{
}
void UBGraphicsItemDelegate::freeControls()
{
}
UBGraphicsItemDelegate::~UBGraphicsItemDelegate() UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
{ {
...@@ -242,9 +252,10 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch ...@@ -242,9 +252,10 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch
if (change == QGraphicsItem::ItemSelectedHasChanged) { if (change == QGraphicsItem::ItemSelectedHasChanged) {
bool ok; bool ok;
bool selected = value.toUInt(&ok); bool selected = value.toUInt(&ok);
if (ok) { if (ok) {
UBGraphicsScene *ubScene = castUBGraphicsScene(); UBGraphicsScene *ubScene = castUBGraphicsScene();
if (ubScene) { if (ubScene && !ubScene->multipleSelectionProcess()) {
if (selected) { if (selected) {
ubScene->setSelectedZLevel(delegated()); ubScene->setSelectedZLevel(delegated());
} else { } else {
...@@ -254,15 +265,16 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch ...@@ -254,15 +265,16 @@ QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange ch
} }
} }
if ((change == QGraphicsItem::ItemSelectedHasChanged
|| change == QGraphicsItem::ItemPositionHasChanged // if ((change == QGraphicsItem::ItemSelectedHasChanged
|| change == QGraphicsItem::ItemTransformHasChanged) // || change == QGraphicsItem::ItemPositionHasChanged
&& mDelegated->scene() // || change == QGraphicsItem::ItemTransformHasChanged)
&& UBApplication::boardController) // && mDelegated->scene()
{ // && UBApplication::boardController)
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom()); // {
positionHandles(); // mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom());
} // positionHandles();
// }
if (change == QGraphicsItem::ItemPositionHasChanged if (change == QGraphicsItem::ItemPositionHasChanged
|| change == QGraphicsItem::ItemTransformHasChanged || change == QGraphicsItem::ItemTransformHasChanged
......
...@@ -220,6 +220,8 @@ class UBGraphicsItemDelegate : public QObject ...@@ -220,6 +220,8 @@ class UBGraphicsItemDelegate : public QObject
virtual ~UBGraphicsItemDelegate(); virtual ~UBGraphicsItemDelegate();
void init(); void init();
void createControls();
void freeControls();
virtual bool mousePressEvent(QGraphicsSceneMouseEvent *event); virtual bool mousePressEvent(QGraphicsSceneMouseEvent *event);
virtual bool mouseMoveEvent(QGraphicsSceneMouseEvent *event); virtual bool mouseMoveEvent(QGraphicsSceneMouseEvent *event);
......
...@@ -287,6 +287,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta ...@@ -287,6 +287,7 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
, mZLayerController(new UBZLayerController(this)) , mZLayerController(new UBZLayerController(this))
, mpLastPolygon(NULL) , mpLastPolygon(NULL)
, mCurrentPolygon(0) , mCurrentPolygon(0)
, mMultipleSelectionProcess(false)
{ {
UBCoreGraphicsScene::setObjectName("BoardScene"); UBCoreGraphicsScene::setObjectName("BoardScene");
#ifdef __ppc__ #ifdef __ppc__
...@@ -295,6 +296,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta ...@@ -295,6 +296,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent, bool enableUndoRedoSta
mShouldUseOMP = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5; mShouldUseOMP = QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5;
#endif #endif
setItemIndexMethod(QGraphicsScene::BspTreeIndex);
setUuid(QUuid::createUuid()); setUuid(QUuid::createUuid());
setDocument(parent); setDocument(parent);
createEraiser(); createEraiser();
......
...@@ -310,6 +310,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -310,6 +310,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
static QUuid getPersonalUuid(QGraphicsItem *item); static QUuid getPersonalUuid(QGraphicsItem *item);
UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon); UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon);
void setMultipleSelectionProcess(bool pEnabled) {mMultipleSelectionProcess = pEnabled;}
bool multipleSelectionProcess() const {return mMultipleSelectionProcess;}
public slots: public slots:
void initStroke(); void initStroke();
...@@ -427,6 +429,7 @@ public slots: ...@@ -427,6 +429,7 @@ public slots:
bool mDrawWithCompass; bool mDrawWithCompass;
UBGraphicsPolygonItem *mCurrentPolygon; UBGraphicsPolygonItem *mCurrentPolygon;
bool mMultipleSelectionProcess;
}; };
......
...@@ -181,9 +181,18 @@ void UBGraphicsStrokesGroup::paint(QPainter *painter, const QStyleOptionGraphics ...@@ -181,9 +181,18 @@ void UBGraphicsStrokesGroup::paint(QPainter *painter, const QStyleOptionGraphics
{ {
// Never draw the rubber band, we draw our custom selection with the DelegateFrame // Never draw the rubber band, we draw our custom selection with the DelegateFrame
QStyleOptionGraphicsItem styleOption = QStyleOptionGraphicsItem(*option); QStyleOptionGraphicsItem styleOption = QStyleOptionGraphicsItem(*option);
bool selectedState = false;
if (styleOption.state & QStyle::State_Selected) {
selectedState = true;
}
styleOption.state &= ~QStyle::State_Selected; styleOption.state &= ~QStyle::State_Selected;
QGraphicsItemGroup::paint(painter, &styleOption, widget); QGraphicsItemGroup::paint(painter, &styleOption, widget);
if (selectedState) {
painter->save();
painter->setBrush(QColor(0x88, 0x88, 0x88, 0x77));
painter->drawRect(boundingRect());
painter->restore();
}
} }
QVariant UBGraphicsStrokesGroup::itemChange(GraphicsItemChange change, const QVariant &value) QVariant UBGraphicsStrokesGroup::itemChange(GraphicsItemChange change, const QVariant &value)
...@@ -192,7 +201,6 @@ QVariant UBGraphicsStrokesGroup::itemChange(GraphicsItemChange change, const QVa ...@@ -192,7 +201,6 @@ QVariant UBGraphicsStrokesGroup::itemChange(GraphicsItemChange change, const QVa
return QGraphicsItemGroup::itemChange(change, newValue); return QGraphicsItemGroup::itemChange(change, newValue);
} }
QPainterPath UBGraphicsStrokesGroup::shape () const QPainterPath UBGraphicsStrokesGroup::shape () const
{ {
QPainterPath path; QPainterPath path;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment