~iahmad/kubuntu-packaging/qtcreator

« back to all changes in this revision

Viewing changes to src/plugins/qmlprofiler/qml/MainView.qml

  • Committer: Timo Jyrinki
  • Date: 2014-01-15 07:44:24 UTC
  • mfrom: (1.1.30)
  • Revision ID: timo.jyrinki@canonical.com-20140115074424-3pnj3a1x6s25im9v
ImportĀ upstreamĀ versionĀ 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
        onRangeChanged: {
77
77
            var startTime = zoomControl.startTime();
78
78
            var endTime = zoomControl.endTime();
79
 
            var duration = Math.abs(endTime - startTime);
80
79
 
81
 
            mainviewTimePerPixel = duration / root.width;
 
80
            mainviewTimePerPixel = Math.abs(endTime - startTime) / root.width;
82
81
 
83
82
            backgroundMarks.updateMarks(startTime, endTime);
84
83
            view.updateFlickRange(startTime, endTime);
85
 
            if (duration > 0) {
86
 
                var candidateWidth = qmlProfilerModelProxy.traceDuration() *
87
 
                        flick.width / duration;
88
 
                if (flick.contentWidth !== candidateWidth)
89
 
                    flick.contentWidth = candidateWidth;
90
 
            }
91
 
 
 
84
            flick.setContentWidth();
92
85
        }
93
86
    }
94
87
 
309
302
        boundsBehavior: Flickable.StopAtBounds
310
303
 
311
304
        // ScrollView will try to deinteractivate it. We don't want that
312
 
        // as the horizontal flickable is interactive, too.
313
 
        onInteractiveChanged: interactive = true
 
305
        // as the horizontal flickable is interactive, too. We do occasionally
 
306
        // switch to non-interactive ourselves, though.
 
307
        property bool stayInteractive: true
 
308
        onInteractiveChanged: interactive = stayInteractive
 
309
        onStayInteractiveChanged: interactive = stayInteractive
314
310
 
315
311
        // ***** child items
316
312
        TimeMarks {
322
318
        }
323
319
 
324
320
        Flickable {
 
321
            function setContentWidth() {
 
322
                var duration = Math.abs(zoomControl.endTime() - zoomControl.startTime());
 
323
                if (duration > 0)
 
324
                    contentWidth = qmlProfilerModelProxy.traceDuration() * width / duration;
 
325
            }
 
326
 
325
327
            id: flick
326
328
            anchors.top: parent.top
327
329
            anchors.topMargin: labels.y
333
335
            boundsBehavior: Flickable.StopAtBounds
334
336
 
335
337
            onContentXChanged: view.updateZoomControl()
 
338
            onWidthChanged: setContentWidth()
 
339
 
336
340
            clip:true
337
341
 
338
342
            SelectionRange {
429
433
                onPressed:  {
430
434
                    selectionRange.pressedOnCreation();
431
435
                }
 
436
                onCanceled: {
 
437
                    selectionRange.releasedOnCreation();
 
438
                }
432
439
                onPositionChanged: {
433
440
                    selectionRange.movedOnCreation();
434
441
                }
508
515
        x: 0
509
516
        y: 0
510
517
 
511
 
        function toggleEnabled() {enabled = !enabled}
512
 
        function toggleVisible() {visible = !visible}
513
518
        function updateZoomLevel() {
514
519
            zoomSlider.externalUpdate = true;
515
520
            zoomSlider.value = Math.pow((view.endTime - view.startTime) / qmlProfilerModelProxy.traceDuration(), 1 / zoomSlider.exponent) * zoomSlider.maximumValue;