Commit 9d38b866 authored by Aurindam Jana's avatar Aurindam Jana
Browse files

QmlProfiler: Remove ScrollableQuickView



As the timeline can scroll by itself now we don't need an external
scrolling helper anymore.

Change-Id: I831eaf2302ced7649b4746e5c7d10121d83a4794
Reviewed-by: default avatarAurindam Jana <aurindam.jana@digia.com>
parent a3535e66
...@@ -59,19 +59,6 @@ using namespace QmlDebug; ...@@ -59,19 +59,6 @@ using namespace QmlDebug;
namespace QmlProfiler { namespace QmlProfiler {
namespace Internal { namespace Internal {
/////////////////////////////////////////////////////////
bool MouseWheelResizer::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::Wheel) {
QWheelEvent *ev = static_cast<QWheelEvent *>(event);
if (ev->modifiers() & Qt::ControlModifier) {
emit mouseWheelMoved(ev->pos().x(), ev->pos().y(), ev->delta());
return true;
}
}
return QObject::eventFilter(obj, event);
}
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
void ZoomControl::setRange(qint64 startTime, qint64 endTime) void ZoomControl::setRange(qint64 startTime, qint64 endTime)
{ {
...@@ -82,25 +69,6 @@ void ZoomControl::setRange(qint64 startTime, qint64 endTime) ...@@ -82,25 +69,6 @@ void ZoomControl::setRange(qint64 startTime, qint64 endTime)
} }
} }
/////////////////////////////////////////////////////////
ScrollableQuickView::ScrollableQuickView(QQuickView *parent)
: QQuickView(parent)
{
}
ScrollableQuickView::~ScrollableQuickView()
{
}
void ScrollableQuickView::scrollContentsBy(int /*dx*/, int dy)
{
// special workaround to track the scrollbar
if (rootObject()) {
int scrollY = rootObject()->property("scrollY").toInt();
rootObject()->setProperty("scrollY", QVariant(scrollY - dy));
}
}
///////////////////////////////////////////////////////// /////////////////////////////////////////////////////////
class QmlProfilerTraceView::QmlProfilerTraceViewPrivate class QmlProfilerTraceView::QmlProfilerTraceViewPrivate
{ {
...@@ -121,7 +89,7 @@ public: ...@@ -121,7 +89,7 @@ public:
QSize m_sizeHint; QSize m_sizeHint;
ScrollableQuickView *m_mainView; QQuickView *m_mainView;
QQuickView *m_timebar; QQuickView *m_timebar;
QQuickView *m_overview; QQuickView *m_overview;
QmlProfilerModelManager *m_modelManager; QmlProfilerModelManager *m_modelManager;
...@@ -146,13 +114,10 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT ...@@ -146,13 +114,10 @@ QmlProfilerTraceView::QmlProfilerTraceView(QWidget *parent, Analyzer::IAnalyzerT
groupLayout->setContentsMargins(0, 0, 0, 0); groupLayout->setContentsMargins(0, 0, 0, 0);
groupLayout->setSpacing(0); groupLayout->setSpacing(0);
d->m_mainView = new ScrollableQuickView(); d->m_mainView = new QQuickView();
d->m_mainView->setResizeMode(QQuickView::SizeRootObjectToView); d->m_mainView->setResizeMode(QQuickView::SizeRootObjectToView);
QWidget *mainViewContainer = QWidget::createWindowContainer(d->m_mainView); QWidget *mainViewContainer = QWidget::createWindowContainer(d->m_mainView);
MouseWheelResizer *resizer = new MouseWheelResizer(this);
connect(resizer,SIGNAL(mouseWheelMoved(int,int,int)), this, SLOT(mouseWheelMoved(int,int,int)));
QHBoxLayout *toolsLayout = new QHBoxLayout; QHBoxLayout *toolsLayout = new QHBoxLayout;
d->m_timebar = new QQuickView(); d->m_timebar = new QQuickView();
...@@ -414,16 +379,6 @@ void QmlProfilerTraceView::updateRange() ...@@ -414,16 +379,6 @@ void QmlProfilerTraceView::updateRange()
QMetaObject::invokeMethod(d->m_mainView->rootObject()->findChild<QObject*>(QLatin1String("zoomSliderToolBar")), "updateZoomLevel"); QMetaObject::invokeMethod(d->m_mainView->rootObject()->findChild<QObject*>(QLatin1String("zoomSliderToolBar")), "updateZoomLevel");
} }
void QmlProfilerTraceView::mouseWheelMoved(int mouseX, int mouseY, int wheelDelta)
{
Q_UNUSED(mouseY);
QQuickItem *rootObject = d->m_mainView->rootObject();
if (rootObject) {
QMetaObject::invokeMethod(rootObject, "wheelZoom",
Q_ARG(QVariant, QVariant(mouseX)),
Q_ARG(QVariant, QVariant(wheelDelta)));
}
}
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
void QmlProfilerTraceView::updateToolTip(const QString &text) void QmlProfilerTraceView::updateToolTip(const QString &text)
{ {
......
...@@ -45,17 +45,6 @@ namespace Internal { ...@@ -45,17 +45,6 @@ namespace Internal {
class QmlProfilerStateManager; class QmlProfilerStateManager;
class QmlProfilerViewManager; class QmlProfilerViewManager;
// capture mouse wheel events
class MouseWheelResizer : public QObject {
Q_OBJECT
public:
MouseWheelResizer(QObject *parent=0):QObject(parent){}
protected:
bool eventFilter(QObject *obj, QEvent *event);
signals:
void mouseWheelMoved(int x, int y, int delta);
};
// centralized zoom control // centralized zoom control
class ZoomControl : public QObject { class ZoomControl : public QObject {
Q_OBJECT Q_OBJECT
...@@ -75,17 +64,6 @@ private: ...@@ -75,17 +64,6 @@ private:
qint64 m_endTime; qint64 m_endTime;
}; };
class ScrollableQuickView : public QQuickView
{
Q_OBJECT
public:
explicit ScrollableQuickView(QQuickView *parent = 0);
~ScrollableQuickView();
protected:
void scrollContentsBy(int dx, int dy);
};
class QmlProfilerTraceView : public QWidget class QmlProfilerTraceView : public QWidget
{ {
Q_OBJECT Q_OBJECT
...@@ -113,7 +91,6 @@ private slots: ...@@ -113,7 +91,6 @@ private slots:
void updateLockButton(); void updateLockButton();
void updateRange(); void updateRange();
void mouseWheelMoved(int mouseX, int mouseY, int wheelDelta);
void updateToolTip(const QString &text); void updateToolTip(const QString &text);
void profilerDataModelStateChanged(); void profilerDataModelStateChanged();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment