X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=inline;f=src%2Fdvdwizardmenu.h;h=6374d2c3549f58a516a84c6c45af30392f28d196;hb=2b1c40908368fff4b20912551c266e45c89f6607;hp=68ba88fdc0f664ad1e5a721965e0690eb5e7e7ac;hpb=d8dcc0d93068a347710cb2fab7f4dbeba44bd19f;p=kdenlive diff --git a/src/dvdwizardmenu.h b/src/dvdwizardmenu.h index 68ba88fd..6374d2c3 100644 --- a/src/dvdwizardmenu.h +++ b/src/dvdwizardmenu.h @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -89,22 +90,23 @@ protected: virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) { if (change == ItemPositionChange && scene()) { - /* QList list = collidingItems(); - if (!list.isEmpty()) { - for (int i = 0; i < list.count(); i++) { - if (list.at(i)->type() == Type) return pos(); - } - } - */ - DvdScene *sc = static_cast < DvdScene * >(scene()); - QRectF rect = QRectF(0, 0, sc->width(), sc->height()); QPointF newPos = value.toPointF(); - if (!rect.contains(newPos)) { - // Keep the item inside the scene rect. - newPos.setX(qMin(rect.right(), qMax(newPos.x(), rect.left()))); - newPos.setY(qMin(rect.bottom(), qMax(newPos.y(), rect.top()))); - return newPos; + QRectF sceneShape = sceneBoundingRect(); + DvdScene *sc = static_cast < DvdScene * >(scene()); + newPos.setX(qMax(newPos.x(), (qreal)0)); + newPos.setY(qMax(newPos.y(), (qreal)0)); + if (newPos.x() + sceneShape.width() > sc->width()) newPos.setX(sc->width() - sceneShape.width()); + if (newPos.y() + sceneShape.height() > sc->height()) newPos.setY(sc->height() - sceneShape.height()); + + sceneShape.translate(newPos - pos()); + QList list = scene()->items(sceneShape, Qt::IntersectsItemShape); + list.removeAll(this); + if (!list.isEmpty()) { + for (int i = 0; i < list.count(); i++) { + if (list.at(i)->type() == Type) return pos(); + } } + return newPos; } return QGraphicsItem::itemChange(change, value); } @@ -128,6 +130,9 @@ public: bool menuMovie() const; QString menuMoviePath() const; bool isPalMenu() const; + void changeProfile(bool isPal); + QDomElement toXml() const; + void loadXml(QDomElement xml); private: Ui::DvdWizardMenu_UI m_view; @@ -145,7 +150,6 @@ private slots: void buildImage(); void checkBackground(); void checkBackgroundType(int ix); - void changeProfile(int ix); void updatePreview(); void buttonChanged(); void addButton(); @@ -154,6 +158,8 @@ private slots: void updateColor(); void updateColor(QColor c); void setBackToMenu(bool backToMenu); + void slotZoom(); + void slotUnZoom(); }; #endif