Commit 3a4600c
committed
fix: prevent itemSpacing override in setBackgroundType
1. Removed automatic itemSpacing adjustment in
DListView::setBackgroundType
2. Added itemSpacing() method in DStyledItemDelegate to dynamically
calculate spacing based on background type
3. Changed itemSpacing member to spacing with default value -1 to
indicate custom spacing
4. Updated all references to use the new itemSpacing() method
The changes prevent the itemSpacing value from being unintentionally
overwritten when setting backgroundType, while maintaining backward
compatibility with the default spacing values for different background
types. This gives more control to developers to set custom spacing
values that won't be overridden by background type changes.
fix: 修复设置背景类型时覆盖itemSpacing值的问题
1. 移除了DListView::setBackgroundType中自动调整itemSpacing的逻辑
2. 在DStyledItemDelegate中添加itemSpacing()方法根据背景类型动态计算间距
3. 将itemSpacing成员改为spacing并设置默认值-1表示自定义间距
4. 更新所有引用以使用新的itemSpacing()方法
这些修改防止了在设置backgroundType时意外覆盖itemSpacing值的问题,同时保
持了对不同背景类型默认间距值的向后兼容性。这为开发者提供了更多控制权,可
以设置不会被背景类型更改覆盖的自定义间距值。1 parent a21622a commit 3a4600c
2 files changed
+20
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
776 | 776 | | |
777 | 777 | | |
778 | 778 | | |
779 | | - | |
780 | | - | |
781 | | - | |
782 | | - | |
783 | | - | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | 779 | | |
788 | 780 | | |
789 | 781 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
519 | 532 | | |
520 | 533 | | |
521 | 534 | | |
522 | | - | |
| 535 | + | |
523 | 536 | | |
524 | 537 | | |
525 | 538 | | |
| |||
1176 | 1189 | | |
1177 | 1190 | | |
1178 | 1191 | | |
1179 | | - | |
| 1192 | + | |
1180 | 1193 | | |
1181 | | - | |
| 1194 | + | |
1182 | 1195 | | |
1183 | 1196 | | |
1184 | 1197 | | |
| |||
1253 | 1266 | | |
1254 | 1267 | | |
1255 | 1268 | | |
1256 | | - | |
| 1269 | + | |
1257 | 1270 | | |
1258 | 1271 | | |
1259 | 1272 | | |
| |||
1297 | 1310 | | |
1298 | 1311 | | |
1299 | 1312 | | |
1300 | | - | |
| 1313 | + | |
1301 | 1314 | | |
1302 | 1315 | | |
1303 | 1316 | | |
| |||
1353 | 1366 | | |
1354 | 1367 | | |
1355 | 1368 | | |
1356 | | - | |
| 1369 | + | |
1357 | 1370 | | |
1358 | | - | |
| 1371 | + | |
1359 | 1372 | | |
1360 | 1373 | | |
1361 | 1374 | | |
| |||
0 commit comments