diff options
author | Mahmoud Badri <mahmoud.badri@qt.io> | 2022-02-28 15:24:33 +0200 |
---|---|---|
committer | Mahmoud Badri <mahmoud.badri@qt.io> | 2022-02-28 13:33:27 +0000 |
commit | 5d770bc8c4ca215e48d38104b21b98060b81e381 (patch) | |
tree | c7e81fa4199a837cefcaeda5fd7f067613bf7a3b /share | |
parent | 09f9ed14eb9d5c9ef9e5c8fbb13e494ed7e684a5 (diff) |
QmlDesigner: Fix overlap of empty assets placeholder and search box
Change-Id: I959073fb037fad6d960821297d8546951e748343
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'share')
-rw-r--r-- | share/qtcreator/qmldesigner/itemLibraryQmlSources/Assets.qml | 104 |
1 files changed, 56 insertions, 48 deletions
diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/Assets.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/Assets.qml index 9ec7d8fcf3..ad4ec007cc 100644 --- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/Assets.qml +++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/Assets.qml @@ -394,6 +394,8 @@ Item { spacing: 5 Row { + id: searchRow + width: parent.width SearchBox { @@ -419,6 +421,60 @@ Item { visible: assetsModel.isEmpty && !searchBox.isEmpty() } + + Item { // placeholder when the assets library is empty + width: parent.width + height: parent.height - searchRow.height + visible: assetsModel.isEmpty && searchBox.isEmpty() + clip: true + + Column { + id: colNoAssets + + spacing: 20 + x: 20 + width: rootItem.width - 2 * x + anchors.verticalCenter: parent.verticalCenter + + Text { + text: qsTr("Looks like you don't have any assets yet.") + color: StudioTheme.Values.themeTextColor + font.pixelSize: 18 + width: colNoAssets.width + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + } + + Image { + source: "image://qmldesigner_assets/browse" + anchors.horizontalCenter: parent.horizontalCenter + scale: maBrowse.containsMouse ? 1.2 : 1 + Behavior on scale { + NumberAnimation { + duration: 300 + easing.type: Easing.OutQuad + } + } + + MouseArea { + id: maBrowse + anchors.fill: parent + hoverEnabled: true + onClicked: rootView.handleAddAsset(); + } + } + + Text { + text: qsTr("Drag-and-drop your assets here or click the '+' button to browse assets from the file system.") + color: StudioTheme.Values.themeTextColor + font.pixelSize: 18 + width: colNoAssets.width + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + } + } + } + ScrollView { // TODO: experiment using ListView instead of ScrollView + Column id: assetsView width: parent.width @@ -603,52 +659,4 @@ Item { } } } - - // Placeholder when the assets panel is empty - Column { - id: colNoAssets - visible: assetsModel.isEmpty && searchBox.isEmpty() - - spacing: 20 - x: 20 - width: rootItem.width - 2 * x - anchors.verticalCenter: parent.verticalCenter - - Text { - text: qsTr("Looks like you don't have any assets yet.") - color: StudioTheme.Values.themeTextColor - font.pixelSize: 18 - width: colNoAssets.width - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.WordWrap - } - - Image { - source: "image://qmldesigner_assets/browse" - anchors.horizontalCenter: parent.horizontalCenter - scale: maBrowse.containsMouse ? 1.2 : 1 - Behavior on scale { - NumberAnimation { - duration: 300 - easing.type: Easing.OutQuad - } - } - - MouseArea { - id: maBrowse - anchors.fill: parent - hoverEnabled: true - onClicked: rootView.handleAddAsset(); - } - } - - Text { - text: qsTr("Drag-and-drop your assets here or click the '+' button to browse assets from the file system.") - color: StudioTheme.Values.themeTextColor - font.pixelSize: 18 - width: colNoAssets.width - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.WordWrap - } - } } |