import QtQuick 2.2
import QtQuick.Window 2.1
import QtQuick.Controls 1.1
ApplicationWindow {
flags: Qt.FramelessWindowHint
width: 500
height: 500
x: (Screen.width - width) / 2
y: (Screen.height - height) / 2
color: "black"
opacity: 0.8
Flickable {
anchors.fill: parent
contentWidth: html.paintedWidth
contentHeight: html.paintedHeight
boundsBehavior: Flickable.StopAtBounds
TextEdit {
id: html
objectName: "html"
anchors.fill: parent
textFormat: TextEdit.RichText
focus: true
Keys.onEscapePressed: Qt.quit()
font.family: "Droid Sans Mono"
font.pointSize: 11
selectByMouse: true
readOnly: true
MouseArea {
anchors.fill: parent
propagateComposedEvents: true
onClicked: {
console.log("clicked")
mouse.accepted = false
}
}
}
}
}
我无法点击“点击”...好像propagateComposedEvents
和mouse.accepted
似乎没有按预期工作。
我正在使用Qt 5.3 Beta。
答案 0 :(得分:0)
contentWidth /高度错误,
import QtQuick 2.2
import QtQuick.Window 2.1
import QtQuick.Controls 1.1
ApplicationWindow {
flags: Qt.FramelessWindowHint
width: 500
height: 500
x: (Screen.width - width) / 2
y: (Screen.height - height) / 2
//color: "black"
opacity: 0.8
visible: true
Flickable {
anchors.fill: parent
//contentWidth: html.paintedWidth
//contentHeight: html.paintedHeight
boundsBehavior: Flickable.StopAtBounds
TextEdit {
id: html
objectName: "html"
anchors.fill: parent
textFormat: TextEdit.RichText
focus: true
Keys.onEscapePressed: Qt.quit()
font.family: "Droid Sans Mono"
font.pointSize: 11
selectByMouse: true
readOnly: true
text: "hello world"
MouseArea {
anchors.fill: parent
propagateComposedEvents: true
onClicked: {
console.log("clicked")
mouse.accepted = false
}
}
}
}
}