我想使Flickable區域中的Scrollbar.vertical始終可見。目前它在點擊時可見。此外,文本區域與滾動條重疊。我怎樣才能sepearate與文本區滾動條下面的QML代碼如何使滾動條在QML中的Flckable上始終可見
import QtQuick 2.0
import QtQuick.Controls 2.0
Flickable {
id: flickable
anchors.fill: parent
TextArea.flickable: TextArea {
text: "The Qt QML module provides a framework for developing applications and libraries with the QML language.
It defines and implements the language and engine infrastructure, and provides an API to enable application developers to
extend the QML language with custom types and integrate QML code with JavaScript and C++.
The Qt QML module provides both a QML API and a C++ API.
Note that while the Qt QML module provides the language and infrastructure for QML applications,
the Qt Quick module provides many visual components, model-view support, an animation framework,
and much more for building user interfaces.
For those new to QML and Qt Quick, please see QML Applications for an introduction to writing QML applications."
wrapMode: TextArea.Wrap
font.pixelSize: 20
}
ScrollBar.vertical: ScrollBar {
width: 40
}
}
您可以輕鬆創建一個「獨立」項並通過綁定到flickable的屬性來控制它,而不是使用默認的內置行爲。 – dtech
@ddriver:這是一個簡單的解決方案。但我試圖有效地使用默認的一個 – Bupa
你可以嘗試設置'active:true'。根據文檔,當滾動條可見時這是真的。它用於例如[使滾動條的可見性依賴於彼此](http://doc.qt.io/qt-5/qml-qtquick-controls2-scrollbar.html#binding-the-active-state-of-horizontal-and-垂直滾動條)。 – BaCaRoZzo