Commit a672c9bf authored by Ilia Ryabokon's avatar Ilia Ryabokon

Presentation changes

parent 2806b135
...@@ -374,7 +374,7 @@ macx { ...@@ -374,7 +374,7 @@ macx {
linux-g++* { linux-g++* {
CONFIG += link_prl CONFIG += link_prl
LIBS += -lcrypto LIBS += -lcrypto
LIBS += -lprofiler #LIBS += -lprofiler
LIBS += -lX11 LIBS += -lX11
QMAKE_CFLAGS += -fopenmp QMAKE_CFLAGS += -fopenmp
QMAKE_CXXFLAGS += -fopenmp QMAKE_CXXFLAGS += -fopenmp
......
This diff is collapsed.
...@@ -158,6 +158,8 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec ...@@ -158,6 +158,8 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
, mDeleteButton(NULL) , mDeleteButton(NULL)
, mDuplicateButton(NULL) , mDuplicateButton(NULL)
, mMenuButton(NULL) , mMenuButton(NULL)
, mZOrderUpButton(0)
, mZOrderDownButton(0)
, mMenu(0) , mMenu(0)
, mLockAction(0) , mLockAction(0)
, mShowOnDisplayAction(0) , mShowOnDisplayAction(0)
...@@ -243,13 +245,10 @@ void UBGraphicsItemDelegate::createControls() ...@@ -243,13 +245,10 @@ void UBGraphicsItemDelegate::createControls()
void UBGraphicsItemDelegate::freeControls() void UBGraphicsItemDelegate::freeControls()
{ {
QGraphicsScene *controlsScene = delegated()->scene(); QGraphicsScene *controlsScene = delegated()->scene();
Q_ASSERT(controlsScene);
UB_FREE_CONTROL(mFrame, controlsScene);
UB_FREE_CONTROL(mDeleteButton, controlsScene);
UB_FREE_CONTROL(mMenuButton, controlsScene);
UB_FREE_CONTROL(mZOrderUpButton, controlsScene);
UB_FREE_CONTROL(mZOrderDownButton, controlsScene);
UB_FREE_CONTROL(mFrame, controlsScene);
freeButtons(); freeButtons();
} }
...@@ -263,7 +262,6 @@ bool UBGraphicsItemDelegate::controlsExist() const ...@@ -263,7 +262,6 @@ bool UBGraphicsItemDelegate::controlsExist() const
; ;
} }
UBGraphicsItemDelegate::~UBGraphicsItemDelegate() UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
{ {
if (UBApplication::boardController) if (UBApplication::boardController)
...@@ -277,44 +275,35 @@ UBGraphicsItemDelegate::~UBGraphicsItemDelegate() ...@@ -277,44 +275,35 @@ UBGraphicsItemDelegate::~UBGraphicsItemDelegate()
QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) QVariant UBGraphicsItemDelegate::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{ {
UBGraphicsScene *ubScene = castUBGraphicsScene(); UBGraphicsScene *ubScene = castUBGraphicsScene();
switch (static_cast<int>(change)) {
if (change == QGraphicsItem::ItemSelectedHasChanged) { case QGraphicsItem::ItemSelectedHasChanged : {
bool ok;
bool selected = value.toUInt(&ok);
if (ok) {
if (ubScene && !ubScene->multipleSelectionProcess()) { if (ubScene && !ubScene->multipleSelectionProcess()) {
if (selected) { if (value.toBool()) { //selected(true)
if (!controlsExist()) {
createControls();
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom());
positionHandles();
ubScene->setSelectedZLevel(delegated()); ubScene->setSelectedZLevel(delegated());
}
} else { } else {
ubScene->setOwnZlevel(delegated()); ubScene->setOwnZlevel(delegated());
} freeControls();
}
} }
} }
if ((change == QGraphicsItem::ItemSelectedHasChanged } break;
|| change == QGraphicsItem::ItemPositionHasChanged
|| change == QGraphicsItem::ItemTransformHasChanged) case QGraphicsItem::ItemPositionHasChanged :
&& ubScene case QGraphicsItem::ItemTransformHasChanged :
&& !ubScene->multipleSelectionProcess() case QGraphicsItem::ItemZValueHasChanged :
&& UBApplication::boardController)
{
if (!controlsExist()) {
createControls();
}
mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom()); mAntiScaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * UBApplication::boardController->currentZoom());
positionHandles(); positionHandles();
} if (ubScene) {
if (change == QGraphicsItem::ItemPositionHasChanged
|| change == QGraphicsItem::ItemTransformHasChanged
|| change == QGraphicsItem::ItemZValueHasChanged)
{
UBGraphicsScene* ubScene = qobject_cast<UBGraphicsScene*>(mDelegated->scene());
if(ubScene)
ubScene->setModified(true); ubScene->setModified(true);
} }
break;
}
return value; return value;
} }
...@@ -425,6 +414,10 @@ QGraphicsItem *UBGraphicsItemDelegate::delegated() ...@@ -425,6 +414,10 @@ QGraphicsItem *UBGraphicsItemDelegate::delegated()
void UBGraphicsItemDelegate::positionHandles() void UBGraphicsItemDelegate::positionHandles()
{ {
if (!controlsExist()) {
return;
}
if (mDelegated->isSelected()) { if (mDelegated->isSelected()) {
bool shownOnDisplay = mDelegated->data(UBGraphicsItemData::ItemLayerType).toInt() != UBItemLayerType::Control; bool shownOnDisplay = mDelegated->data(UBGraphicsItemData::ItemLayerType).toInt() != UBItemLayerType::Control;
showHide(shownOnDisplay); showHide(shownOnDisplay);
...@@ -644,6 +637,13 @@ void UBGraphicsItemDelegate::buildButtons() ...@@ -644,6 +637,13 @@ void UBGraphicsItemDelegate::buildButtons()
} }
void UBGraphicsItemDelegate::freeButtons() void UBGraphicsItemDelegate::freeButtons()
{ {
//Previously deleted with the frame
// Rimplement for some specific behavior
mButtons.clear();
mDeleteButton = 0;
mMenuButton = 0;
mZOrderUpButton = 0;
mZOrderDownButton = 0;
} }
void UBGraphicsItemDelegate::decorateMenu(QMenu* menu) void UBGraphicsItemDelegate::decorateMenu(QMenu* menu)
......
...@@ -1034,6 +1034,13 @@ UBGraphicsPolygonItem* UBGraphicsScene::arcToPolygonItem(const QLineF& pStartRad ...@@ -1034,6 +1034,13 @@ UBGraphicsPolygonItem* UBGraphicsScene::arcToPolygonItem(const QLineF& pStartRad
return polygonToPolygonItem(polygon); return polygonToPolygonItem(polygon);
} }
void UBGraphicsScene::clearSelectionFrame()
{
if (mSelectionFrame) {
mSelectionFrame->setEnclosedItems(QList<QGraphicsItem*>());
}
}
void UBGraphicsScene::updateMultipleSelectionFrame() void UBGraphicsScene::updateMultipleSelectionFrame()
{ {
qDebug() << "selected item count" << selectedItems().count(); qDebug() << "selected item count" << selectedItems().count();
......
...@@ -311,6 +311,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -311,6 +311,7 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon); UBGraphicsPolygonItem* polygonToPolygonItem(const QPolygonF pPolygon);
void setMultipleSelectionProcess(bool pEnabled) {mMultipleSelectionProcess = pEnabled;} void setMultipleSelectionProcess(bool pEnabled) {mMultipleSelectionProcess = pEnabled;}
bool multipleSelectionProcess() const {return mMultipleSelectionProcess;} bool multipleSelectionProcess() const {return mMultipleSelectionProcess;}
void clearSelectionFrame();
void updateMultipleSelectionFrame(); void updateMultipleSelectionFrame();
public slots: public slots:
......
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