summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-06-27 16:52:21 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-06-27 16:52:35 +0200
commitec5a99b0515779ff5ec3df6bd657127b4e037823 (patch)
treec5dc52e8892b6740123469276dcb303a81d9fd56 /examples
parent56bea56b2d8fabc4b09d41531177a22d9297ce2c (diff)
parent722732d1f089630ad517aef8f94325a51186b274 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Diffstat (limited to 'examples')
-rw-r--r--examples/webengine/minimal/doc/src/minimal.qdoc7
-rw-r--r--examples/webengine/minimal/main.cpp2
-rw-r--r--examples/webengine/quicknanobrowser/main.cpp2
-rw-r--r--examples/webenginewidgets/contentmanipulation/main.cpp1
-rw-r--r--examples/webenginewidgets/cookiebrowser/main.cpp1
-rw-r--r--examples/webenginewidgets/demobrowser/history.cpp10
-rw-r--r--examples/webenginewidgets/demobrowser/history.h2
-rw-r--r--examples/webenginewidgets/demobrowser/main.cpp1
-rw-r--r--examples/webenginewidgets/markdowneditor/main.cpp1
-rw-r--r--examples/webenginewidgets/minimal/doc/src/minimal.qdoc5
-rw-r--r--examples/webenginewidgets/minimal/main.cpp1
-rw-r--r--examples/webenginewidgets/simplebrowser/main.cpp2
12 files changed, 28 insertions, 7 deletions
diff --git a/examples/webengine/minimal/doc/src/minimal.qdoc b/examples/webengine/minimal/doc/src/minimal.qdoc
index c0b89ba5a..5d7ca45e7 100644
--- a/examples/webengine/minimal/doc/src/minimal.qdoc
+++ b/examples/webengine/minimal/doc/src/minimal.qdoc
@@ -50,8 +50,11 @@
\skipto #include
\printto main
- In the main function we first instantiate a QGuiApplication object.
- We then call \l{QtWebEngine::initialize}, which makes sure that OpenGL
+ In the \c main function we first set the Qt::AA_EnableHighDpiScaling
+ attribute. This lets the web view automatically scale on high-dpi displays.
+ Then we instantiate a QGuiApplication object.
+
+ Next, we call \l{QtWebEngine::initialize}, which makes sure that OpenGL
contexts can be shared between the main process and the dedicated renderer
process (\c QtWebEngineProcess). This method needs to be called before
any OpenGL context is created.
diff --git a/examples/webengine/minimal/main.cpp b/examples/webengine/minimal/main.cpp
index cc5a1f61e..099b70707 100644
--- a/examples/webengine/minimal/main.cpp
+++ b/examples/webengine/minimal/main.cpp
@@ -44,7 +44,9 @@
int main(int argc, char *argv[])
{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
+
QtWebEngine::initialize();
QQmlApplicationEngine engine;
diff --git a/examples/webengine/quicknanobrowser/main.cpp b/examples/webengine/quicknanobrowser/main.cpp
index 779648fac..94d6f8519 100644
--- a/examples/webengine/quicknanobrowser/main.cpp
+++ b/examples/webengine/quicknanobrowser/main.cpp
@@ -78,6 +78,8 @@ static QUrl startupUrl()
int main(int argc, char **argv)
{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+
Application app(argc, argv);
QtWebEngine::initialize();
diff --git a/examples/webenginewidgets/contentmanipulation/main.cpp b/examples/webenginewidgets/contentmanipulation/main.cpp
index 9f2f2f736..5645f9b9a 100644
--- a/examples/webenginewidgets/contentmanipulation/main.cpp
+++ b/examples/webenginewidgets/contentmanipulation/main.cpp
@@ -54,6 +54,7 @@
int main(int argc, char * argv[])
{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
QUrl url;
diff --git a/examples/webenginewidgets/cookiebrowser/main.cpp b/examples/webenginewidgets/cookiebrowser/main.cpp
index c122eb7c3..15a87609b 100644
--- a/examples/webenginewidgets/cookiebrowser/main.cpp
+++ b/examples/webenginewidgets/cookiebrowser/main.cpp
@@ -45,6 +45,7 @@
int main(int argc, char *argv[])
{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
MainWindow window(QUrl("http://qt.io"));
window.show();
diff --git a/examples/webenginewidgets/demobrowser/history.cpp b/examples/webenginewidgets/demobrowser/history.cpp
index 188490aca..bce65b917 100644
--- a/examples/webenginewidgets/demobrowser/history.cpp
+++ b/examples/webenginewidgets/demobrowser/history.cpp
@@ -137,7 +137,7 @@ void HistoryManager::setHistory(const QList<HistoryItem> &history, bool loadedAn
if (!loadedAndSorted)
qSort(m_history.begin(), m_history.end());
- checkForExpired();
+ checkForExpired(loadedAndSorted);
if (loadedAndSorted) {
m_lastSavedUrl = m_history.value(0).url;
@@ -163,7 +163,7 @@ HistoryTreeModel *HistoryManager::historyTreeModel() const
return m_historyTreeModel;
}
-void HistoryManager::checkForExpired()
+void HistoryManager::checkForExpired(bool removeEntriesDirectly)
{
if (m_historyLimit < 0 || m_history.isEmpty())
return;
@@ -185,7 +185,11 @@ void HistoryManager::checkForExpired()
const HistoryItem& item = m_history.last();
// remove from saved file also
m_lastSavedUrl = QString();
- emit entryRemoved(item);
+
+ if (removeEntriesDirectly)
+ m_history.takeLast();
+ else
+ emit entryRemoved(item);
}
if (nextTimeout > 0)
diff --git a/examples/webenginewidgets/demobrowser/history.h b/examples/webenginewidgets/demobrowser/history.h
index 6d7da5e6d..2a6dce9e1 100644
--- a/examples/webenginewidgets/demobrowser/history.h
+++ b/examples/webenginewidgets/demobrowser/history.h
@@ -126,7 +126,7 @@ public slots:
private slots:
void save();
- void checkForExpired();
+ void checkForExpired(bool removeExpiredEntriesDirectly = false);
protected:
void addHistoryItem(const HistoryItem &item);
diff --git a/examples/webenginewidgets/demobrowser/main.cpp b/examples/webenginewidgets/demobrowser/main.cpp
index 4427a446d..41cae306a 100644
--- a/examples/webenginewidgets/demobrowser/main.cpp
+++ b/examples/webenginewidgets/demobrowser/main.cpp
@@ -54,6 +54,7 @@
int main(int argc, char **argv)
{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
Q_INIT_RESOURCE(data);
BrowserApplication application(argc, argv);
if (!application.isTheOnlyBrowser())
diff --git a/examples/webenginewidgets/markdowneditor/main.cpp b/examples/webenginewidgets/markdowneditor/main.cpp
index 5d1e56eed..1051dcfd4 100644
--- a/examples/webenginewidgets/markdowneditor/main.cpp
+++ b/examples/webenginewidgets/markdowneditor/main.cpp
@@ -56,6 +56,7 @@
int main(int argc, char *argv[])
{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
MainWindow window;
diff --git a/examples/webenginewidgets/minimal/doc/src/minimal.qdoc b/examples/webenginewidgets/minimal/doc/src/minimal.qdoc
index 22f28e604..dd6a70566 100644
--- a/examples/webenginewidgets/minimal/doc/src/minimal.qdoc
+++ b/examples/webenginewidgets/minimal/doc/src/minimal.qdoc
@@ -42,7 +42,10 @@
\section1 The Code
- In \c main.cpp we instantiate a QApplication and a QWebEngineView. The URL
+ In the \c main function we first set the Qt::AA_EnableHighDpiScaling.
+ This lets the web view automatically scale on high-dpi displays.
+
+ Next, we instantiate a QApplication and a QWebEngineView. The URL
to load is set by calling \l QWebEngineView::setUrl. The view widget is
given a reasonable default size, and shown.
Finally, QApplication::exec() launches the main event loop.
diff --git a/examples/webenginewidgets/minimal/main.cpp b/examples/webenginewidgets/minimal/main.cpp
index d9a137739..729d68fa0 100644
--- a/examples/webenginewidgets/minimal/main.cpp
+++ b/examples/webenginewidgets/minimal/main.cpp
@@ -43,6 +43,7 @@
int main(int argc, char *argv[])
{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
QWebEngineView view;
diff --git a/examples/webenginewidgets/simplebrowser/main.cpp b/examples/webenginewidgets/simplebrowser/main.cpp
index 1d2796b8c..fa9f44c34 100644
--- a/examples/webenginewidgets/simplebrowser/main.cpp
+++ b/examples/webenginewidgets/simplebrowser/main.cpp
@@ -57,6 +57,8 @@ QString getCommandLineUrlArgument()
int main(int argc, char **argv)
{
+ QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
+
QApplication app(argc, argv);
app.setWindowIcon(QIcon(QLatin1String(":simplebrowser.svg")));