summaryrefslogtreecommitdiffstats
path: root/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp')
-rw-r--r--tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp27
1 files changed, 9 insertions, 18 deletions
diff --git a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp b/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp
index 85881ca67a..f6077e3044 100644
--- a/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp
+++ b/tests/manual/widgets/qgraphicsview/rubberband/rubberbandtest.cpp
@@ -60,11 +60,12 @@ public:
class MyGraphicsView : public QGraphicsView
{
-
+ Q_OBJECT
public:
MyGraphicsView(QWidget *w, QLabel *l) : QGraphicsView(w), rubberbandLabel(l)
{
setDragMode(QGraphicsView::RubberBandDrag);
+ connect(this, SIGNAL(rubberBandChanged(QRect, QPointF, QPointF)), this, SLOT(updateRubberbandInfo(QRect, QPointF, QPointF)));
}
protected:
void mouseMoveEvent(QMouseEvent *event)
@@ -80,29 +81,17 @@ protected:
int yglobal = event->globalY();
if (yglobal > bottomPos)
verticalScrollBar()->setValue(verticalScrollBar()->value() + 10);
- updateRubberbandInfo();
}
- void mouseReleaseEvent(QMouseEvent *event)
- {
- QGraphicsView::mouseReleaseEvent(event);
- updateRubberbandInfo();
- }
-
- void wheelEvent (QWheelEvent *event)
- {
- QGraphicsView::wheelEvent(event);
- updateRubberbandInfo();
- }
-
- void updateRubberbandInfo()
+protected slots:
+ void updateRubberbandInfo(QRect r, QPointF from, QPointF to)
{
QString textToShow;
QDebug s(&textToShow);
- s << rubberBandRect();
- if (rubberbandLabel->text() != textToShow)
- rubberbandLabel->setText(textToShow);
+ s << r << from << to;
+ rubberbandLabel->setText(textToShow);
}
+protected:
QLabel *rubberbandLabel;
};
@@ -135,3 +124,5 @@ int main(int argc, char *argv[])
app.exec();
return 0;
}
+
+#include "rubberbandtest.moc"