Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
Qt Creator 8.0.0
-
None
Description
When I use the custom component in the qml page, the design page does not display and reports an error, as shown in the figure.
The error reported is "test", so I don't know what to do.
This is my code: txetEditor.qml
import QtQuick import QtQuick.Controls import "../controls" Item { // Properties property string getText: textArea.text property string setText: "" Rectangle { id: rectangle color: "#2c313c" anchors.fill: parent Flickable { id: flickable anchors.fill: parent clip: true TextArea.flickable: TextArea{ id: textArea background: Rectangle { anchors.fill: parent color: "#2c313c" } padding: 10 wrapMode: Text.WordWrap textFormat: Text.AutoText placeholderTextColor: "#f6fbff" selectByMouse: true selectedTextColor: "#ffffff" selectionColor: "#ff007f" color: "#ffffff" font.pointSize: 12 text: setText } ScrollBar.vertical: CustomScrollBar {} // No error is reported if using the scrollbar } } }
And CustomScrollBar.qml:
import QtQuick import QtQuick.Controls // ScrollBar consists of two visual items: background and content item. ScrollBar { id: scrollBar active: true minimumSize: 0.3 position: 0.2 background: Rectangle { anchors.fill: parent color: "#2c314c" } contentItem: Rectangle { implicitWidth: 10 implicitHeight: 100 radius: 6 color: scrollBar.pressed ? "#81e889" : "#c2f4c6" // Hide the ScrollBar when it's not needed. opacity: scrollBar.policy === ScrollBar.AlwaysOn || (scrollBar.active && scrollBar.size < 1.0) ? 0.75 : 0 // Animate the changes in opacity (default duration is 250 ms). Behavior on opacity { NumberAnimation {} } } }