Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Button onClick not firing for touchscreen devices
Forum Updated to NodeBB v4.3 + New Features

Button onClick not firing for touchscreen devices

Scheduled Pinned Locked Moved Qt WebKit
2 Posts 1 Posters 3.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jdarnold
    wrote on 16 Sept 2013, 14:46 last edited by
    #1

    Using that latest Qt 5.1.2, a button onclick event is not firing when run on a Windows 8 touchscreen. Using Qt 5.0, it fires just fine.

    To reproduce, just create the html5application test app and change your index.html to be this:

    @<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html 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>
    [removed]
    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");
    }
    [removed]
    </head>
    <body>
    <a id="quit">X</a>
    <h1>Hello</h1>
    <h1>HTML5</h1>
    <h1>World</h1>
    <p><button type="button" >Click Me!</button></p>
    </body>
    </html>
    @

    Works fine when compiled with 5.0 (you see the javascript alert when you touch the button) but nothing shows up on the tablet when compiled against the latest Qt.

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jdarnold
      wrote on 20 Sept 2013, 16:09 last edited by
      #2

      Still not sure why this is firing - I didn't have the patience to find out how it was all supposed to work by looking at the source code - but I did find a work around. I just turn off all touch events:
      @
      vww_ui->webView->setAttribute(Qt::WA_AcceptTouchEvents, false);
      @
      Not really the best solution, but as we don't currently do anything with them, it works for us (for now).

      1 Reply Last reply
      0

      1/2

      16 Sept 2013, 14:46

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved