SANKORE-774 - toolbar disabled for all items instead media and text items. It allows to calculate items bounding rect correctly.

preferencesAboutTextFull
Aleksei Kanash 12 years ago
parent 24f8135d25
commit 659e780dbf
  1. 2
      src/domain/UBGraphicsDelegateFrame.cpp
  2. 2
      src/domain/UBGraphicsGroupContainerItemDelegate.cpp
  3. 12
      src/domain/UBGraphicsItemDelegate.cpp
  4. 3
      src/domain/UBGraphicsItemDelegate.h
  5. 2
      src/domain/UBGraphicsPDFItem.cpp
  6. 2
      src/domain/UBGraphicsPixmapItem.cpp
  7. 2
      src/domain/UBGraphicsProxyWidget.cpp
  8. 2
      src/domain/UBGraphicsStrokesGroup.cpp
  9. 2
      src/domain/UBGraphicsSvgItem.cpp
  10. 2
      src/domain/UBGraphicsWidgetItemDelegate.cpp
  11. 2
      src/tools/UBGraphicsCurtainItemDelegate.cpp

@ -582,7 +582,7 @@ void UBGraphicsDelegateFrame::positionHandles()
{
QRectF itemRect = delegated()->boundingRect();
if (mDelegate->getToolBarItem()->isVisibleOnBoard()
if (mDelegate->getToolBarItem() && mDelegate->getToolBarItem()->isVisibleOnBoard()
&& mDelegate->getToolBarItem()->isShifting())
{
QPointF graphicsItemPosition = itemRect.topLeft();

@ -13,7 +13,7 @@
#include "core/memcheck.h"
UBGraphicsGroupContainerItemDelegate::UBGraphicsGroupContainerItemDelegate(QGraphicsItem *pDelegated, QObject *parent) :
UBGraphicsItemDelegate(pDelegated, parent), mDestroyGroupButton(0)
UBGraphicsItemDelegate(pDelegated, parent, true, false, false), mDestroyGroupButton(0)
{

@ -94,7 +94,7 @@ void DelegateButton::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
event->setAccepted(!mIsTransparentToMouseEvent);
}
UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent, bool respectRatio, bool canRotate)
UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent, bool respectRatio, bool canRotate, bool useToolBar)
: QObject(parent)
, mDelegated(pDelegated)
, mDeleteButton(NULL)
@ -113,13 +113,15 @@ UBGraphicsItemDelegate::UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObjec
, mMimeData(NULL)
, mFlippable(false)
, mToolBarItem(NULL)
, mToolBarUsed(useToolBar)
{
// NOOP
}
void UBGraphicsItemDelegate::init()
{
mToolBarItem = new UBGraphicsToolBarItem(mDelegated);
if (mToolBarUsed)
mToolBarItem = new UBGraphicsToolBarItem(mDelegated);
mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio);
mFrame->hide();
@ -334,7 +336,7 @@ void UBGraphicsItemDelegate::positionHandles()
updateButtons(true);
if (mToolBarItem->isVisibleOnBoard())
if (mToolBarItem && mToolBarItem->isVisibleOnBoard())
{
mToolBarItem->positionHandles();
mToolBarItem->update();
@ -345,7 +347,8 @@ void UBGraphicsItemDelegate::positionHandles()
button->hide();
mFrame->hide();
mToolBarItem->hide();
if (mToolBarItem)
mToolBarItem->hide();
}
}
@ -385,7 +388,6 @@ void UBGraphicsItemDelegate::remove(bool canUndo)
scene->removeItem(mFrame);
scene->removeItem(mDelegated);
scene->removeItem(mToolBarItem);
if (canUndo)
{

@ -183,7 +183,7 @@ class UBGraphicsItemDelegate : public QObject
Q_OBJECT
public:
UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent = 0, bool respectRatio = true, bool canRotate = false);
UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent = 0, bool respectRatio = true, bool canRotate = false, bool useToolBar = true);
virtual ~UBGraphicsItemDelegate();
@ -300,6 +300,7 @@ private:
/** A boolean saying that this object can be flippable (mirror effect) */
bool mFlippable;
bool mToolBarUsed;
};

@ -28,7 +28,7 @@ UBGraphicsPDFItem::UBGraphicsPDFItem(PDFRenderer *renderer, int pageNumber, QGra
{
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 = new UBGraphicsItemDelegate(this,0, true, false, false);
mDelegate->init();
}

@ -28,7 +28,7 @@
UBGraphicsPixmapItem::UBGraphicsPixmapItem(QGraphicsItem* parent)
: QGraphicsPixmapItem(parent)
{
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true);
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true, false);
mDelegate->init();
mDelegate->setFlippable(true);

@ -29,7 +29,7 @@ UBGraphicsProxyWidget::UBGraphicsProxyWidget(QGraphicsItem* parent)
{
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
mDelegate = new UBGraphicsItemDelegate(this,0);
mDelegate = new UBGraphicsItemDelegate(this,0, true, false, false);
mDelegate->init();
setFlag(QGraphicsItem::ItemSendsGeometryChanges, true);

@ -4,7 +4,7 @@
UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent):QGraphicsItemGroup(parent)
{
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true);
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true, false);
mDelegate->init();
mDelegate->setFlippable(true);
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);

@ -53,7 +53,7 @@ void UBGraphicsSvgItem::init()
{
setData(UBGraphicsItemData::ItemLayerType, UBItemLayerType::Object);
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true);
mDelegate = new UBGraphicsItemDelegate(this, 0, true, true, false);
mDelegate->init();
mDelegate->setFlippable(true);

@ -30,7 +30,7 @@
#include "core/memcheck.h"
UBGraphicsWidgetItemDelegate::UBGraphicsWidgetItemDelegate(UBGraphicsWidgetItem* pDelegated, int widgetType)
: UBGraphicsItemDelegate(pDelegated, 0, true, false)
: UBGraphicsItemDelegate(pDelegated, 0, true, false, false)
, freezeAction(0)
, setAsToolAction(0)
{

@ -25,7 +25,7 @@
#include "core/memcheck.h"
UBGraphicsCurtainItemDelegate::UBGraphicsCurtainItemDelegate(UBGraphicsCurtainItem* pDelegated, QObject * parent)
: UBGraphicsItemDelegate(pDelegated, parent, false)
: UBGraphicsItemDelegate(pDelegated, parent, false, false, false)
{
setCanDuplicate(false);
}

Loading…
Cancel
Save