summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-09-22 04:10:29 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-09-22 04:10:29 (GMT)
commitee72eef536c42a3f18d59fd5f3e1d14eb8d8e9d9 (patch)
tree2e63bd88680a9e1ffdfd7955b73426fd2939a717 /tools
parent1ee038d05089aea25d3602f3e65592d7dd07b76f (diff)
downloadQt-ee72eef536c42a3f18d59fd5f3e1d14eb8d8e9d9.zip
Qt-ee72eef536c42a3f18d59fd5f3e1d14eb8d8e9d9.tar.gz
Qt-ee72eef536c42a3f18d59fd5f3e1d14eb8d8e9d9.tar.bz2
Fixes for framerate monitor.
Diffstat (limited to 'tools')
-rw-r--r--tools/qmldebugger/canvasframerate.cpp23
-rw-r--r--tools/qmldebugger/canvasframerate.h2
2 files changed, 24 insertions, 1 deletions
diff --git a/tools/qmldebugger/canvasframerate.cpp b/tools/qmldebugger/canvasframerate.cpp
index ae514a5..0d23050 100644
--- a/tools/qmldebugger/canvasframerate.cpp
+++ b/tools/qmldebugger/canvasframerate.cpp
@@ -13,6 +13,8 @@
#include <QPushButton>
#include <QLineEdit>
#include <QCheckBox>
+#include <QSpinBox>
+#include <QLabel>
QT_BEGIN_NAMESPACE
@@ -26,6 +28,7 @@ public:
public slots:
void addSample(int, int, int, bool);
+ void setResolutionForHeight(int);
protected:
virtual void paintEvent(QPaintEvent *);
@@ -153,7 +156,7 @@ void QLineGraph::drawSample(QPainter *p, int s, const QRect &rect)
first = qMax(0, _samples.count() - samplesPerWidth - 1);
int last = qMin(_samples.count() - 1, first + samplesPerWidth);
- qreal scaleY = rect.height() / resolutionForHeight;
+ qreal scaleY = qreal(rect.height()) / resolutionForHeight;
qreal scaleX = qreal(rect.width()) / qreal(samplesPerWidth);
int xEnd;
@@ -205,6 +208,12 @@ void QLineGraph::paintEvent(QPaintEvent *)
drawTime(&p, r);
}
+void QLineGraph::setResolutionForHeight(int resolution)
+{
+ resolutionForHeight = resolution;
+ update();
+}
+
class CanvasFrameRatePlugin : public QmlDebugClient
{
Q_OBJECT
@@ -256,7 +265,18 @@ CanvasFrameRate::CanvasFrameRate(QmlDebugConnection *client, QWidget *parent)
layout->addWidget(m_tabs);
QHBoxLayout *bottom = new QHBoxLayout;
+ bottom->setSpacing(5);
layout->addLayout(bottom);
+
+ QLabel *label = new QLabel("Resolution", this);
+ bottom->addWidget(label);
+
+ m_spin = new QSpinBox(this);
+ m_spin->setRange(50,200);
+ m_spin->setValue(50);
+ m_spin->setSuffix("ms");
+ bottom->addWidget(m_spin);
+
bottom->addStretch(2);
QCheckBox *check = new QCheckBox("Enable", this);
@@ -284,6 +304,7 @@ void CanvasFrameRate::newTab()
QLineGraph *graph = new QLineGraph(this);
QObject::connect(m_plugin, SIGNAL(sample(int,int,int,bool)),
graph, SLOT(addSample(int,int,int,bool)));
+ QObject::connect(m_spin, SIGNAL(valueChanged(int)), graph, SLOT(setResolutionForHeight(int)));
QString name = QLatin1String("Graph ") + QString::number(id);
m_tabs->addTab(graph, name);
diff --git a/tools/qmldebugger/canvasframerate.h b/tools/qmldebugger/canvasframerate.h
index 912412b..cef267d 100644
--- a/tools/qmldebugger/canvasframerate.h
+++ b/tools/qmldebugger/canvasframerate.h
@@ -7,6 +7,7 @@ QT_BEGIN_NAMESPACE
class QmlDebugConnection;
class QTabWidget;
+class QSpinBox;
class CanvasFrameRate : public QWidget
{
Q_OBJECT
@@ -19,6 +20,7 @@ private slots:
private:
QTabWidget *m_tabs;
+ QSpinBox *m_spin;
QObject *m_plugin;
};