summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/qtquick/quickwindow.qml2
-rw-r--r--examples/widgets/widgetwindow.cpp6
-rw-r--r--examples/widgets/widgetwindow.h2
3 files changed, 8 insertions, 2 deletions
diff --git a/examples/qtquick/quickwindow.qml b/examples/qtquick/quickwindow.qml
index 7962be141..afaff7c8d 100644
--- a/examples/qtquick/quickwindow.qml
+++ b/examples/qtquick/quickwindow.qml
@@ -20,12 +20,14 @@ ApplicationWindow {
iconName: "go-previous"
iconSource: ":/icons/go-previous.png"
onClicked: webContentsView.goBack()
+ enabled: webContentsView.canGoBack
}
ToolButton {
id: forwardButton
iconName: "go-next"
iconSource: ":/icons/go-next.png"
onClicked: webContentsView.goForward()
+ enabled: webContentsView.canGoForward
}
ToolButton {
id: reloadButton
diff --git a/examples/widgets/widgetwindow.cpp b/examples/widgets/widgetwindow.cpp
index 589ef13c3..a28a6f130 100644
--- a/examples/widgets/widgetwindow.cpp
+++ b/examples/widgets/widgetwindow.cpp
@@ -63,11 +63,11 @@ WidgetWindow::WidgetWindow()
QHBoxLayout* addressBar = new QHBoxLayout;
addressBar->setSpacing(margin); // Bigger buttons, less space between them
- QToolButton* backButton = new QToolButton;
+ backButton = new QToolButton;
backButton->setIcon(QIcon::fromTheme("go-previous"));
addressBar->addWidget(backButton);
- QToolButton* forwardButton = new QToolButton;
+ forwardButton = new QToolButton;
forwardButton->setIcon(QIcon::fromTheme("go-next"));
addressBar->addWidget(forwardButton);
@@ -117,5 +117,7 @@ void WidgetWindow::loadStarted()
void WidgetWindow::loadFinished(bool success)
{
Q_UNUSED(success);
+ forwardButton->setEnabled(m_webView->canGoForward());
+ backButton->setEnabled(m_webView->canGoBack());
reloadButton->setIcon(QIcon::fromTheme("view-refresh"));
}
diff --git a/examples/widgets/widgetwindow.h b/examples/widgets/widgetwindow.h
index 5273d4255..863e8a73f 100644
--- a/examples/widgets/widgetwindow.h
+++ b/examples/widgets/widgetwindow.h
@@ -62,6 +62,8 @@ private Q_SLOTS:
private:
QScopedPointer<QWebContentsView> m_webView;
QLineEdit* addressLineEdit;
+ QToolButton* forwardButton;
+ QToolButton* backButton;
QToolButton* reloadButton;
};