implemented delegate() function for graphics objects

preferencesAboutTextFull
Ivan Ilin 13 years ago
parent 2f34f5e5ff
commit 9aa3027c51
  1. 19
      src/adaptors/UBCFFSubsetAdaptor.cpp
  2. 5
      src/adaptors/UBCFFSubsetAdaptor.h
  3. 1
      src/domain/UBGraphicsAudioItem.h
  4. 16
      src/domain/UBGraphicsItemDelegate.h
  5. 3
      src/domain/UBGraphicsPDFItem.h
  6. 7
      src/domain/UBGraphicsPixmapItem.h
  7. 4
      src/domain/UBGraphicsProxyWidget.h
  8. 3
      src/domain/UBGraphicsSvgItem.h
  9. 1
      src/domain/UBGraphicsTextItem.cpp
  10. 3
      src/domain/UBGraphicsTextItem.h
  11. 1
      src/domain/UBGraphicsVideoItem.h
  12. 11
      src/domain/UBItem.h
  13. 1
      src/tools/UBGraphicsCurtainItem.cpp
  14. 2
      src/tools/UBGraphicsCurtainItem.h

@ -818,8 +818,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &ele
}
// repositionSvgItem(svgItem, rx * 2 + 10, ry * 2 + 10, cx - rx - 5, cy - ry -5, hastransform, transform);
repositionPixmapItem(pixItem, width, height, x, y, hastransform, transform);
// hashSceneItem(element, pixItem->);
hashSceneItem(element, pixItem);
pixItem->Delegate()->lock(true);
return true;
}
@ -852,13 +852,13 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseIwbGroup(QDomNode *group)
return true;
}
//void UBCFFSubsetAdaptor::UBCFFSubsetReader::hashSceneItem(QDomNode &element, UBGraphicsItemDelegate *item)
//{
//// adding element pointer to hash to refer if needed
// QString key = element.attribute(aId);
// if (!key.isNull())
// persistedItems.insert(key, item);
//}
void UBCFFSubsetAdaptor::UBCFFSubsetReader::hashSceneItem(const QDomElement &element, UBGraphicsItem *item)
{
// adding element pointer to hash to refer if needed
QString key = element.attribute(aId);
if (!key.isNull())
persistedItems.insert(key, item);
}
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgElement(const QDomElement &parent)
{
@ -868,7 +868,6 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgElement(const QDomElement &p
return false;
}
if (tagName == tRect && !parseSvgRect(parent)) return false;
else if (tagName == tEllipse && !parseSvgEllipse(parent)) return false;
else if (tagName == tPolygon && !parseSvgPolygon(parent)) return false;

@ -30,6 +30,7 @@ class UBGraphicsPixmapItem;
class UBGraphicsItemDelegate;
class QTransform;
class QPainter;
class UBGraphicsItem;
struct IwbExt {
IwbExt() {;}
@ -87,7 +88,7 @@ private:
QDomDocument mDOMdoc;
QDomNode mCurrentDOMElement;
QHash<QString, IwbExt> iwbExtProperties;
QHash<QString, UBGraphicsItemDelegate*> persistedItems;
QHash<QString, UBGraphicsItem*> persistedItems;
bool hashElements();
void addExtentionsToHash(QDomElement *parent, QDomElement *topGroup);
@ -109,7 +110,7 @@ private:
inline bool parseSvgImage(const QDomElement &element);
// inline bool parseSvgTSpan(const QDomElement)
bool parseIwbGroup(QDomNode *element);
inline void hashSceneItem(QDomNode *element, UBGraphicsItemDelegate *item);
inline void hashSceneItem(const QDomElement &element, UBGraphicsItem *item);
// to kill
void parseTextAttributes(const QDomElement &element, qreal &fontSize, QColor &fontColor,

@ -37,6 +37,7 @@ public:
}
virtual UBItem* deepCopy () const;
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
private slots:

@ -30,7 +30,7 @@ class UBGraphicsWidgetItem;
class DelegateButton: public QGraphicsSvgItem
{
Q_OBJECT;
Q_OBJECT
public:
DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0)
@ -90,7 +90,7 @@ class DelegateButton: public QGraphicsSvgItem
class UBGraphicsItemDelegate : public QObject
{
Q_OBJECT;
Q_OBJECT
public:
UBGraphicsItemDelegate(QGraphicsItem* pDelegated, QObject * parent = 0, bool respectRatio = true, bool canRotate = false);
@ -129,17 +129,19 @@ class UBGraphicsItemDelegate : public QObject
void setMimeData(QMimeData* mimeData);
signals:
void showOnDisplayChanged(bool shown);
void lockChanged(bool locked);
public slots:
virtual void remove(bool canUndo = true);
void showMenu();
virtual void showHide(bool show);
virtual void lock(bool lock);
virtual void duplicate();
protected:
virtual void buildButtons() {};
virtual void buildButtons() {;}
virtual void decorateMenu(QMenu *menu);
virtual void updateMenuActionState();
@ -164,9 +166,7 @@ class UBGraphicsItemDelegate : public QObject
protected slots:
virtual void gotoContentSource(bool checked);
virtual void showHide(bool show);
virtual void lock(bool lock);
virtual void duplicate();
private:

@ -48,6 +48,7 @@ class UBGraphicsPDFItem: public GraphicsPDFItem, public UBItem, public UBGraphic
virtual void remove();
virtual UBGraphicsPixmapItem* toPixmapItem() const;
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
protected:
@ -57,7 +58,7 @@ class UBGraphicsPDFItem: public GraphicsPDFItem, public UBItem, public UBGraphic
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
UBGraphicsItemDelegate* mDelegate;
// UBGraphicsItemDelegate* mDelegate;
};
#endif /* UBGRAPHICSPDFITEM_H_ */

@ -45,11 +45,13 @@ class UBGraphicsPixmapItem : public QObject, public QGraphicsPixmapItem, public
virtual void remove();
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity);
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
void setOpacity(qreal op);
qreal opacity() const;
virtual UBGraphicsItemDelegate* Delegate() const {return mDelegate;}
protected:
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
@ -60,7 +62,8 @@ protected:
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
UBGraphicsItemDelegate* mDelegate;
// UBGraphicsItemDelegate* mDelegate;
};

@ -41,7 +41,7 @@ class UBGraphicsProxyWidget: public QGraphicsProxyWidget, public UBItem, public
virtual void remove();
UBGraphicsItemDelegate* delegate (){ return mDelegate;}
virtual UBGraphicsItemDelegate* delegate() const { return mDelegate;}
protected:
@ -53,7 +53,7 @@ class UBGraphicsProxyWidget: public QGraphicsProxyWidget, public UBItem, public
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
UBGraphicsItemDelegate* mDelegate;
// UBGraphicsItemDelegate* mDelegate;
};
#endif /* UBGRAPHICSPROXYWIDGET_H_ */

@ -59,6 +59,7 @@ class UBGraphicsSvgItem: public QGraphicsSvgItem, public UBItem, public UBGraphi
virtual void remove();
virtual UBGraphicsPixmapItem* toPixmapItem() const;
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
protected:
@ -70,7 +71,7 @@ class UBGraphicsSvgItem: public QGraphicsSvgItem, public UBItem, public UBGraphi
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
UBGraphicsItemDelegate* mDelegate;
// UBGraphicsItemDelegate* mDelegate;
QByteArray mFileData;
};

@ -30,7 +30,6 @@ QColor UBGraphicsTextItem::lastUsedTextColor;
UBGraphicsTextItem::UBGraphicsTextItem(QGraphicsItem * parent)
: QGraphicsTextItem(parent)
, mDelegate(0)
, mMultiClickState(0)
, mLastMousePressTime(QTime::currentTime())
{

@ -78,6 +78,7 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
{
mColorOnLightBackground = pColorOnLightBackground;
}
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
signals:
void textUndoCommandAdded(UBGraphicsTextItem *textItem);
@ -96,7 +97,7 @@ class UBGraphicsTextItem : public QGraphicsTextItem, public UBItem, public UBRes
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value);
private:
UBGraphicsItemDelegate *mDelegate;
// UBGraphicsItemDelegate *mDelegate;
qreal mTextHeight;
int mMultiClickState;

@ -40,6 +40,7 @@ public:
{
return mVideoWidget;
}
virtual UBGraphicsItemDelegate *Delegate() const {return mDelegate;}
public slots:

@ -16,6 +16,7 @@
#define UBITEM_H
#include <QtGui>
#include "domain/UBGraphicsItemDelegate.h"
class UBGraphicsScene;
@ -84,21 +85,23 @@ class UBItem
class UBGraphicsItem
{
protected:
protected:
UBGraphicsItem()
UBGraphicsItem() : mDelegate(0)
{
// NOOP
}
UBGraphicsItemDelegate* mDelegate;
virtual ~UBGraphicsItem()
{
// NOOP
}
public:
public:
virtual UBGraphicsItemDelegate *Delegate() const {return 0;}
virtual void remove() = 0;
};
#endif // UBITEM_H

@ -36,7 +36,6 @@ const QColor UBGraphicsCurtainItem::sDarkBackgroundOpaqueControlColor = QColor(6
UBGraphicsCurtainItem::UBGraphicsCurtainItem(QGraphicsItem* parent)
: QGraphicsRectItem(parent)
, mDelegate(0)
{
mDelegate = new UBGraphicsCurtainItemDelegate(this, 0);
mDelegate->init();

@ -65,7 +65,7 @@ class UBGraphicsCurtainItem : public QObject, public QGraphicsRectItem, public U
QColor drawColor() const;
QColor opaqueControlColor() const;
UBGraphicsItemDelegate* mDelegate;
// UBGraphicsItemDelegate* mDelegate;
static const QColor sDrawColor;
static const QColor sDarkBackgroundDrawColor;

Loading…
Cancel
Save