forked from qt-creator/qt-creator
QmlProfiler: Handle enable and show signals for zoomslider in C++
As it's hard to pass arguments for signals from non-QML-mapped objects to QML objects handle the signal in C++ instead and just directly set the properties. Task-number: QTCREATORBUG-10943 Change-Id: I039f6938db3d7e64ca1a4bcff2f0f6aa79c65219 Reviewed-by: Kai Koehne <kai.koehne@digia.com> Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -514,8 +514,6 @@ Rectangle {
|
|||||||
x: 0
|
x: 0
|
||||||
y: 0
|
y: 0
|
||||||
|
|
||||||
function toggleEnabled() {enabled = !enabled}
|
|
||||||
function toggleVisible() {visible = !visible}
|
|
||||||
function updateZoomLevel() {
|
function updateZoomLevel() {
|
||||||
zoomSlider.externalUpdate = true;
|
zoomSlider.externalUpdate = true;
|
||||||
zoomSlider.value = Math.pow((view.endTime - view.startTime) / qmlProfilerModelProxy.traceDuration(), 1 / zoomSlider.exponent) * zoomSlider.maximumValue;
|
zoomSlider.value = Math.pow((view.endTime - view.startTime) / qmlProfilerModelProxy.traceDuration(), 1 / zoomSlider.exponent) * zoomSlider.maximumValue;
|
||||||
|
|||||||
@@ -192,10 +192,22 @@ void QmlProfilerTraceView::reset()
|
|||||||
connect(this, SIGNAL(jumpToNext()), rootObject, SLOT(nextEvent()));
|
connect(this, SIGNAL(jumpToNext()), rootObject, SLOT(nextEvent()));
|
||||||
connect(rootObject, SIGNAL(selectedEventChanged(int)), this, SIGNAL(selectedEventChanged(int)));
|
connect(rootObject, SIGNAL(selectedEventChanged(int)), this, SIGNAL(selectedEventChanged(int)));
|
||||||
connect(rootObject, SIGNAL(changeToolTip(QString)), this, SLOT(updateToolTip(QString)));
|
connect(rootObject, SIGNAL(changeToolTip(QString)), this, SLOT(updateToolTip(QString)));
|
||||||
|
connect(this, SIGNAL(enableToolbar(bool)), this, SLOT(setZoomSliderEnabled(bool)));
|
||||||
|
connect(this, SIGNAL(showZoomSlider(bool)), this, SLOT(setZoomSliderVisible(bool)));
|
||||||
|
}
|
||||||
|
|
||||||
QObject *zoomSlider = rootObject->findChild<QObject*>(QLatin1String("zoomSliderToolBar"));
|
void QmlProfilerTraceView::setZoomSliderEnabled(bool enabled)
|
||||||
connect(this, SIGNAL(enableToolbar(bool)), zoomSlider, SLOT(toggleEnabled()));
|
{
|
||||||
connect(this, SIGNAL(showZoomSlider(bool)), zoomSlider, SLOT(toggleVisible()));
|
QQuickItem *zoomSlider = d->m_mainView->rootObject()->findChild<QQuickItem*>(QLatin1String("zoomSliderToolBar"));
|
||||||
|
if (zoomSlider->isEnabled() != enabled)
|
||||||
|
zoomSlider->setEnabled(enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
void QmlProfilerTraceView::setZoomSliderVisible(bool visible)
|
||||||
|
{
|
||||||
|
QQuickItem *zoomSlider = d->m_mainView->rootObject()->findChild<QQuickItem*>(QLatin1String("zoomSliderToolBar"));
|
||||||
|
if (zoomSlider->isVisible() != visible)
|
||||||
|
zoomSlider->setVisible(visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *QmlProfilerTraceView::createToolbar()
|
QWidget *QmlProfilerTraceView::createToolbar()
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ private slots:
|
|||||||
void profilerStateChanged();
|
void profilerStateChanged();
|
||||||
void clientRecordingChanged();
|
void clientRecordingChanged();
|
||||||
void serverRecordingChanged();
|
void serverRecordingChanged();
|
||||||
|
void setZoomSliderEnabled(bool enabled);
|
||||||
|
void setZoomSliderVisible(bool visible);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void gotoSourceLocation(const QString &fileUrl, int lineNumber, int columNumber);
|
void gotoSourceLocation(const QString &fileUrl, int lineNumber, int columNumber);
|
||||||
|
|||||||
Reference in New Issue
Block a user