2

使用最新的 Qt 5.1.2,在 Windows 8 触摸屏上运行时不会触发按钮 onclick 事件。使用 Qt 5.0,它触发得很好。

要重现,只需创建 html5application 测试应用程序并将您的 index.html 更改为这个(即,添加按钮和 onclick 处理程序)。当针对 5.0 构建并在 Windows 8 平板电脑上运行时,当您触摸按钮时,您会看到 javascript 警报。当针对最新的 Qt 5.1.2 编译时,您不会得到任何反馈。

对我做错的任何事情有任何想法吗?这是最新 Qt 中的错误还是功能?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
        body { margin: 0; font-size: 2em; background-color: white; }
        h1 { text-align: center; color: red; }
        h1 + h1 { color: green; }
        h1:last-child { color: blue; }
        #quit { background-color: gray; color: white; font-weight: bold; display: block; text-align: right; }
    </style>
    <script type="text/javascript">
        var counter = 0;
        function toggleElement()
        {
            var elements = document.getElementsByTagName('h1');
            for (var i = 0; i < elements.length; ++i)
                elements[i].style.display = (counter % elements.length) == i ? '' : 'none';
            counter++;
            setTimeout('toggleElement()', 1000);
        }
        window.onload = function()
        {
            document.getElementById("quit").onmousedown = function()
            {
                Qt.quit();
            };
            toggleElement();
        }
        function clicked()
        {
            alert("Clicked");
        }
    </script>
</head>
<body>
    <a id="quit">X</a>
    <h1>Hello</h1>
    <h1>HTML5</h1>
    <h1>World</h1>
    <p><button type="button" onclick="clicked()">Click Me!</button></p>
</body>
</html>
4

0 回答 0