diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 145bbbbb..ee9bfe9e 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1212,7 +1212,9 @@ void UBBoardController::ClearUndoStack() QGraphicsItem* item = itUniq.next(); UBGraphicsScene *scene = (UBGraphicsScene*)item->scene(); if(!scene) - delete item; + { + bool retCode = mActiveScene->deleteItem(item); + } } } diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index dd0790ad..6625095e 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -152,34 +152,28 @@ UBGraphicsScene::~UBGraphicsScene() void UBGraphicsScene::selectionChangedProcessing() { - if (selectedItems().count()) + if (selectedItems().count()) UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f')); QList allItemsList = items(); qreal maxZ = 0.; - for( int i = 0; i < allItemsList.size(); i++ ) - { + for( int i = 0; i < allItemsList.size(); i++ ) { QGraphicsItem *nextItem = allItemsList.at(i); //Temporary stub. Due to ugly z-order implementation I need to do this (sankore 360) //z-order behavior should be reimplemented and this stub should be deleted if (nextItem == mBackgroundObject) continue; //Temporary stub end (sankore 360) -// qreal zValue = nextItem->zValue(); if (nextItem->zValue() > maxZ) maxZ = nextItem->zValue(); - nextItem->setZValue(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal()); // nextItem->setZValue(qreal(1)); } QList selItemsList = selectedItems(); -// QGraphicsItem *nextItem; - for( int i = 0; i < selItemsList.size(); i++ ) - { + for( int i = 0; i < selItemsList.size(); i++ ) { QGraphicsItem *nextItem = selItemsList.at(i); nextItem->setZValue(maxZ + 0.0001); -// qDebug() << QString(" >>> %1 <<< ").arg(i) << QString(" >>> %1 <<< ").arg(zValue); } } diff --git a/src/frameworks/UBCoreGraphicsScene.cpp b/src/frameworks/UBCoreGraphicsScene.cpp index 4412f9b1..bcac6202 100644 --- a/src/frameworks/UBCoreGraphicsScene.cpp +++ b/src/frameworks/UBCoreGraphicsScene.cpp @@ -53,3 +53,16 @@ void UBCoreGraphicsScene::removeItem(QGraphicsItem* item, bool forceDelete) delete item; } } + +bool UBCoreGraphicsScene::deleteItem(QGraphicsItem* item) +{ + if(mItemsToDelete.contains(item)) + { + mItemsToDelete.remove(item); + delete item; + return true; + } + else + return false; +} + diff --git a/src/frameworks/UBCoreGraphicsScene.h b/src/frameworks/UBCoreGraphicsScene.h index fdeaae49..656f2a00 100644 --- a/src/frameworks/UBCoreGraphicsScene.h +++ b/src/frameworks/UBCoreGraphicsScene.h @@ -28,6 +28,9 @@ class UBCoreGraphicsScene : public QGraphicsScene virtual void removeItem(QGraphicsItem* item, bool forceDelete = false); + virtual bool deleteItem(QGraphicsItem* item); + + private: QSet mItemsToDelete; }; diff --git a/src/gui/UBTeacherBarWidget.cpp b/src/gui/UBTeacherBarWidget.cpp index ea8348b1..c3986972 100644 --- a/src/gui/UBTeacherBarWidget.cpp +++ b/src/gui/UBTeacherBarWidget.cpp @@ -62,6 +62,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock mpTitleLabel->setAlignment(Qt::AlignRight); mpTitle = new QLineEdit(mpContainer); mpTitle->setObjectName("DockPaletteWidgetLineEdit"); + connect(mpTitle, SIGNAL(textChanged(const QString&)), this, SLOT(onTitleTextChanged(const QString&))); mpTitleLayout = new QHBoxLayout(); mpTitleLayout->addWidget(mpTitleLabel, 0); mpTitleLayout->addWidget(mpTitle, 1); @@ -95,6 +96,7 @@ UBTeacherBarWidget::UBTeacherBarWidget(QWidget *parent, const char *name):UBDock mpEquipmentLabel->setAlignment(Qt::AlignRight); mpEquipment = new QLineEdit(mpContainer); mpEquipment->setObjectName("DockPaletteWidgetLineEdit"); + connect(mpEquipment, SIGNAL(textChanged(const QString&)), this, SLOT(onEquipmentTextChanged(const QString&))); mpEquipmentLayout = new QHBoxLayout(); mpEquipmentLayout->addWidget(mpEquipmentLabel, 0); mpEquipmentLayout->addWidget(mpEquipment, 1); @@ -319,6 +321,16 @@ void UBTeacherBarWidget::loadContent() mpAction3->setStudentText(nextInfos.action3Student); } +void UBTeacherBarWidget::onTitleTextChanged(const QString& text) +{ + mpTitle->setToolTip(text); +} + +void UBTeacherBarWidget::onEquipmentTextChanged(const QString& text) +{ + mpEquipment->setToolTip(text); +} + UBTeacherStudentAction::UBTeacherStudentAction(int actionNumber, QWidget *parent, const char *name):QWidget(parent) , mpActionLabel(NULL) , mpTeacherLabel(NULL) diff --git a/src/gui/UBTeacherBarWidget.h b/src/gui/UBTeacherBarWidget.h index 555b6ef6..3f18bcbe 100644 --- a/src/gui/UBTeacherBarWidget.h +++ b/src/gui/UBTeacherBarWidget.h @@ -48,6 +48,8 @@ private slots: void saveContent(); void loadContent(); void onValueChanged(); + void onTitleTextChanged(const QString& text); + void onEquipmentTextChanged(const QString& text); private: void populateCombos();