QmlDesigner: Remove flexible width from Component Library items

...so that resizing the view doesn't cause sluggish animation to the
items.
Also removed an unnecessary top padding from the horizontal lib to
avoid a slight vertical jump when switching between the 2 layouts.

Change-Id: I0af75db885398dc93fc234d760156a55042f59d0
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Mahmoud Badri
2021-12-08 14:29:51 +02:00
parent d22a6a66fd
commit 5453c539b5

View File

@@ -266,8 +266,7 @@ Item {
Grid { Grid {
id: itemGrid id: itemGrid
property real actualWidth: parent.width - itemGrid.leftPadding -itemGrid.rightPadding property real actualWidth: parent.width - itemGrid.leftPadding - itemGrid.rightPadding
property int flexibleWidth: (itemGrid.actualWidth / columns) - styleConstants.cellWidth
leftPadding: 6 leftPadding: 6
rightPadding: 6 rightPadding: 6
@@ -280,7 +279,7 @@ Item {
visible: itemVisible visible: itemVisible
textColor: importUnimported ? StudioTheme.Values.themeUnimportedModuleColor textColor: importUnimported ? StudioTheme.Values.themeUnimportedModuleColor
: StudioTheme.Values.themeTextColor : StudioTheme.Values.themeTextColor
width: styleConstants.cellWidth + itemGrid.flexibleWidth width: styleConstants.cellWidth
height: styleConstants.cellHeight height: styleConstants.cellHeight
onShowContextMenu: { onShowContextMenu: {
if (!itemUsable) { if (!itemUsable) {
@@ -304,7 +303,7 @@ Item {
id: horizontalView id: horizontalView
Row { Row {
padding: 5 leftPadding: 5
ScrollView { ScrollView {
id: horizontalScrollView id: horizontalScrollView
@@ -421,7 +420,6 @@ Item {
Grid { Grid {
id: hItemGrid id: hItemGrid
property real actualWidth: itemsView.width - 294 property real actualWidth: itemsView.width - 294
property int flexibleWidth: (hItemGrid.actualWidth / hItemGrid.columns) - styleConstants.cellWidth
leftPadding: 9 leftPadding: 9
rightPadding: 9 rightPadding: 9
@@ -435,7 +433,7 @@ Item {
visible: itemVisible visible: itemVisible
textColor: itemLibraryModel.importUnimportedSelected textColor: itemLibraryModel.importUnimportedSelected
? StudioTheme.Values.themeUnimportedModuleColor : StudioTheme.Values.themeTextColor ? StudioTheme.Values.themeUnimportedModuleColor : StudioTheme.Values.themeTextColor
width: styleConstants.cellWidth + hItemGrid.flexibleWidth width: styleConstants.cellWidth
height: styleConstants.cellHeight height: styleConstants.cellHeight
onShowContextMenu: { onShowContextMenu: {
if (!itemUsable) { if (!itemUsable) {