diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.cpp b/src/plugins/qmlprofiler/qmlprofilereventview.cpp index cba72b1b576..87548afeb53 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilereventview.cpp @@ -262,7 +262,7 @@ void QmlProfilerEventsWidget::clear() d->m_eventParents->clear(); } -void QmlProfilerEventsWidget::getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd) +void QmlProfilerEventsWidget::restrictToRange(qint64 rangeStart, qint64 rangeEnd) { d->rangeStart = rangeStart; d->rangeEnd = rangeEnd; @@ -310,7 +310,7 @@ void QmlProfilerEventsWidget::contextMenuEvent(QContextMenuEvent *ev) if (!d->m_viewContainer->hasValidSelection()) getLocalStatsAction->setEnabled(false); getGlobalStatsAction = menu.addAction(tr("Show Full Range")); - if (hasGlobalStats()) + if (!isRestrictedToRange()) getGlobalStatsAction->setEnabled(false); QAction *selectedAction = menu.exec(position); @@ -321,22 +321,16 @@ void QmlProfilerEventsWidget::contextMenuEvent(QContextMenuEvent *ev) if (selectedAction == copyTableAction) copyTableToClipboard(); if (selectedAction == getLocalStatsAction) { - getStatisticsInRange(d->m_viewContainer->selectionStart(), - d->m_viewContainer->selectionEnd()); + restrictToRange(d->m_viewContainer->selectionStart(), + d->m_viewContainer->selectionEnd()); } if (selectedAction == getGlobalStatsAction) - getStatisticsInRange(-1, -1); + restrictToRange(-1, -1); if (selectedAction == showExtendedStatsAction) setShowExtendedStatistics(!showExtendedStatistics()); } } -void QmlProfilerEventsWidget::resizeEvent(QResizeEvent *event) -{ - QWidget::resizeEvent(event); - emit resized(); -} - bool QmlProfilerEventsWidget::mouseOnTable(const QPoint &position) const { QPoint tableTopLeft = d->m_eventTree->mapToGlobal(QPoint(0,0)); @@ -354,7 +348,7 @@ void QmlProfilerEventsWidget::copyRowToClipboard() const d->m_eventTree->copyRowToClipboard(); } -void QmlProfilerEventsWidget::selectByTypeId(int typeIndex) const +void QmlProfilerEventsWidget::selectByTypeId(int typeIndex) { if (d->m_eventTree->selectedTypeId() != typeIndex) d->m_eventTree->selectType(typeIndex); @@ -371,9 +365,9 @@ void QmlProfilerEventsWidget::onVisibleFeaturesChanged(quint64 features) d->modelProxy->limitToRange(d->rangeStart, d->rangeEnd); } -bool QmlProfilerEventsWidget::hasGlobalStats() const +bool QmlProfilerEventsWidget::isRestrictedToRange() const { - return d->rangeStart == -1 && d->rangeEnd == -1; + return d->rangeStart != -1 || d->rangeEnd != -1; } void QmlProfilerEventsWidget::setShowExtendedStatistics(bool show) diff --git a/src/plugins/qmlprofiler/qmlprofilereventview.h b/src/plugins/qmlprofiler/qmlprofilereventview.h index b32079a6943..e573e229d22 100644 --- a/src/plugins/qmlprofiler/qmlprofilereventview.h +++ b/src/plugins/qmlprofiler/qmlprofilereventview.h @@ -88,31 +88,28 @@ public: ~QmlProfilerEventsWidget(); void clear(); - - void getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd); - QModelIndex selectedModelIndex() const; - bool mouseOnTable(const QPoint &position) const; - void copyTableToClipboard() const; - void copyRowToClipboard() const; - - bool hasGlobalStats() const; - void setShowExtendedStatistics(bool show); - bool showExtendedStatistics() const; + void restrictToRange(qint64 rangeStart, qint64 rangeEnd); + bool isRestrictedToRange() const; signals: void gotoSourceLocation(const QString &fileName, int lineNumber, int columnNumber); void typeSelected(int typeIndex); - void resized(); public slots: - void selectByTypeId(int typeIndex) const; + void selectByTypeId(int typeIndex); void onVisibleFeaturesChanged(quint64 features); protected: void contextMenuEvent(QContextMenuEvent *ev); - virtual void resizeEvent(QResizeEvent *event); private: + QModelIndex selectedModelIndex() const; + void copyTableToClipboard() const; + void copyRowToClipboard() const; + bool mouseOnTable(const QPoint &position) const; + void setShowExtendedStatistics(bool show); + bool showExtendedStatistics() const; + class QmlProfilerEventsWidgetPrivate; QmlProfilerEventsWidgetPrivate *d; }; diff --git a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp index 0dbfb228cce..8a2a466d786 100644 --- a/src/plugins/qmlprofiler/qmlprofilertraceview.cpp +++ b/src/plugins/qmlprofiler/qmlprofilertraceview.cpp @@ -253,7 +253,7 @@ void QmlProfilerTraceView::showContextMenu(QPoint position) getLocalStatsAction->setEnabled(false); QAction *getGlobalStatsAction = menu.addAction(tr("Show Full Range in Events Pane")); - if (d->m_viewContainer->hasGlobalStats()) + if (!d->m_viewContainer->isEventsRestrictedToRange()) getGlobalStatsAction->setEnabled(false); if (d->m_zoomControl->traceDuration() > 0) { @@ -269,12 +269,11 @@ void QmlProfilerTraceView::showContextMenu(QPoint position) d->m_zoomControl->traceEnd()); } if (selectedAction == getLocalStatsAction) { - d->m_viewContainer->getStatisticsInRange( - d->m_viewContainer->selectionStart(), - d->m_viewContainer->selectionEnd()); + d->m_viewContainer->restrictEventsToRange(d->m_viewContainer->selectionStart(), + d->m_viewContainer->selectionEnd()); } if (selectedAction == getGlobalStatsAction) - d->m_viewContainer->getStatisticsInRange(-1, -1); + d->m_viewContainer->restrictEventsToRange(-1, -1); } } diff --git a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp index cb7564e36ac..48da23ed5b1 100644 --- a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp @@ -139,14 +139,14 @@ qint64 QmlProfilerViewManager::selectionEnd() const return d->traceView->selectionEnd(); } -bool QmlProfilerViewManager::hasGlobalStats() const +bool QmlProfilerViewManager::isEventsRestrictedToRange() const { - return d->eventsView->hasGlobalStats(); + return d->eventsView->isRestrictedToRange(); } -void QmlProfilerViewManager::getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd) +void QmlProfilerViewManager::restrictEventsToRange(qint64 rangeStart, qint64 rangeEnd) { - d->eventsView->getStatisticsInRange(rangeStart, rangeEnd); + d->eventsView->restrictToRange(rangeStart, rangeEnd); } void QmlProfilerViewManager::raiseTimeline() diff --git a/src/plugins/qmlprofiler/qmlprofilerviewmanager.h b/src/plugins/qmlprofiler/qmlprofilerviewmanager.h index 80cea2d3c0a..144009e7eba 100644 --- a/src/plugins/qmlprofiler/qmlprofilerviewmanager.h +++ b/src/plugins/qmlprofiler/qmlprofilerviewmanager.h @@ -57,8 +57,8 @@ public: bool hasValidSelection() const; qint64 selectionStart() const; qint64 selectionEnd() const; - bool hasGlobalStats() const; - void getStatisticsInRange(qint64 rangeStart, qint64 rangeEnd); + bool isEventsRestrictedToRange() const; + void restrictEventsToRange(qint64 rangeStart, qint64 rangeEnd); void raiseTimeline();