m_view.add_button->setIcon(KIcon("document-new"));
m_view.delete_button->setIcon(KIcon("trash-empty"));
+ m_view.zoom_button->setIcon(KIcon("zoom-in"));
+ m_view.unzoom_button->setIcon(KIcon("zoom-out"));
m_view.add_button->setToolTip(i18n("Add new button"));
m_view.delete_button->setToolTip(i18n("Delete current button"));
connect(m_view.add_button, SIGNAL(pressed()), this, SLOT(addButton()));
connect(m_view.delete_button, SIGNAL(pressed()), this, SLOT(deleteButton()));
+ connect(m_view.zoom_button, SIGNAL(pressed()), this, SLOT(slotZoom()));
+ connect(m_view.unzoom_button, SIGNAL(pressed()), this, SLOT(slotUnZoom()));
connect(m_scene, SIGNAL(selectionChanged()), this, SLOT(buttonChanged()));
connect(m_scene, SIGNAL(changed(const QList<QRectF> &)), this, SIGNAL(completeChanged()));
}
}
+void DvdWizardMenu::slotZoom()
+{
+ m_view.menu_preview->scale(2.0, 2.0);
+}
+
+void DvdWizardMenu::slotUnZoom()
+{
+ m_view.menu_preview->scale(0.5, 0.5);
+}
+
virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value) {
if (change == ItemPositionChange && scene()) {
- /* QList<QGraphicsItem *> 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(), 0.0));
+ newPos.setY(qMax(newPos.y(), 0.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<QGraphicsItem*> 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);
}
void updateColor();
void updateColor(QColor c);
void setBackToMenu(bool backToMenu);
+ void slotZoom();
+ void slotUnZoom();
};
#endif