diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-06-27 16:52:21 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2016-06-27 16:52:35 +0200 |
commit | ec5a99b0515779ff5ec3df6bd657127b4e037823 (patch) | |
tree | c5dc52e8892b6740123469276dcb303a81d9fd56 /examples/webenginewidgets | |
parent | 56bea56b2d8fabc4b09d41531177a22d9297ce2c (diff) | |
parent | 722732d1f089630ad517aef8f94325a51186b274 (diff) |
Merge remote-tracking branch 'origin/5.6' into 5.7
Change-Id: Ic6686df8f82f710a3441501b7eeaffe69fbcbdf7
Diffstat (limited to 'examples/webenginewidgets')
9 files changed, 19 insertions, 5 deletions
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"))); |