I figured out what to do by combining bits of code I found in various other projects (the night clock and active screen projects mentioned above, and the qtwebengine-demo from gitlab). Here's the commit that turned my webapp into a QML app that keeps the screen on, in case it's useful to anyone else: https://github.com/jes/ubuntutouch-chessclock/commit/4b21852da96b4ecf3f8c9af12eeff48d85cb7e77