From 09f1c235e53b70998cb62a8e305e60ff6c6b74af Mon Sep 17 00:00:00 2001 From: Ivan Ilin Date: Fri, 27 Apr 2012 10:36:36 +0300 Subject: [PATCH] Disabling grouping items --- src/board/UBBoardController.cpp | 2 +- src/domain/UBAppleWidget.cpp | 1 - src/domain/UBGraphicsItemDelegate.h | 3 --- src/domain/ubgraphicsgroupcontaineritemdelegate.cpp | 10 ++++++++-- src/domain/ubgraphicsgroupcontaineritemdelegate.h | 5 ++--- src/gui/UBTeacherGuideWidget.cpp | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/board/UBBoardController.cpp b/src/board/UBBoardController.cpp index 612ee6b1..d3faba2b 100644 --- a/src/board/UBBoardController.cpp +++ b/src/board/UBBoardController.cpp @@ -1809,7 +1809,7 @@ UBGraphicsWidgetItem *UBBoardController::addW3cWidget(const QUrl &pUrl, const QP newUrl = QUrl::fromLocalFile(UBPersistenceManager::persistenceManager()->addGraphicsWidgteToDocument(mActiveDocument, pUrl.toLocalFile(), uuid)); - w3cWidgetItem = mActiveScene->addW3CWidget(pUrl, pos); + w3cWidgetItem = mActiveScene->addW3CWidget(newUrl, pos); if (w3cWidgetItem) { w3cWidgetItem->setUuid(uuid); diff --git a/src/domain/UBAppleWidget.cpp b/src/domain/UBAppleWidget.cpp index 19c388da..1ba38151 100644 --- a/src/domain/UBAppleWidget.cpp +++ b/src/domain/UBAppleWidget.cpp @@ -64,7 +64,6 @@ UBAppleWidget::UBAppleWidget(const QUrl& pWidgetUrl, QWidget *parent) mNominalSize = defaultPixmap.size(); } - UBAppleWidget::~UBAppleWidget() { // NOOP diff --git a/src/domain/UBGraphicsItemDelegate.h b/src/domain/UBGraphicsItemDelegate.h index 828f98d1..f560b546 100644 --- a/src/domain/UBGraphicsItemDelegate.h +++ b/src/domain/UBGraphicsItemDelegate.h @@ -184,15 +184,12 @@ class UBGraphicsItemDelegate : public QObject QList mButtons; protected slots: - virtual void gotoContentSource(bool checked); private: void updateFrame(); void updateButtons(bool showUpdated = false); - - QPointF mOffset; QTransform mPreviousTransform; QPointF mPreviousPosition; diff --git a/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp b/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp index 31ce0dfa..ff763520 100644 --- a/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp +++ b/src/domain/ubgraphicsgroupcontaineritemdelegate.cpp @@ -49,10 +49,16 @@ void UBGraphicsGroupContainerItemDelegate::buildButtons() mButtons << mDestroyGroupButton; - connect(mDestroyGroupButton, SIGNAL(clicked()), this, SLOT(destroyGroup())); + connect(mDestroyGroupButton, SIGNAL(clicked()), (UBGraphicsGroupContainerItemDelegate*)this, SLOT(destroyGroup())); } void UBGraphicsGroupContainerItemDelegate::destroyGroup() { - castUBGraphicsScene()->destroyItemGroup(delegated()); + qDebug() << "got an event"; + foreach (QGraphicsItem *item, delegated()->childItems()) { + delegated()->removeFromGroup(item); + item->setFlag(QGraphicsItem::ItemIsSelectable, true); + } + + remove(true); } diff --git a/src/domain/ubgraphicsgroupcontaineritemdelegate.h b/src/domain/ubgraphicsgroupcontaineritemdelegate.h index ad46276a..7160bb00 100644 --- a/src/domain/ubgraphicsgroupcontaineritemdelegate.h +++ b/src/domain/ubgraphicsgroupcontaineritemdelegate.h @@ -7,9 +7,10 @@ class UBGraphicsGroupContainerItem; class UBGraphicsGroupContainerItemDelegate : public UBGraphicsItemDelegate { +Q_OBJECT + public: UBGraphicsGroupContainerItemDelegate(QGraphicsItem* pDelegated, QObject * parent = 0); - UBGraphicsGroupContainerItem *delegated(); protected: @@ -17,8 +18,6 @@ protected: virtual void buildButtons(); - - private slots: void destroyGroup(); diff --git a/src/gui/UBTeacherGuideWidget.cpp b/src/gui/UBTeacherGuideWidget.cpp index d6ca56f2..03ed6e73 100644 --- a/src/gui/UBTeacherGuideWidget.cpp +++ b/src/gui/UBTeacherGuideWidget.cpp @@ -768,7 +768,7 @@ void UBTeacherGuidePageZeroEditionWidget::switchToMode(tUBTGZeroPageMode mode) QStringList licenceIconList; licenceIconList << ":images/licenses/ccby.png" << ":images/licenses/ccbynd.png" << ":images/licenses/ccbysa.png" << ":images/licenses/ccbync.png" << ":images/licenses/ccbyncnd.png" << ":images/licenses/ccbyncsa.png"; if(mpLicenceBox->currentIndex() < 6){ - mpLicenceIcon->setPixmap(licenceIconList.at(mpLicenceBox->currentIndex())); +// mpLicenceIcon->setPixmap(licenceIconList.at(mpLicenceBox->currentIndex())); mpLicenceIcon->show(); } mpLicenceValueLabel->show();