Commit f16c06f9 authored by shibakaneki's avatar shibakaneki

backup

parent 0dd72f68
#include "UBExportCFF.h"
#include "UBCFFAdaptor.h"
#include "document/UBDocumentProxy.h"
#include "core/UBDocumentManager.h"
#include "core/UBApplication.h"
UBExportCFF::UBExportCFF(QObject *parent)
: UBExportAdaptor(parent)
{
}
UBExportCFF::~UBExportCFF()
{
}
QString UBExportCFF::exportName()
{
return tr("Export to IWB");
}
QString UBExportCFF::exportExtention()
{
return QString(".iwb");
}
void UBExportCFF::persist(UBDocumentProxy* pDocument)
{
QString src = pDocument->persistencePath();
if (!pDocument)
return;
QString filename = askForFileName(pDocument, tr("Export as IWB File"));
if (filename.length() > 0)
{
QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
if (mIsVerbose)
UBApplication::showMessage(tr("Exporting document..."));
UBCFFAdaptor toIWBExporter;
if (toIWBExporter.convertUBZToIWB(src, filename))
{
if (mIsVerbose)
UBApplication::showMessage(tr("Export successful."));
}
else
if (mIsVerbose)
UBApplication::showMessage(tr("Export failed."));
QApplication::restoreOverrideCursor();
}
}
\ No newline at end of file
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBExportCFF_H_
#define UBExportCFF_H_
#include <QtCore>
#include "UBExportAdaptor.h"
#include "frameworks/UBFileSystemUtils.h"
class UBDocumentProxy;
class UBExportCFF : public UBExportAdaptor
{
Q_OBJECT;
public:
UBExportCFF(QObject *parent = 0);
virtual ~UBExportCFF();
virtual QString exportName();
virtual QString exportExtention();
virtual void persist(UBDocumentProxy* pDocument);
};
#endif /* UBExportCFF_H_ */
\ No newline at end of file
This diff is collapsed.
......@@ -134,6 +134,8 @@ class UBSvgSubsetAdaptor
void graphicsItemFromSvg(QGraphicsItem* gItem);
qreal getZValueFromSvg();
QXmlStreamReader mXmlReader;
int mFileVersion;
UBDocumentProxy *mProxy;
......
......@@ -14,6 +14,7 @@ HEADERS += src/adaptors/UBExportAdaptor.h\
src/adaptors/UBExportWeb.h \
src/adaptors/UBWebPublisher.h \
src/adaptors/UBImportCFF.h \
src/adaptors/UBExportCFF.h \
src/adaptors/UBCFFSubsetAdaptor.h
HEADERS += src/adaptors/publishing/UBDocumentPublisher.h \
......@@ -36,6 +37,7 @@ SOURCES += src/adaptors/UBExportAdaptor.cpp\
src/adaptors/UBExportWeb.cpp \
src/adaptors/UBWebPublisher.cpp \
src/adaptors/UBImportCFF.cpp \
src/adaptors/UBExportCFF.cpp \
src/adaptors/UBCFFSubsetAdaptor.cpp \
src/adaptors/publishing/UBDocumentPublisher.cpp
......
......@@ -664,6 +664,7 @@ void UBBoardController::zoom(const qreal ratio, QPointF scenePoint)
UBApplication::applicationController->adjustDisplayView();
emit controlViewportChanged();
mActiveScene->setBackgroundZoomFactor(mControlView->transform().m11());
}
......@@ -1163,7 +1164,7 @@ void UBBoardController::setActiveDocumentScene(UBDocumentProxy* pDocumentProxy,
mControlView->setScene(mActiveScene);
mDisplayView->setScene(mActiveScene);
mActiveScene->setBackgroundZoomFactor(mControlView->transform().m11());
pDocumentProxy->setDefaultDocumentSize(mActiveScene->nominalSize());
updatePageSizeState();
......@@ -1564,7 +1565,7 @@ void UBBoardController::updateSystemScaleFactor()
mControlView->setTransform(scalingTransform);
mControlView->horizontalScrollBar()->setValue(viewState.horizontalPosition);
mControlView->verticalScrollBar()->setValue(viewState.verticalPostition);
}
mActiveScene->setBackgroundZoomFactor(mControlView->transform().m11());}
void UBBoardController::setWidePageSize(bool checked)
......@@ -1943,8 +1944,6 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
if (gi)
{
// gi->setZValue(mActiveScene->getNextObjectZIndex());
UBGraphicsItem::assignZValue(gi, mActiveScene->getNextObjectZIndex());
mActiveScene->addItem(gi);
gi->setPos(gi->pos() + QPointF(50, 50));
}
......
......@@ -54,6 +54,7 @@
#include "tools/UBGraphicsCompass.h"
#include "tools/UBGraphicsCache.h"
#include "tools/UBGraphicsTriangle.h"
#include "core/memcheck.h"
......@@ -425,7 +426,8 @@ UBBoardView::mousePressEvent (QMouseEvent *event)
|| movingItem->type() == UBGraphicsCompass::Type
|| movingItem->type() == UBGraphicsPDFItem::Type
|| movingItem->type() == UBGraphicsPolygonItem::Type
|| movingItem->type() == UBGraphicsCache::Type)
|| movingItem->type() == UBGraphicsCache::Type
|| movingItem->type() == UBGraphicsTriangle::Type)
{
movingItem = NULL;
QGraphicsView::mousePressEvent (event);
......
......@@ -62,7 +62,7 @@ struct UBSize
};
};
// Deprecated. Keep it for backward campability with old versions
struct UBItemLayerType
{
enum Enum
......@@ -71,17 +71,38 @@ struct UBItemLayerType
};
};
struct itemLayerType
{
enum Enum {
NoLayer = 0
, BackgroundItem
, ObjectItem
, DrawingItem
, ToolItem
, CppTool
, Eraiser
, Curtain
, Pointer
, Cache
, SelectedItem
};
};
struct UBGraphicsItemData
{
enum Enum
{
ItemLayerType
ItemLayerType //Deprecated. Keep it for backward campability with old versions. Use itemLayerType instead
, ItemLocked
, ItemEditable//for text only
, ItemOwnZValue
, itemLayerType //use instead of deprecated ItemLayerType
};
};
struct UBGraphicsItemType
{
enum Enum
......
......@@ -289,7 +289,6 @@ int UBApplication::exec(const QString& pFileToImport)
bool bUseMultiScreen = UBSettings::settings()->appUseMultiscreen->get().toBool();
mainWindow->actionMultiScreen->setChecked(bUseMultiScreen);
applicationController->useMultiScreen(bUseMultiScreen);
connect(mainWindow->actionMultiScreen, SIGNAL(triggered(bool)), applicationController, SLOT(useMultiScreen(bool)));
connect(mainWindow->actionWidePageSize, SIGNAL(triggered(bool)), boardController, SLOT(setWidePageSize(bool)));
connect(mainWindow->actionRegularPageSize, SIGNAL(triggered(bool)), boardController, SLOT(setRegularPageSize(bool)));
......@@ -299,7 +298,7 @@ int UBApplication::exec(const QString& pFileToImport)
connect(mainWindow->actionCopy, SIGNAL(triggered()), applicationController, SLOT(actionCopy()));
connect(mainWindow->actionPaste, SIGNAL(triggered()), applicationController, SLOT(actionPaste()));
applicationController->initScreenLayout();
applicationController->initScreenLayout(bUseMultiScreen);
boardController->setupLayout();
if (pFileToImport.length() > 0)
......
......@@ -135,14 +135,15 @@ void UBApplicationController::initViewState(int horizontalPosition, int vertical
}
void UBApplicationController::initScreenLayout()
void UBApplicationController::initScreenLayout(bool useMultiscreen)
{
mDisplayManager->setAsControl(mMainWindow, true);
mDisplayManager->setAsDisplay(mDisplayView);
mDisplayManager->setControlWidget(mMainWindow);
mDisplayManager->setDisplayWidget(mDisplayView);
mDisplayManager->setAsPreviousDisplays(mPreviousViews);
mDisplayManager->setAsDesktop(mUninoteController->drawingView());
mDisplayManager->setPreviousDisplaysWidgets(mPreviousViews);
mDisplayManager->setDesktopWidget(mUninoteController->drawingView());
mDisplayManager->setUseMultiScreen(useMultiscreen);
mDisplayManager->adjustScreens(-1);
}
......@@ -343,7 +344,6 @@ void UBApplicationController::showBoard()
mirroringEnabled(false);
mMainWindow->switchToBoardWidget();
mDisplayManager->setAsDisplay(mDisplayView);
if (UBApplication::boardController)
UBApplication::boardController->show();
......@@ -353,7 +353,7 @@ void UBApplicationController::showBoard()
mUninoteController->hideWindow();
mDisplayManager->adjustScreens(0);
mMainWindow->show();
emit mainModeChanged(Board);
......@@ -637,12 +637,12 @@ void UBApplicationController::mirroringEnabled(bool enabled)
if (enabled)
{
mMirror->start();
mDisplayManager->setAsDisplay(mMirror);
mDisplayManager->setDisplayWidget(mMirror);
}
else
{
mDisplayManager->setAsDisplay(mDisplayView);
mDisplayManager->setDisplayWidget(mDisplayView);
mMirror->stop();
}
......@@ -652,7 +652,7 @@ void UBApplicationController::mirroringEnabled(bool enabled)
}
else
{
mDisplayManager->setAsDisplay(mDisplayView);
mDisplayManager->setDisplayWidget(mDisplayView);
}
}
......@@ -727,6 +727,7 @@ void UBApplicationController::importFile(const QString& pFilePath)
void UBApplicationController::useMultiScreen(bool use)
{
mDisplayManager->setUseMultiScreen(use);
mDisplayManager->adjustScreens(0);
UBSettings::settings()->appUseMultiscreen->set(use);
}
......
......@@ -51,7 +51,7 @@ class UBApplicationController : public QObject
void blackout();
void initScreenLayout();
void initScreenLayout(bool useMultiscreen);
void closing();
......
......@@ -118,16 +118,11 @@ int UBDisplayManager::numPreviousViews()
}
void UBDisplayManager::setAsControl(QWidget* pControlWidget, bool init)
void UBDisplayManager::setControlWidget(QWidget* pControlWidget)
{
if(hasControl() && pControlWidget && (pControlWidget != mControlWidget))
{
mControlWidget = pControlWidget;
mControlWidget->hide();
mControlWidget->setGeometry(mDesktop->screenGeometry(mControlScreenIndex));
if (!init)
mControlWidget->showFullScreen();
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
// mControlWidget->setAttribute(Qt::WA_MacNoShadow);
......@@ -135,14 +130,11 @@ void UBDisplayManager::setAsControl(QWidget* pControlWidget, bool init)
}
}
void UBDisplayManager::setAsDesktop(QWidget* pControlWidget )
void UBDisplayManager::setDesktopWidget(QWidget* pControlWidget )
{
if(pControlWidget && (pControlWidget != mControlWidget))
{
mDesktopWidget = pControlWidget;
mDesktopWidget->hide();
mDesktopWidget->setGeometry(mDesktop->screenGeometry(mControlScreenIndex));
// mDisplayWidget->showFullScreen();
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
// mControlWidget->setAttribute(Qt::WA_MacNoShadow);
......@@ -150,14 +142,11 @@ void UBDisplayManager::setAsDesktop(QWidget* pControlWidget )
}
}
void UBDisplayManager::setAsDisplay(QWidget* pDisplayWidget)
void UBDisplayManager::setDisplayWidget(QWidget* pDisplayWidget)
{
if(pDisplayWidget && (pDisplayWidget != mDisplayWidget))
{
mDisplayWidget = pDisplayWidget;
mDisplayWidget->hide();
mDisplayWidget->setGeometry(mDesktop->screenGeometry(mDisplayScreenIndex));
mDisplayWidget->showFullScreen();
// !!!! Should be included into Windows after QT recompilation
#ifdef Q_WS_MAC
// mDisplayWidget->setAttribute(Qt::WA_MacNoShadow);
......@@ -166,7 +155,7 @@ void UBDisplayManager::setAsDisplay(QWidget* pDisplayWidget)
}
void UBDisplayManager::setAsPreviousDisplays(QList<UBBoardView*> pPreviousViews)
void UBDisplayManager::setPreviousDisplaysWidgets(QList<UBBoardView*> pPreviousViews)
{
mPreviousDisplayWidgets = pPreviousViews;
}
......@@ -182,7 +171,7 @@ QRect UBDisplayManager::displayGeometry()
return mDesktop->screenGeometry(mDisplayScreenIndex);
}
void UBDisplayManager::swapScreens(bool swap)
void UBDisplayManager::reinitScreens(bool swap)
{
Q_UNUSED(swap);
adjustScreens(-1);
......@@ -310,6 +299,5 @@ void UBDisplayManager::setRoleToScreen(DisplayRole role, int screenIndex)
void UBDisplayManager::setUseMultiScreen(bool pUse)
{
mUseMultiScreen = pUse;
adjustScreens(0);
}
......@@ -33,13 +33,13 @@ class UBDisplayManager : public QObject
int numPreviousViews();
void setAsControl(QWidget* pControlWidget, bool init = false);
void setControlWidget(QWidget* pControlWidget);
void setAsDisplay(QWidget* pDisplayWidget);
void setDisplayWidget(QWidget* pDisplayWidget);
void setAsDesktop(QWidget* pControlWidget);
void setDesktopWidget(QWidget* pControlWidget);
void setAsPreviousDisplays(QList<UBBoardView*> pPreviousViews);
void setPreviousDisplaysWidgets(QList<UBBoardView*> pPreviousViews);
bool hasControl()
{
......@@ -77,7 +77,7 @@ class UBDisplayManager : public QObject
public slots:
void swapScreens(bool bswap);
void reinitScreens(bool bswap);
void adjustScreens(int screen);
......
......@@ -21,6 +21,7 @@
#include "adaptors/UBExportFullPDF.h"
#include "adaptors/UBExportDocument.h"
#include "adaptors/UBExportWeb.h"
#include "adaptors/UBExportCFF.h"
#include "adaptors/UBWebPublisher.h"
#include "adaptors/UBImportDocument.h"
#include "adaptors/UBImportPDF.h"
......@@ -62,6 +63,8 @@ UBDocumentManager::UBDocumentManager(QObject *parent)
QString dummyObjects = tr("objects");
QString dummyWidgets = tr("widgets");
UBExportCFF* cffExporter = new UBExportCFF(this);
mExportAdaptors.append(cffExporter);
UBExportFullPDF* exportFullPdf = new UBExportFullPDF(this);
mExportAdaptors.append(exportFullPdf);
UBExportDocument* exportDocument = new UBExportDocument(this);
......
......@@ -118,7 +118,7 @@ void UBPreferencesController::wire()
connect(mPreferencesUI->useExternalBrowserCheckBox, SIGNAL(clicked(bool)), settings->webUseExternalBrowser, SLOT(setBool(bool)));
connect(mPreferencesUI->displayBrowserPageCheckBox, SIGNAL(clicked(bool)), settings->webShowPageImmediatelyOnMirroredScreen, SLOT(setBool(bool)));
connect(mPreferencesUI->swapControlAndDisplayScreensCheckBox, SIGNAL(clicked(bool)), settings->swapControlAndDisplayScreens, SLOT(setBool(bool)));
connect(mPreferencesUI->swapControlAndDisplayScreensCheckBox, SIGNAL(clicked(bool)), UBApplication::applicationController->displayManager(), SLOT(swapScreens(bool)));
connect(mPreferencesUI->swapControlAndDisplayScreensCheckBox, SIGNAL(clicked(bool)), UBApplication::applicationController->displayManager(), SLOT(reinitScreens(bool)));
connect(mPreferencesUI->toolbarAtTopRadioButton, SIGNAL(clicked(bool)), this, SLOT(toolbarPositionChanged(bool)));
connect(mPreferencesUI->toolbarAtBottomRadioButton, SIGNAL(clicked(bool)), this, SLOT(toolbarPositionChanged(bool)));
......
......@@ -88,6 +88,7 @@ UBDesktopAnnotationController::UBDesktopAnnotationController(QObject *parent)
mTransparentDrawingScene = new UBGraphicsScene(0);
mTransparentDrawingView->setScene(mTransparentDrawingScene);
mTransparentDrawingScene->setDrawingMode(true);
// mRightPalette = UBApplication::boardController->paletteManager()->createDesktopRightPalette(mTransparentDrawingView);
//mRightPalette = new UBRightPalette(mTransparentDrawingView);
......
......@@ -64,6 +64,8 @@ UBGraphicsAudioItem::UBGraphicsAudioItem(const QUrl& pAudioFileUrl, QGraphicsIte
mDelegate->frame()->setOperationMode ( UBGraphicsDelegateFrame::Resizing );
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
}
void UBGraphicsAudioItem::onStateChanged(Phonon::State newState, Phonon::State oldState)
......@@ -95,8 +97,6 @@ UBItem* UBGraphicsAudioItem::deepCopy() const
UBGraphicsAudioItem *copy = new UBGraphicsAudioItem(audioUrl, parentItem());
copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
......@@ -73,29 +73,33 @@ void UBGraphicsItemDelegate::init()
{
mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio);
mFrame->hide();
// mFrame->setZValue(UBGraphicsScene::toolLayerStart + 1);
UBGraphicsItem::assignZValue(mFrame, UBGraphicsScene::toolLayerStart + 1);
mFrame->setFlag(QGraphicsItem::ItemIsSelectable, true);
mDeleteButton = new DelegateButton(":/images/close.svg", mDelegated, mFrame);
mDeleteButton = new DelegateButton(":/images/close.svg", mDelegated, mFrame, Qt::TopLeftSection);
mButtons << mDeleteButton;
connect(mDeleteButton, SIGNAL(clicked()), this, SLOT(remove()));
if (canDuplicate()){
mDuplicateButton = new DelegateButton(":/images/duplicate.svg", mDelegated, mFrame);
mDuplicateButton = new DelegateButton(":/images/duplicate.svg", mDelegated, mFrame, Qt::TopLeftSection);
connect(mDuplicateButton, SIGNAL(clicked(bool)), this, SLOT(duplicate()));
mButtons << mDuplicateButton;
}
mMenuButton = new DelegateButton(":/images/menu.svg", mDelegated, mFrame);
mMenuButton = new DelegateButton(":/images/menu.svg", mDelegated, mFrame, Qt::TopLeftSection);
connect(mMenuButton, SIGNAL(clicked()), this, SLOT(showMenu()));
mButtons << mMenuButton;
mZOrderUpButton = new DelegateButton(":/images/plus.svg", mDelegated, mFrame, Qt::BottomLeftSection);
connect(mZOrderUpButton, SIGNAL(clicked()), this, SLOT(increaseZLevel()));
mButtons << mZOrderUpButton;
mZOrderDownButton = new DelegateButton(":/images/minus.svg", mDelegated, mFrame, Qt::BottomLeftSection);
connect(mZOrderDownButton, SIGNAL(clicked()), this, SLOT(decreaseZLevel()));
mButtons << mZOrderDownButton;
buildButtons();
foreach(DelegateButton* button, mButtons)
{
button->hide();
// button->setZValue(UBGraphicsScene::toolLayerStart + 2);
UBGraphicsItem::assignZValue(button, UBGraphicsScene::toolLayerStart + 2);
button->setFlag(QGraphicsItem::ItemIsSelectable, true);
}
}
......@@ -160,18 +164,9 @@ bool UBGraphicsItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (!mDelegated->isSelected())
{
mDelegated->setSelected(true);
UBGraphicsScene* scene = static_cast<UBGraphicsScene*>(mDelegated->scene());
qDebug() << mDelegated->zValue();
qDebug() << scene->currentObjectZIndex();
// To investigate. Z value behavior
// if (mDelegated->zValue() < scene->currentObjectZIndex() && !isLocked())
// mDelegated->setZValue(scene->getNextObjectZIndex());
positionHandles();
return true;
}
else
......@@ -239,12 +234,13 @@ void UBGraphicsItemDelegate::positionHandles()
mDeleteButton->setTransform(tr);
qreal topX = mFrame->rect().left()- mDeleteButton->renderer()->viewBox().width() * mAntiScaleRatio / 2;
qreal topY = mFrame->rect().top() - mDeleteButton->renderer()->viewBox().height() * mAntiScaleRatio / 2;
// This is where the position of the buttons is calculated. It starts always on the topleft of mFrame!
qreal x = mFrame->rect().left()- mDeleteButton->renderer()->viewBox().width() * mAntiScaleRatio / 2;
qreal y = mFrame->rect().top() - mDeleteButton->renderer()->viewBox().height() * mAntiScaleRatio / 2;
qreal bottomX = mFrame->rect().left()- mDeleteButton->renderer()->viewBox().width() * mAntiScaleRatio / 2;
qreal bottomY = mFrame->rect().bottom() - mDeleteButton->renderer()->viewBox().height() * mAntiScaleRatio / 2;
mDeleteButton->setPos(x, y);
mDeleteButton->setPos(topX, topY);
if (!mDeleteButton->scene())
{
......@@ -262,13 +258,19 @@ void UBGraphicsItemDelegate::positionHandles()
lock(isLocked());
for(int i = 1 ; i < mButtons.length(); i++)
{
DelegateButton* button = mButtons[i];
int i = 1, j = 0, k = 0;
while ((i + j) < mButtons.size()) {
DelegateButton* button = mButtons[i + j];
button->setTransform(tr);
button->setPos(x + (i * 1.6 * mFrameWidth * mAntiScaleRatio), y);
if (button->getSection() == Qt::TopLeftSection) {
button->setPos(topX + (i++ * 1.6 * mFrameWidth * mAntiScaleRatio), topY);
} else if (button->getSection() == Qt::BottomLeftSection) {
button->setPos(bottomX + (++j * 1.6 * mFrameWidth * mAntiScaleRatio), bottomY);
} else if (button->getSection() == Qt::NoSection) {
++k;
}
if (!button->scene())
{
......@@ -278,11 +280,10 @@ void UBGraphicsItemDelegate::positionHandles()
}
if(!mFrame->isResizing()){
button->show();
button->setZValue(delegated()->zValue());
}
}
}
else
{
} else {
foreach(DelegateButton* button, mButtons)
button->hide();
......@@ -325,7 +326,19 @@ void UBGraphicsItemDelegate::duplicate()
UBApplication::boardController->copy();
UBApplication::boardController->paste();
}
void UBGraphicsItemDelegate::increaseZLevel(int delta)
{
qDebug() << delegated()->scene()->items().count();
// UBGraphicsItem::assignZValue(delegated(), )
// int valueCandidate = delegated()->data(UBGraphicsItemData::ItemOwnZValue).toInt();
// if (delta < 0) {
// } else if (delta > 0) {
// }
}
void UBGraphicsItemDelegate::lock(bool locked)
{
......
......@@ -33,10 +33,11 @@ class DelegateButton: public QGraphicsSvgItem
Q_OBJECT
public:
DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0)
DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection)
: QGraphicsSvgItem(fileName, parent)
, mDelegated(pDelegated)
, mIsTransparentToMouseEvent(false)
, mButtonAlignmentSection(section)
{
setAcceptedMouseButtons(Qt::LeftButton);
setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
......@@ -57,6 +58,9 @@ class DelegateButton: public QGraphicsSvgItem
QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this));
}
void setSection(Qt::WindowFrameSection section) {mButtonAlignmentSection = section;}
Qt::WindowFrameSection getSection() const {return mButtonAlignmentSection;}
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
......@@ -80,7 +84,9 @@ class DelegateButton: public QGraphicsSvgItem
QGraphicsItem* mDelegated;
bool mIsTransparentToMouseEvent;
Qt::WindowFrameSection mButtonAlignmentSection;
signals:
void clicked (bool checked = false);
......@@ -147,6 +153,9 @@ class UBGraphicsItemDelegate : public QObject
virtual void lock(bool lock);
virtual void duplicate();
virtual void increaseZLevel() {increaseZLevel(1);}
virtual void decreaseZLevel() {increaseZLevel(-1);}
protected:
virtual void buildButtons() {;}
virtual void decorateMenu(QMenu *menu);
......@@ -154,10 +163,15 @@ class UBGraphicsItemDelegate : public QObject
QGraphicsItem* mDelegated;
//buttons from the top left section of delegate frame
DelegateButton* mDeleteButton;
DelegateButton* mDuplicateButton;
DelegateButton* mMenuButton;
//buttons from the bottom left section of delegate frame
DelegateButton *mZOrderUpButton;
DelegateButton *mZOrderDownButton;
QMenu* mMenu;
QAction* mLockAction;
......@@ -176,6 +190,8 @@ protected slots:
private:
virtual void increaseZLevel(int delta);
QPointF mOffset;
QTransform mPreviousTransform;
QPointF mPreviousPosition;
......
......@@ -26,7 +26,8 @@
UBGraphicsPDFItem::UBGraphicsPDFItem(PDFRenderer *renderer, int pageNumber, QGraphicsItem* parent)
: GraphicsPDFItem(renderer, pageNumber, parent)
{
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object); //deprecated
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::BackgroundItem)); //Necessary to set if we want z value to be assigned correctly
mDelegate = new UBGraphicsItemDelegate(this,0);
mDelegate->init();
}
......@@ -84,8 +85,6 @@ UBItem* UBGraphicsPDFItem::deepCopy() const
UBGraphicsPDFItem *copy = new UBGraphicsPDFItem(mRenderer, mPageNumber, parentItem());
copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......@@ -135,8 +134,6 @@ UBGraphicsPixmapItem* UBGraphicsPDFItem::toPixmapItem() const
pixmapItem->setPixmap(pixmap);
pixmapItem->setPos(this->pos());
// pixmapItem->setZValue(this->zValue());
UBGraphicsItem::assignZValue(pixmapItem, this->zValue());
pixmapItem->setTransform(this->transform());
pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true);
pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
......@@ -37,6 +37,7 @@ UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
setTransformationMode(Qt::SmoothTransformation);
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);
}
......@@ -102,8 +103,6 @@ UBItem* UBGraphicsPixmapItem::deepCopy() const
copy->setPixmap(this->pixmap());
copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
......@@ -30,6 +30,7 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (QGraphicsItem * parent)
, mStroke(0)
{
// NOOP
initialize();
}
......@@ -40,6 +41,7 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QPolygonF & polygon, QGraphi
, mStroke(0)
{
// NOOP
initialize();
}
......@@ -51,6 +53,12 @@ UBGraphicsPolygonItem::UBGraphicsPolygonItem (const QLineF& pLine, qreal pWidth)
, mStroke(0)
{
// NOOP
initialize();
}
void UBGraphicsPolygonItem::initialize()
{
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::DrawingItem)); //Necessary to set if we want z value to be assigned correctly
}
void UBGraphicsPolygonItem::clearStroke()
......@@ -153,9 +161,6 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con
copy->setPen(this->pen());
copy->mHasAlpha = this->mHasAlpha;
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setColorOnDarkBackground(this->colorOnDarkBackground());
copy->setColorOnLightBackground(this->colorOnLightBackground());
......
......@@ -35,6 +35,8 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
~UBGraphicsPolygonItem();
void initialize();
void setColor(const QColor& color);
QColor color() const;
......
This diff is collapsed.
......@@ -25,7 +25,6 @@
#include "UBItem.h"
#include "tools/UBGraphicsCurtainItem.h"
class UBGraphicsPixmapItem;
class UBGraphicsProxyWidget;
class UBGraphicsSvgItem;
......@@ -50,11 +49,41 @@ class UBGraphicsCache;
const double PI = 4.0 * atan(1.0);
class UBZLayerController
{
public:
struct ItemLayerTypeData {
ItemLayerTypeData() : bottomLimit(0), topLimit(0), curValue(0) {;}
ItemLayerTypeData(qreal bot, qreal top) : bottomLimit(bot), topLimit(top), curValue(bot) {;}
qreal bottomLimit;
qreal topLimit;
qreal curValue;
};
typedef QMap<itemLayerType::Enum, ItemLayerTypeData> ScopeMap;
UBZLayerController();
qreal getBottomLimit(itemLayerType::Enum key) const {return scopeMap.value(key).bottomLimit;}
qreal getTopLimit(itemLayerType::Enum key) const {return scopeMap.value(key).topLimit;}
bool validLayerType(itemLayerType::Enum key) const {return scopeMap.contains(key);}
static qreal errorNum() {return errorNumber;}
qreal generateZLevel(itemLayerType::Enum key);
private:
ScopeMap scopeMap;
static qreal errorNumber;
};
class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
{
Q_OBJECT
public:
// tmp stub for divide addings scene objects from undo mechanism implementation
void setURStackEnable(bool set = true) {enableUndoRedoStack = set;}
......@@ -152,23 +181,11 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
return mCrossedBackground;
}
void setDrawingZIndex(qreal pDrawingZIndex)
{
mDrawingZIndex = pDrawingZIndex;
}
void setObjectZIndex(qreal pObjectZIndex)
{
mObjectZIndex = pObjectZIndex;
}
bool hasBackground()
{
return (mBackgroundObject != 0);
}
qreal getNextObjectZIndex();
void addRuler(QPointF center);
void addProtractor(QPointF center);
void addCompass(QPointF center);
......@@ -225,11 +242,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void setNominalSize(int pWidth, int pHeight);
qreal currentObjectZIndex()
{
return mObjectZIndex;
}
enum RenderingContext
{
Screen = 0, NonScreen, PdfExport, Podcast
......@@ -276,7 +288,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void hideEraser();
void setBackground(bool pIsDark, bool pIsCrossed);
void setBackgroundZoomFactor(qreal zoom);
void setDrawingMode(bool bModeDesktop);
void deselectAllItems();
UBGraphicsPixmapItem* addPixmap(const QPixmap& pPixmap, const QPointF& pPos = QPointF(0,0), qreal scaleFactor = 1.0, bool pUseAnimation = false);
......@@ -314,18 +327,19 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void recolorAllItems();
qreal getNextDrawingZIndex();
virtual void drawItems (QPainter * painter, int numItems,
virtual void drawItems (QPainter * painter, int numItems,
QGraphicsItem * items[], const QStyleOptionGraphicsItem options[], QWidget * widget = 0);
QGraphicsItem* rootItem(QGraphicsItem* item) const;
virtual void drawBackground(QPainter *painter, const QRectF &rect);
private:
void setDocumentUpdated();
void createEraiser();
void createPointer();
qreal mDrawingZIndex;
qreal mObjectZIndex;
qreal generateZLevel(QGraphicsItem *item);
QGraphicsEllipseItem* mEraser;
QGraphicsEllipseItem* mPointer;
......@@ -337,6 +351,8 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
bool mDarkBackground;
bool mCrossedBackground;
bool mIsDesktopMode;
qreal mZoomFactor;
bool mIsModified;
......@@ -376,7 +392,10 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
UBMagnifier *magniferControlViewWidget;
UBMagnifier *magniferDisplayViewWidget;
UBZLayerController mZLayerController;
};
#endif /* UBGRAPHICSSCENE_H_ */
......@@ -37,7 +37,6 @@ UBGraphicsSvgItem::UBGraphicsSvgItem(const QString& pFilePath, QGraphicsItem* pa
}
}
UBGraphicsSvgItem::UBGraphicsSvgItem(const QByteArray& pFileData, QGraphicsItem* parent)
: QGraphicsSvgItem(parent)
{
......@@ -61,6 +60,8 @@ void UBGraphicsSvgItem::init()
setCacheMode(QGraphicsItem::DeviceCoordinateCache);
setMaximumCacheSize(boundingRect().size().toSize() * UB_MAX_ZOOM);
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
}
......@@ -132,8 +133,6 @@ UBItem* UBGraphicsSvgItem::deepCopy() const
UBGraphicsSvgItem* copy = new UBGraphicsSvgItem(this->fileData());
copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......@@ -187,8 +186,6 @@ UBGraphicsPixmapItem* UBGraphicsSvgItem::toPixmapItem() const
pixmapItem->setPixmap(QPixmap::fromImage(image));
pixmapItem->setPos(this->pos());
// pixmapItem->setZValue(this->zValue());
UBGraphicsItem::assignZValue(pixmapItem, this->zValue());
pixmapItem->setTransform(this->transform());
pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true);
pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
......@@ -40,23 +40,11 @@ UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
mTypeTextHereLabel = tr("<Type Text Here>");
// if (lastUsedTextColor.isValid())
// {
// setDefaultTextColor(lastUsedTextColor);
// setColorOnDarkBackground(lastUsedTextColor);
// setColorOnLightBackground(lastUsedTextColor);
// }
// else
// {
// QColor colorOnDarkBG = UBApplication::boardController->penColorOnDarkBackground();
// QColor colorOnLightBG = UBApplication::boardController->penColorOnLightBackground();
// setColorOnDarkBackground(colorOnDarkBG);
// setColorOnLightBackground(colorOnLightBG);
// }
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
// setData(UBGraphicsItemData::ItemEditable, QVariant(true));
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
setFlag(QGraphicsItem::ItemIsSelectable, true);
// setFlag(QGraphicsItem::ItemIsMovable, true);
......@@ -205,8 +193,6 @@ UBItem* UBGraphicsTextItem::deepCopy() const
copy->setHtml(toHtml());
copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
......@@ -96,10 +96,10 @@ void UBGraphicsTextItemDelegate::buildButtons()
{
UBGraphicsItemDelegate::buildButtons();
mFontButton = new DelegateButton(":/images/font.svg", mDelegated, mFrame);
mColorButton = new DelegateButton(":/images/color.svg", mDelegated, mFrame);
mDecreaseSizeButton = new DelegateButton(":/images/minus.svg", mDelegated, mFrame);
mIncreaseSizeButton = new DelegateButton(":/images/plus.svg", mDelegated, mFrame);
mFontButton = new DelegateButton(":/images/font.svg", mDelegated, mFrame, Qt::TopLeftSection);
mColorButton = new DelegateButton(":/images/color.svg", mDelegated, mFrame, Qt::TopLeftSection);
mDecreaseSizeButton = new DelegateButton(":/images/minus.svg", mDelegated, mFrame, Qt::TopLeftSection);
mIncreaseSizeButton = new DelegateButton(":/images/plus.svg", mDelegated, mFrame, Qt::TopLeftSection);
connect(mFontButton, SIGNAL(clicked(bool)), this, SLOT(pickFont()));
connect(mColorButton, SIGNAL(clicked(bool)), this, SLOT(pickColor()));
......
......@@ -51,6 +51,8 @@ UBGraphicsVideoItem::UBGraphicsVideoItem(const QUrl& pVideoFileUrl, QGraphicsIte
mDelegate->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
connect(mDelegate, SIGNAL(showOnDisplayChanged(bool)), this, SLOT(showOnDisplayChanged(bool)));
connect(mMediaObject, SIGNAL(hasVideoChanged(bool)), this, SLOT(hasVideoChanged(bool)));
}
......@@ -68,8 +70,6 @@ UBItem* UBGraphicsVideoItem::deepCopy() const
UBGraphicsVideoItem *copy = new UBGraphicsVideoItem(videoUrl, parentItem());
copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
......@@ -52,8 +52,7 @@ void UBGraphicsVideoItemDelegate::buildButtons()
mMuteButton->hide();
mVideoControl = new DelegateVideoControl(delegated(), mFrame);
// mVideoControl->setZValue(UBGraphicsScene::toolLayerStart + 2);
UBGraphicsItem::assignZValue(mVideoControl, UBGraphicsScene::toolLayerStart + 2);
UBGraphicsItem::assignZValue(mVideoControl, delegated()->zValue());
mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true);
connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause()));
......@@ -106,6 +105,7 @@ void UBGraphicsVideoItemDelegate::positionHandles()
}
mVideoControl->setAntiScale(mAntiScaleRatio);
mVideoControl->setZValue(delegated()->zValue());
mVideoControl->show();
}
else
......
......@@ -39,6 +39,7 @@ UBGraphicsWidgetItem::UBGraphicsWidgetItem(QGraphicsItem *parent, int widgetType
UBGraphicsWidgetItemDelegate* delegate = new UBGraphicsWidgetItemDelegate(this, widgetType);
delegate->init();
setDelegate(delegate);
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
}
......@@ -154,6 +155,8 @@ void UBGraphicsWidgetItem::initialize()
if (mDelegate && mDelegate->frame() && mWebKitWidget->resizable())
mDelegate->frame()->setOperationMode(UBGraphicsDelegateFrame::Resizing);
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
}
......@@ -408,7 +411,6 @@ UBItem* UBGraphicsW3CWidgetItem::deepCopy() const
UBGraphicsW3CWidgetItem *copy = new UBGraphicsW3CWidgetItem(mWebKitWidget->widgetUrl(), parentItem());
copy->setPos(this->pos());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
......@@ -17,6 +17,7 @@
#include <QtGui>
#include "domain/UBGraphicsItemDelegate.h"
#include "core/UB.h"
class UBGraphicsScene;
......
This diff is collapsed.
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBMAGNIFIER_H
#define UBMAGNIFIER_H
#include <QtGui>
class UBMagnifierParams
{
public :
int x;
int y;
qreal zoom;
qreal sizePercentFromScene;
};
class UBMagnifier : public QWidget
{
Q_OBJECT
public:
UBMagnifier(QWidget *parent = 0, bool isInteractive = false);
~UBMagnifier();
void setSize(qreal percentFromScene);
void setZoom(qreal zoom);
void setGrabView(QWidget *view);
void setMoveView(QWidget *view) {mView = view;}
void grabPoint();
void grabPoint(const QPoint &point);
void grabNMove(const QPoint &pGrab, const QPoint &pMove, bool needGrab = true, bool needMove = true);
UBMagnifierParams params;
signals:
void magnifierMoved_Signal(QPoint newPos);
void magnifierClose_Signal();
void magnifierZoomIn_Signal();
void magnifierZoomOut_Signal();
void magnifierResized_Signal(qreal newPercentSize);
protected:
void paintEvent(QPaintEvent *);
void timerEvent(QTimerEvent *);
virtual void mousePressEvent ( QMouseEvent * event );
virtual void mouseMoveEvent ( QMouseEvent * event );
virtual void mouseReleaseEvent ( QMouseEvent * event );
QPoint mMousePressPos;
qreal mMousePressDelta;
bool mShouldMoveWidget;
bool mShouldResizeWidget;
QPixmap *sClosePixmap;
QPixmap *sIncreasePixmap;
QPixmap *sDecreasePixmap;
QPixmap *mResizeItem;
bool isCusrsorAlreadyStored;
QCursor mOldCursor;
QCursor mResizeCursor;
private:
bool inTimer;
bool m_isInteractive;
int timerUpdate;
QPoint updPointGrab;
QPoint updPointMove;
QPixmap pMap;
QBitmap bmpMask;
QPen borderPen;
QWidget *gView;
QWidget *mView;
};
#endif // UBMAGNIFIER_H
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef UBMAGNIFIER_H
#define UBMAGNIFIER_H
#include <QtGui>
class UBMagnifierParams
{
public :
int x;
int y;
qreal zoom;
qreal sizePercentFromScene;
};
class UBMagnifier : public QWidget
{
Q_OBJECT
public:
UBMagnifier(QWidget *parent = 0, bool isInteractive = false);
~UBMagnifier();
void setSize(qreal percentFromScene);
void setZoom(qreal zoom);
void setGrabView(QWidget *view);
void setMoveView(QWidget *view) {mView = view;}
void grabPoint();
void grabPoint(const QPoint &point);
void grabNMove(const QPoint &pGrab, const QPoint &pMove, bool needGrab = true, bool needMove = true);
UBMagnifierParams params;
signals:
void magnifierMoved_Signal(QPoint newPos);
void magnifierClose_Signal();
void magnifierZoomIn_Signal();
void magnifierZoomOut_Signal();
void magnifierResized_Signal(qreal newPercentSize);
public slots:
void slot_refresh();
protected:
void paintEvent(QPaintEvent *);
virtual void mousePressEvent ( QMouseEvent * event );
virtual void mouseMoveEvent ( QMouseEvent * event );
virtual void mouseReleaseEvent ( QMouseEvent * event );
QPoint mMousePressPos;
qreal mMousePressDelta;
bool mShouldMoveWidget;
bool mShouldResizeWidget;
QPixmap *sClosePixmap;
QPixmap *sIncreasePixmap;
QPixmap *sDecreasePixmap;
QPixmap *mResizeItem;
bool isCusrsorAlreadyStored;
QCursor mOldCursor;
QCursor mResizeCursor;
private:
QTimer mRefreshTimer;
bool m_isInteractive;
QPoint updPointGrab;
QPoint updPointMove;
QPixmap pMap;
QBitmap bmpMask;
QPen borderPen;
QWidget *gView;
QWidget *mView;
};
#endif // UBMAGNIFIER_H
......@@ -48,6 +48,7 @@ UBAbstractDrawRuler::UBAbstractDrawRuler()
QDesktopWidget* desktop = UBApplication::desktop();
int dpiCommon = (desktop->physicalDpiX() + desktop->physicalDpiY()) / 2;
sPixelsPerMillimeter = qRound(dpiCommon / 25.4f);//because 1inch = 25.4 mm
}
void UBAbstractDrawRuler::create(QGraphicsItem& item)
......
......@@ -33,14 +33,12 @@ UBGraphicsCache::UBGraphicsCache():QGraphicsRectItem()
// Get the board size and pass it to the shape
QRect boardRect = UBApplication::boardController->displayView()->rect();
setRect(-15*boardRect.width(), -15*boardRect.height(), 30*boardRect.width(), 30*boardRect.height());
// setZValue(CACHE_ZVALUE);
UBGraphicsItem::assignZValue(this, CACHE_ZVALUE);
setData(Qt::UserRole, QVariant("Cache"));
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::Cache)); //Necessary to set if we want z value to be assigned correctly
}
UBGraphicsCache::~UBGraphicsCache()
{
}
UBItem* UBGraphicsCache::deepCopy() const
......@@ -49,8 +47,6 @@ UBItem* UBGraphicsCache::deepCopy() const
copy->setPos(this->pos());
copy->setRect(this->rect());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
// TODO UB 4.7 ... complete all members ?
......@@ -92,8 +88,6 @@ void UBGraphicsCache::paint(QPainter *painter, const QStyleOptionGraphicsItem *o
Q_UNUSED(option);
Q_UNUSED(widget);
UBGraphicsItem::assignZValue(this, CACHE_ZVALUE);
painter->setBrush(mMaskColor);
painter->setPen(mMaskColor);
......
......@@ -21,8 +21,6 @@
#include "domain/UBItem.h"
#include "core/UB.h"
#define CACHE_ZVALUE 100000
typedef enum
{
eMaskShape_Circle,
......
......@@ -70,6 +70,8 @@ UBGraphicsCompass::UBGraphicsCompass()
unsetCursor();
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::CppTool)); //Necessary to set if we want z value to be assigned correctly
connect(UBApplication::boardController, SIGNAL(penColorChanged()), this, SLOT(penColorChanged()));
connect(UBDrawingController::drawingController(), SIGNAL(lineWidthIndexChanged(int)), this, SLOT(lineWidthChanged()));
}
......@@ -85,8 +87,6 @@ UBItem* UBGraphicsCompass::deepCopy() const
copy->setPos(this->pos());
copy->setRect(this->rect());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
// TODO UB 4.7 ... complete all members ?
......
......@@ -49,6 +49,8 @@ UBGraphicsCurtainItem::UBGraphicsCurtainItem(QGraphicsItem* parent)
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Tool);
setPen(Qt::NoPen);
this->setAcceptHoverEvents(true);
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::Curtain)); //Necessary to set if we want z value to be assigned correctly
}
UBGraphicsCurtainItem::~UBGraphicsCurtainItem()
......@@ -58,8 +60,6 @@ UBGraphicsCurtainItem::~UBGraphicsCurtainItem()
QVariant UBGraphicsCurtainItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
// if (change == QGraphicsItem::ItemSelectedHasChanged && QGraphicsRectItem::scene() && isSelected())
// setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCurtain);
QVariant newValue = value;
......@@ -131,8 +131,6 @@ UBItem* UBGraphicsCurtainItem::deepCopy() const
copy->setPos(this->pos());
copy->setBrush(this->brush());
copy->setPen(this->pen());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
......@@ -52,7 +52,6 @@ bool UBGraphicsCurtainItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *ev
if (!mDelegated->isSelected())
{
mDelegated->setSelected(true);
// mDelegated->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCurtain);
positionHandles();
return true;
......
......@@ -63,6 +63,7 @@ UBGraphicsProtractor::UBGraphicsProtractor()
mRotateSvgItem->setVisible(false);
mRotateSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::CppTool)); //Necessary to set if we want z value to be assigned correctly
scale(1.5, 1.5);
}
......@@ -580,8 +581,6 @@ UBItem* UBGraphicsProtractor::deepCopy() const
copy->setPos(this->pos());
copy->setRect(this->rect());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
copy->mCurrentAngle = this->mCurrentAngle;
......
......@@ -44,6 +44,8 @@ UBGraphicsRuler::UBGraphicsRuler()
create(*this);
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::CppTool)); //Necessary to set if we want z value to be assigned correctly
updateResizeCursor();
}
......@@ -74,8 +76,6 @@ UBItem* UBGraphicsRuler::deepCopy() const
copy->setPos(this->pos());
copy->setRect(this->rect());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
// TODO UB 4.7 ... complete all members ?
......
......@@ -43,8 +43,8 @@ UBGraphicsTriangle::UBGraphicsTriangle()
mHFlipSvgItem = new QGraphicsSvgItem(":/images/hflipTool.svg", this);
mHFlipSvgItem->setVisible(false);
mHFlipSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
mHFlipSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
mVFlipSvgItem = new QGraphicsSvgItem(":/images/vflipTool.svg", this);
mVFlipSvgItem->setVisible(false);
......@@ -54,6 +54,8 @@ UBGraphicsTriangle::UBGraphicsTriangle()
mRotateSvgItem->setVisible(false);
mRotateSvgItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::CppTool)); //Necessary to set if we want z value to be assigned correctly
updateResizeCursor();
}
......@@ -93,8 +95,6 @@ UBItem* UBGraphicsTriangle::deepCopy(void) const
copy->setPos(this->pos());
copy->setPolygon(this->polygon());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform());
// TODO UB 4.7 ... complete all members ?
......
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