Merge branch 'master' of github.com:Sankore/Sankore-3.1

preferencesAboutTextFull
Anna Udovichenko 13 years ago
commit 17dd85640b
  1. 21
      src/domain/UBGraphicsItemDelegate.cpp
  2. 20
      src/domain/UBGraphicsItemDelegate.h

@ -50,6 +50,27 @@
class UBGraphicsParaschoolEditorWidgetItem; class UBGraphicsParaschoolEditorWidgetItem;
DelegateButton::DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent, Qt::WindowFrameSection section)
: QGraphicsSvgItem(fileName, parent)
, mDelegated(pDelegated)
, mIsTransparentToMouseEvent(false)
, mButtonAlignmentSection(section)
{
setAcceptedMouseButtons(Qt::LeftButton);
setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control));
}
DelegateButton::~DelegateButton()
{
// NOOP
}
void DelegateButton::setFileName(const QString & fileName)
{
QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this));
}
void DelegateButton::mousePressEvent(QGraphicsSceneMouseEvent *event) void DelegateButton::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
// make sure delegate is selected, to avoid control being hidden // make sure delegate is selected, to avoid control being hidden

@ -35,30 +35,16 @@ class DelegateButton: public QGraphicsSvgItem
Q_OBJECT Q_OBJECT
public: public:
DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection) 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));
}
virtual ~DelegateButton() virtual ~DelegateButton();
{
// NOOP
}
void setTransparentToMouseEvent(bool tr) void setTransparentToMouseEvent(bool tr)
{ {
mIsTransparentToMouseEvent = tr; mIsTransparentToMouseEvent = tr;
} }
void setFileName(const QString & fileName) void setFileName(const QString & fileName);
{
QGraphicsSvgItem::setSharedRenderer(new QSvgRenderer (fileName, this));
}
void setSection(Qt::WindowFrameSection section) {mButtonAlignmentSection = section;} void setSection(Qt::WindowFrameSection section) {mButtonAlignmentSection = section;}
Qt::WindowFrameSection getSection() const {return mButtonAlignmentSection;} Qt::WindowFrameSection getSection() const {return mButtonAlignmentSection;}

Loading…
Cancel
Save