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