Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. QtQuick ListView Delegate自适应行高
Qt 6.11 is out! See what's new in the release blog

QtQuick ListView Delegate自适应行高

Scheduled Pinned Locked Moved Unsolved Chinese
2 Posts 2 Posters 2.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    Zyney
    wrote on last edited by
    #1

    就像QtCreator 示例中的ContactList一样
    如果有一个 元素是Text
    而且这个Text的wrapMode 是WordWrap

    那么第一次显示的时候就会出现 QML ItemDelegate: Binding loop detected for property "implicitHeight"
    这种情况应该怎么解决 呢
    尝试过使用lineCount * lineheight 设置固定高度,但是好像 不生效

    1 Reply Last reply
    0
    • jiancaiyangJ Offline
      jiancaiyangJ Offline
      jiancaiyang
      wrote on last edited by
      #2

      自适应高度需要在Delegate做到父控件根据子控件的大小来改变大小。一个有用的属性是
      Item::childrenRect。
      Qt Quick Controls 2里面的控件布置得都挺好的,因为都继承Control这个类。

      我们自己的论坛:http://qtdream.com
      擅长三维角色仿真动画。

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved