Commit ce7797da authored by Pierre Rossi's avatar Pierre Rossi Committed by Allan Sandfeld Jensen
Browse files

Settings in test browser


Expose some "testable" settings as well as test the integration with
the QML Settings API.

Change-Id: I7ec6a7e695f60338b2c16a648e9a93b64ea29a94
Reviewed-by: default avatarJocelyn Turcotte <jocelyn.turcotte@digia.com>
Showing with 27 additions and 0 deletions
...@@ -41,11 +41,14 @@ ...@@ -41,11 +41,14 @@
import QtQuick 2.1 import QtQuick 2.1
import QtWebEngine 1.0 import QtWebEngine 1.0
import QtWebEngine.experimental 1.0 import QtWebEngine.experimental 1.0
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Window 2.1 import QtQuick.Window 2.1
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
import Qt.labs.settings 1.0
ApplicationWindow { ApplicationWindow {
id: browserWindow id: browserWindow
...@@ -64,6 +67,11 @@ ApplicationWindow { ...@@ -64,6 +67,11 @@ ApplicationWindow {
visible: true visible: true
title: currentWebView && currentWebView.title title: currentWebView && currentWebView.title
Settings {
property alias autoLoadImages: loadImages.checked;
property alias javaScriptEnabled: javaScriptEnabled.checked;
}
// Make sure the Qt.WindowFullscreenButtonHint is set on Mac. // Make sure the Qt.WindowFullscreenButtonHint is set on Mac.
Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint Component.onCompleted: flags = flags | Qt.WindowFullscreenButtonHint
...@@ -190,6 +198,25 @@ ApplicationWindow { ...@@ -190,6 +198,25 @@ ApplicationWindow {
text: currentWebView && currentWebView.url text: currentWebView && currentWebView.url
onAccepted: currentWebView.url = utils.fromUserInput(text) onAccepted: currentWebView.url = utils.fromUserInput(text)
} }
ToolButton {
id: settingsMenuButton
menu: Menu {
MenuItem {
id: loadImages
text: "Autoload images"
checkable: true
checked: WebEngine.settings.autoLoadImages
onCheckedChanged: WebEngine.settings.autoLoadImages = checked
}
MenuItem {
id: javaScriptEnabled
text: "JavaScript On"
checkable: true
checked: WebEngine.settings.javascriptEnabled
onCheckedChanged: WebEngine.settings.javascriptEnabled = checked
}
}
}
} }
ProgressBar { ProgressBar {
id: progressBar id: progressBar
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment