summaryrefslogtreecommitdiffstats
path: root/tests/manual/qgraphicslayout/flicker/window.cpp
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2011-03-18 16:33:31 +0100
committerOlivier Goffart <olivier.goffart@nokia.com>2011-05-10 12:54:47 +0200
commit04e8fb5e51adb308bb4faaf71672fc0609b5061b (patch)
tree6d027eb5eb384fa38abeaef9c8f00dbaa394235b /tests/manual/qgraphicslayout/flicker/window.cpp
parentb46d7d3b917da6e968acb24d74ffff7d2a68068e (diff)
Manual test for layout flickering
(cherry picked from commit fae8bb9f583b416bf47208561c38e0b102f8578c)
Diffstat (limited to 'tests/manual/qgraphicslayout/flicker/window.cpp')
-rw-r--r--tests/manual/qgraphicslayout/flicker/window.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/manual/qgraphicslayout/flicker/window.cpp b/tests/manual/qgraphicslayout/flicker/window.cpp
new file mode 100644
index 0000000000..d193ad12d7
--- /dev/null
+++ b/tests/manual/qgraphicslayout/flicker/window.cpp
@@ -0,0 +1,32 @@
+#include "window.h"
+
+void SlowWidget::setGeometry(const QRectF &rect)
+{
+ bool reiterate = false;
+ Statistics &stats = *m_stats;
+ if (stats.relayoutClicked) {
+ ++(stats.setGeometryTracker[this]);
+ ++stats.setGeometryCount;
+ qDebug() << "setGeometryCount:" << stats.setGeometryCount;
+ if (stats.setGeometryTracker.count() == m_window->m_depthSpinBox->value()) {
+ ++stats.currentBenchmarkIteration;
+ qDebug() << "currentBenchmarkIteration:" << stats.currentBenchmarkIteration;
+ if (stats.currentBenchmarkIteration == m_window->m_benchmarkIterationsSpinBox->value()) {
+ if (stats.output)
+ stats.output->setText(tr("DONE. Elapsed: %1, setGeometryCount: %2").arg(stats.time.elapsed()).arg(stats.setGeometryCount));
+ } else {
+ reiterate = true;
+ }
+ stats.setGeometryTracker.clear();
+
+ }
+ }
+
+ QGraphicsWidget::setGeometry(rect);
+
+ if (reiterate) {
+ m_window->doAgain();
+ //QTimer::singleShot(0, m_window, SLOT(doAgain()));
+ }
+}
+