Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. Enable auto-rotation in QWebView

Enable auto-rotation in QWebView

Scheduled Pinned Locked Moved Language Bindings
2 Posts 1 Posters 2.8k Views
  • 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
    jsmanrique
    wrote on last edited by
    #1

    Perhaps it has been answered before, but I have tried a simple WebView PySide sample:

    @import sys

    from PySide.QtCore import *
    from PySide.QtGui import *
    from PySide.QtWebKit import *
    from PySide.QtOpenGL import *

    create Qt app

    app = QApplication(sys.argv)

    create webview

    mWebView = QWebView()
    mWebView.setRenderHints(QPainter.SmoothPixmapTransform)

    settings

    mSettings = mWebView.settings()
    mSettings.setAttribute(QWebSettings.LocalStorageEnabled, True)
    mSettings.setAttribute(QWebSettings.OfflineStorageDatabaseEnabled, True)
    mSettings.setAttribute(QWebSettings.OfflineWebApplicationCacheEnabled, True)
    mSettings.enablePersistentStorage(path=sys.path[0])

    load url and show

    mWebView.load(QUrl('http://www.nokia.com'))
    mWebView.show()

    enter the loop

    sys.exit(app.exec_())@

    But, when I try it on a N9x0 device, it doesn't rotate... I supose that it needs to use qt-mobility pack, but... how to enabling auto-rotation?

    Thank you very much and best regards

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jsmanrique
      wrote on last edited by
      #2

      I have changed to qml instead of pure python gui definition. Now I use this qml file, and it seems to work as expected:
      @import QtQuick 1.0
      import QtWebKit 1.0
      import com.nokia.meego 1.0

      Window {
      id: rootWindow
      WebView {
      id: webView
      anchors.fill: parent

      settings.javascriptEnabled: true
      settings.localStorageDatabaseEnabled: true
      settings.offlineStorageDatabaseEnabled: true
      settings.offlineWebApplicationCacheEnabled: true

      url: 'http://www.nokia.com'
      }
      }@

      1 Reply Last reply
      0

      • Login

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