diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-26 00:03:08 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-05-26 00:03:08 (GMT) |
commit | abb9a3b5031e86bdd89a9338c4f12d703e6f385b (patch) | |
tree | 2d0fb9eb222885a15ee06e486e7400cdedcc0a92 /tools/qmldebugger/canvasframerate.cpp | |
parent | 7f43bd48595025961989fcd51bee0271a275b475 (diff) | |
download | Qt-abb9a3b5031e86bdd89a9338c4f12d703e6f385b.zip Qt-abb9a3b5031e86bdd89a9338c4f12d703e6f385b.tar.gz Qt-abb9a3b5031e86bdd89a9338c4f12d703e6f385b.tar.bz2 |
Move canvas scene snapshot out of in-process debugger
Diffstat (limited to 'tools/qmldebugger/canvasframerate.cpp')
-rw-r--r-- | tools/qmldebugger/canvasframerate.cpp | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/tools/qmldebugger/canvasframerate.cpp b/tools/qmldebugger/canvasframerate.cpp index b1f412e..022aed5 100644 --- a/tools/qmldebugger/canvasframerate.cpp +++ b/tools/qmldebugger/canvasframerate.cpp @@ -12,6 +12,7 @@ #include <QTabWidget> #include <QPushButton> #include <QLineEdit> +#include <QCheckBox> class QLineGraph : public QWidget { @@ -26,9 +27,7 @@ public slots: protected: virtual void paintEvent(QPaintEvent *); - virtual void mousePressEvent(QMouseEvent *); - virtual void resizeEvent(QResizeEvent *); - virtual void showEvent(QShowEvent *); + virtual QSize sizeHint() const; private slots: void scrollbarChanged(int); @@ -64,32 +63,20 @@ QLineGraph::QLineGraph(QWidget *parent) QObject::connect(&sb, SIGNAL(valueChanged(int)), this, SLOT(scrollbarChanged(int))); } -void QLineGraph::scrollbarChanged(int v) +QSize QLineGraph::sizeHint() const { - if(ignoreScroll) - return; - - position = v; - update(); + return QSize(800, 600); } -void QLineGraph::resizeEvent(QResizeEvent *e) -{ - QWidget::resizeEvent(e); -} - -void QLineGraph::showEvent(QShowEvent *e) +void QLineGraph::scrollbarChanged(int v) { - QWidget::showEvent(e); -} + if(ignoreScroll) + return; -void QLineGraph::mousePressEvent(QMouseEvent *) -{ - if(position == -1) { - position = qMax(0, _samples.count() - samplesPerWidth - 1); - } else { + if (v == sb.maximum()) position = -1; - } + else + position = v; update(); } @@ -276,6 +263,11 @@ CanvasFrameRate::CanvasFrameRate(QmlDebugClient *client, QWidget *parent) layout->addLayout(bottom); bottom->addStretch(2); + QCheckBox *check = new QCheckBox("Enable", this); + bottom->addWidget(check); + QObject::connect(check, SIGNAL(stateChanged(int)), + this, SLOT(stateChanged(int))); + QPushButton *pb = new QPushButton(tr("New Tab"), this); QObject::connect(pb, SIGNAL(clicked()), this, SLOT(newTab())); bottom->addWidget(pb); @@ -302,4 +294,11 @@ void CanvasFrameRate::newTab() m_tabs->setCurrentIndex(id); } +void CanvasFrameRate::stateChanged(int s) +{ + bool checked = s != 0; + + static_cast<QmlDebugClientPlugin *>(m_plugin)->setEnabled(checked); +} + #include "canvasframerate.moc" |