【问题标题】:Qt QML TextEdit component do no get a slidebar when the text is to large to fit当文本太大而无法容纳时,Qt QML TextEdit 组件没有滑动条
【发布时间】:2012-09-04 18:56:05
【问题描述】:

SDK:Qt Creator 2.4.1

目标:诺基亚 N9 和 Windows 7

如果我在 qml 文件中执行以下操作

import QtQuick 1.1
import com.nokia.meego 1.0


Page {
    id: myShowChangeLogPage


     TextEdit  {
        id: changeLogArea
        anchors.top: titleBackground.bottom
        width: parent.width
        height: 300
        text: "1\n1\n1\n1\n2\n1\n1\n1\n1\n1\n3\n1\n1\n1\n4\n1\n1\n1\n1\n5\n1\n1\n1\n6\n1\n1\n1\n7\n1\n1\n1\n8\n\n\n\n\n9"
        font.pixelSize: 20
        textFormat: TextEdit.AutoText
        readOnly: true
        wrapMode: TextEdit.WordWrap
    }
}

TextEdit 区域的行为不符合我的预期。

  1. String 将打印在 TextEdit 区域的大小之外,即 它在屏幕底部边缘下方继续。

  2. 右侧没有滚动条/滑块

我期待 TextEdit 元素应该自动创建一个 如果字符串太大而无法容纳在边界内,则滚动条/滑块。

我被告知 TextEdit 应该这样做,并且不需要闪烁 或 ScrollArea。

我尝试过其他类型的组件,例如 Text 和 TextEdit 并且还封装了 TextEdit 在一个矩形中没有任何运气。

问候

【问题讨论】:

    标签: qt qml


    【解决方案1】:

    我在有关 TextEdit 元素的文档开头阅读了此内容:

    请注意,TextEdit 不实现滚动,遵循 光标或其他特定于外观的行为。

    还有一个完整的例子说明如何实现跟随光标的滚动。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-30
      • 1970-01-01
      • 2011-11-05
      • 1970-01-01
      相关资源
      最近更新 更多