QmlProfiler: removed scrollbar, timeline stretches automatically

Change-Id: Ibc012d517556914e61ccbf58245a6d83cb4c8a80
Reviewed-by: Kai Koehne
Reviewed-on: http://codereview.qt.nokia.com/429
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Christiaan Janssen
2011-06-09 14:54:56 +02:00
committed by Kai Koehne
parent 5e786fd128
commit 74f1c2e277
6 changed files with 15 additions and 124 deletions

View File

@@ -152,14 +152,14 @@ Rectangle {
anchors.left: labels.right anchors.left: labels.right
anchors.bottom: canvas.top anchors.bottom: canvas.top
contentWidth: view.totalWidth contentWidth: view.totalWidth
contentHeight: view.height contentHeight: height
flickableDirection: Flickable.HorizontalFlick flickableDirection: Flickable.HorizontalFlick
TimelineView { TimelineView {
id: view id: view
width: flick.width; width: flick.width;
height: 50 * 5; height: flick.contentHeight;
startX: flick.contentX startX: flick.contentX
onStartXChanged: { onStartXChanged: {
@@ -192,7 +192,8 @@ Rectangle {
mouseArea.exited() mouseArea.exited()
} }
height: 50 height: view.height / labels.rowCount
y: type * view.height / labels.rowCount;
gradient: Gradient { gradient: Gradient {
GradientStop { position: 0.0; color: myColor } GradientStop { position: 0.0; color: myColor }
GradientStop { position: 0.5; color: Qt.darker(myColor, 1.1) } GradientStop { position: 0.5; color: Qt.darker(myColor, 1.1) }
@@ -241,20 +242,6 @@ Rectangle {
} }
} }
VerticalScrollbar {
id: verticalScrollbar
flickable: flick
anchors.top: parent.top
anchors.right : flick.right
anchors.bottom : canvas.top
anchors.topMargin: 1
anchors.bottomMargin: 1
anchors.rightMargin: 0
anchors.leftMargin: 0
width: 10
}
//popup showing the details for the hovered range //popup showing the details for the hovered range
RangeDetails { RangeDetails {
id: rangeDetails id: rangeDetails
@@ -267,13 +254,16 @@ Rectangle {
y: -flick.contentY y: -flick.contentY
height: flick.contentHeight height: flick.contentHeight
property int rowCount: 5
Column { Column {
id: col
//### change to use Repeater + Plotter.names? //### change to use Repeater + Plotter.names?
Label { text: "Painting" } Label { text: "Painting"; height: labels.height/labels.rowCount}
Label { text: "Compiling" } Label { text: "Compiling"; height: labels.height/labels.rowCount }
Label { text: "Creating" } Label { text: "Creating"; height: labels.height/labels.rowCount }
Label { text: "Binding" } Label { text: "Binding"; height: labels.height/labels.rowCount }
Label { text: "Signal Handler" } Label { text: "Signal Handler"; height: labels.height/labels.rowCount }
} }
//right border divider //right border divider

View File

@@ -1,96 +0,0 @@
import QtQuick 1.0
Item {
property variant flickable: this;
property int viewPosition: 0;
property int viewSize: ( flickable.height>=0 ? flickable.height : 0 );
property int contentSize: ( flickable.contentHeight >= 0 ? flickable.contentHeight : 0 );
id: verticalScrollbar
onViewPositionChanged: flickable.contentY = viewPosition;
onViewSizeChanged: {
if ((contentSize > viewSize) && (viewPosition > contentSize - viewSize))
viewPosition = contentSize - viewSize;
}
onContentSizeChanged: {
contentSizeDecreased();
}
function contentSizeDecreased() {
if ((contentSize > viewSize) && (viewPosition > contentSize - viewSize))
viewPosition = contentSize - viewSize;
}
Rectangle {
id: groove
height: parent.height - 4
width: 6
color: "#FFFFFF"
radius: 3
border.width: 1
border.color: "#666666"
anchors.top: parent.top
anchors.topMargin: 2
anchors.bottom: parent.bottom
anchors.bottomMargin: 2
anchors.horizontalCenter: parent.horizontalCenter
y: 2
}
// the scrollbar
Item {
id: bar
height: parent.height
width: parent.width
y: Math.floor( (verticalScrollbar.contentSize > 0 ? verticalScrollbar.viewPosition * verticalScrollbar.height / verticalScrollbar.contentSize : 0));
Rectangle {
id: handle
height: {
if (verticalScrollbar.contentSize > 0) {
if (verticalScrollbar.viewSize > verticalScrollbar.contentSize || parent.height < 0) {
verticalScrollbar.visible = false;
return parent.height;
} else {
verticalScrollbar.visible = true;
return Math.floor(verticalScrollbar.viewSize / verticalScrollbar.contentSize * parent.height);
}
} else {
return 0;
}
}
width: parent.width
y:0
border.color: "#666666"
border.width: 1
radius: 3
gradient: Gradient {
GradientStop { position: 0.20; color: "#CCCCCC" }
GradientStop { position: 0.23; color: "#AAAAAA" }
GradientStop { position: 0.85; color: "#888888" }
}
MouseArea {
property int dragging:0;
property int originalY:0;
anchors.fill: parent
onPressed: { dragging = 1; originalY = mouse.y; }
onReleased: { dragging = 0; }
onPositionChanged: {
if (dragging) {
var newY = mouse.y - originalY + bar.y;
if (newY<0) newY=0;
if (newY>verticalScrollbar.height - handle.height)
newY=verticalScrollbar.height - handle.height;
verticalScrollbar.viewPosition = (newY * verticalScrollbar.contentSize / verticalScrollbar.height);
}
}
}
}
}
}

View File

@@ -12,6 +12,5 @@
<file>RecordButton.qml</file> <file>RecordButton.qml</file>
<file>ToolButton.qml</file> <file>ToolButton.qml</file>
<file>analyzer_category_small.png</file> <file>analyzer_category_small.png</file>
<file>VerticalScrollbar.qml</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@@ -50,8 +50,7 @@ OTHER_FILES += \
qml/RangeMover.qml \ qml/RangeMover.qml \
qml/RecordButton.qml \ qml/RecordButton.qml \
qml/ToolButton.qml \ qml/ToolButton.qml \
qml/MainView.js \ qml/MainView.js
qml/VerticalScrollbar.qml
FORMS += \ FORMS += \
qmlprofilerattachdialog.ui qmlprofilerattachdialog.ui

View File

@@ -221,7 +221,6 @@ void TimelineView::updateTimeline(bool updateStartX)
} }
ctxt->setContextProperty("label", label); ctxt->setContextProperty("label", label);
ctxt->setContextProperty("type", type); ctxt->setContextProperty("type", type);
item->setY(type*50);
item->setParentItem(this); item->setParentItem(this);
} }
if (item) { if (item) {

View File

@@ -279,8 +279,8 @@ TraceWindow::TraceWindow(QWidget *parent)
setLayout(groupLayout); setLayout(groupLayout);
// Maximum height: 5 rows of 50 pixels + scrollbar of 50 pixels // Minimum height: 5 rows of 20 pixels + scrollbar of 50 pixels + 20 pixels margin
// setFixedHeight(300); setMinimumHeight(170);
} }
TraceWindow::~TraceWindow() TraceWindow::~TraceWindow()