forked from qt-creator/qt-creator
Delay creation of the tag browser.
Change-Id: I7d82d31cb391e692ee78d6b7ac916bdbfe42978e Reviewed-on: http://codereview.qt.nokia.com/1015 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Daniel Molkentin <daniel.molkentin@nokia.com>
This commit is contained in:
committed by
Daniel Molkentin
parent
050fdf9d52
commit
5de373a974
@@ -8,16 +8,6 @@ Item {
|
||||
width: parent.width
|
||||
height: lineEdit.height
|
||||
|
||||
Connections {
|
||||
target: gettingStarted
|
||||
onTagsUpdated: {
|
||||
var tagList = gettingStarted.tagList()
|
||||
for (var tag in tagList) {
|
||||
tagsTestModel.append({ "text": tagList[tag], "value": tagList[tag] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Components.TextField {
|
||||
Behavior on width { NumberAnimation{} }
|
||||
placeholderText: !checkBox.checked ? qsTr("Search in Tutorials") : qsTr("Search in Tutorials, Examples and Demos")
|
||||
@@ -27,10 +17,6 @@ Item {
|
||||
onTextChanged: examplesModel.filterRegExp = RegExp('.*'+text, "im")
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: tagsTestModel
|
||||
}
|
||||
|
||||
Components.CheckBox {
|
||||
id: checkBox
|
||||
text: qsTr("Show Examples and Demos")
|
||||
@@ -52,7 +38,10 @@ Item {
|
||||
anchors.verticalCenter: lineEdit.verticalCenter
|
||||
visible: !examplesModel.showTutorialsOnly
|
||||
text: tag === "" ? qsTr("Filter by Tag") : qsTr("Tag Filter: %1").arg(tag)
|
||||
onClicked: tagChooser.visible = !tagChooser.visible
|
||||
onClicked: {
|
||||
tagBrowserLoader.source = "TagBrowser.qml"
|
||||
tagBrowserLoader.item.visible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
Components.ScrollArea {
|
||||
@@ -70,118 +59,8 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: tagChooser
|
||||
Loader {
|
||||
id: tagBrowserLoader
|
||||
anchors.fill: parent
|
||||
color: "darkgrey"
|
||||
visible: false
|
||||
opacity: 0.95
|
||||
radius: 6
|
||||
MouseArea { anchors.fill: parent; hoverEnabled: true } // disable mouse on background
|
||||
Text {
|
||||
id: descr;
|
||||
anchors.margins: 6;
|
||||
color: "white";
|
||||
text: qsTr("Please choose a tag to filter for:");
|
||||
anchors.top: parent.top;
|
||||
anchors.left: parent.left
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Item {
|
||||
width: rect.width
|
||||
height: rect.height
|
||||
|
||||
anchors.margins: 6;
|
||||
anchors.top: parent.top;
|
||||
anchors.right: parent.right
|
||||
|
||||
Rectangle {
|
||||
color: "red"
|
||||
id: rect
|
||||
radius: 4
|
||||
opacity: 0.3
|
||||
width: clearText.width+4
|
||||
height: clearText.height+4
|
||||
x: clearText.x-2
|
||||
y: clearText.y-2
|
||||
}
|
||||
Text { id: clearText; text: qsTr("Clear"); color: "white"; anchors.centerIn: parent }
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
tagChooser.visible = false;
|
||||
tagFilterButton.tag = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flickable
|
||||
anchors.fill: parent
|
||||
anchors.margins: 6
|
||||
anchors.topMargin: descr.height + anchors.margins*2
|
||||
contentHeight: flow.height
|
||||
contentWidth: flow.width
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
clip: true
|
||||
Flow {
|
||||
width: tagChooser.width
|
||||
id: flow
|
||||
spacing: 6
|
||||
Repeater {
|
||||
model: tagsTestModel
|
||||
delegate: Item {
|
||||
width: btnRect.width
|
||||
height: btnRect.height
|
||||
Rectangle {
|
||||
id: btnRect
|
||||
radius: 4
|
||||
opacity: 0
|
||||
width: text.width+4
|
||||
height: text.height+4
|
||||
x: text.x-2
|
||||
y: text.y-2
|
||||
}
|
||||
Text { id: text; text: model.text; color: "white"; anchors.centerIn: parent }
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "selected"
|
||||
when: mouseArea.pressed
|
||||
},
|
||||
State {
|
||||
name: "hovered"
|
||||
when: mouseArea.containsMouse
|
||||
PropertyChanges {
|
||||
target: btnRect
|
||||
color: "darkblue"
|
||||
opacity: 0.3
|
||||
}
|
||||
}
|
||||
]
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "hovered"
|
||||
to: "selected"
|
||||
ParallelAnimation {
|
||||
PropertyAction { target: tagFilterButton; property: "tag"; value: model.value }
|
||||
PropertyAction { target: tagChooser; property: "visible"; value: false }
|
||||
ColorAnimation { to: "#00000000"; duration: 0 }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
141
share/qtcreator/welcomescreen/widgets/TagBrowser.qml
Normal file
141
share/qtcreator/welcomescreen/widgets/TagBrowser.qml
Normal file
@@ -0,0 +1,141 @@
|
||||
import QtQuick 1.0
|
||||
|
||||
Rectangle {
|
||||
id: tagChooser
|
||||
|
||||
anchors.fill: parent
|
||||
color: "darkgrey"
|
||||
opacity: 0.95
|
||||
radius: 6
|
||||
visible: false
|
||||
|
||||
property bool needsUpdate: true;
|
||||
|
||||
Connections {
|
||||
target: gettingStarted
|
||||
onTagsUpdated: needsUpdate = true
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
if (visible && needsUpdate) {
|
||||
needsUpdate = false;
|
||||
tagsModel.clear();
|
||||
var tagList = gettingStarted.tagList()
|
||||
for (var tag in tagList) {
|
||||
tagsModel.append({ "text": tagList[tag], "value": tagList[tag] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: tagsModel
|
||||
}
|
||||
|
||||
MouseArea { anchors.fill: parent; hoverEnabled: true } // disable mouse on background
|
||||
Text {
|
||||
id: descr;
|
||||
anchors.margins: 6;
|
||||
color: "white";
|
||||
text: qsTr("Please choose a tag to filter for:");
|
||||
anchors.top: parent.top;
|
||||
anchors.left: parent.left
|
||||
font.bold: true
|
||||
}
|
||||
|
||||
Item {
|
||||
width: rect.width
|
||||
height: rect.height
|
||||
|
||||
anchors.margins: 6;
|
||||
anchors.top: parent.top;
|
||||
anchors.right: parent.right
|
||||
|
||||
Rectangle {
|
||||
color: "red"
|
||||
id: rect
|
||||
radius: 4
|
||||
opacity: 0.3
|
||||
width: clearText.width+4
|
||||
height: clearText.height+4
|
||||
x: clearText.x-2
|
||||
y: clearText.y-2
|
||||
}
|
||||
Text { id: clearText; text: qsTr("Clear"); color: "white"; anchors.centerIn: parent }
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onClicked: {
|
||||
tagChooser.visible = false;
|
||||
tagFilterButton.tag = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flickable
|
||||
anchors.fill: parent
|
||||
anchors.margins: 6
|
||||
anchors.topMargin: descr.height + anchors.margins*2
|
||||
contentHeight: flow.height
|
||||
contentWidth: flow.width
|
||||
flickableDirection: Flickable.VerticalFlick
|
||||
clip: true
|
||||
Flow {
|
||||
width: tagChooser.width
|
||||
id: flow
|
||||
spacing: 6
|
||||
Repeater {
|
||||
id: tagsList
|
||||
model: tagsModel
|
||||
delegate: Item {
|
||||
width: btnRect.width
|
||||
height: btnRect.height
|
||||
Rectangle {
|
||||
id: btnRect
|
||||
radius: 4
|
||||
opacity: 0
|
||||
width: text.width+4
|
||||
height: text.height+4
|
||||
x: text.x-2
|
||||
y: text.y-2
|
||||
}
|
||||
Text { id: text; text: model.text; color: "white"; anchors.centerIn: parent }
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "selected"
|
||||
when: mouseArea.pressed
|
||||
},
|
||||
State {
|
||||
name: "hovered"
|
||||
when: mouseArea.containsMouse
|
||||
PropertyChanges {
|
||||
target: btnRect
|
||||
color: "darkblue"
|
||||
opacity: 0.3
|
||||
}
|
||||
}
|
||||
]
|
||||
transitions: [
|
||||
Transition {
|
||||
from: "hovered"
|
||||
to: "selected"
|
||||
ParallelAnimation {
|
||||
PropertyAction { target: tagFilterButton; property: "tag"; value: model.value }
|
||||
PropertyAction { target: tagChooser; property: "visible"; value: false }
|
||||
ColorAnimation { to: "#00000000"; duration: 0 }
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user