summaryrefslogtreecommitdiffstats
path: root/examples/widgets/tutorials
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/tutorials')
-rw-r--r--examples/widgets/tutorials/gettingstartedqt.qdoc2
-rw-r--r--examples/widgets/tutorials/notepad/notepad.cpp17
2 files changed, 18 insertions, 1 deletions
diff --git a/examples/widgets/tutorials/gettingstartedqt.qdoc b/examples/widgets/tutorials/gettingstartedqt.qdoc
index 921dd7a32d..bbe1dd1a8d 100644
--- a/examples/widgets/tutorials/gettingstartedqt.qdoc
+++ b/examples/widgets/tutorials/gettingstartedqt.qdoc
@@ -28,7 +28,7 @@
/*!
\example tutorials/notepad
\title Getting Started Programming with Qt Widgets
- \brief A tutorial for Qt Widgets based on a notepad application
+ \brief A tutorial for Qt Widgets based on a notepad application.
In this topic, we teach basic Qt knowledge by implementing a simple
Notepad application using C++ and the \l{Qt Widgets} module. The
diff --git a/examples/widgets/tutorials/notepad/notepad.cpp b/examples/widgets/tutorials/notepad/notepad.cpp
index 99a1a52c2b..d0e600e852 100644
--- a/examples/widgets/tutorials/notepad/notepad.cpp
+++ b/examples/widgets/tutorials/notepad/notepad.cpp
@@ -73,6 +73,17 @@ Notepad::Notepad(QWidget *parent) :
{
ui->setupUi(this);
this->setCentralWidget(ui->textEdit);
+
+// Disable menu actions for unavailable features
+#if !QT_CONFIG(printer)
+ ui->actionPrint->setEnabled(false);
+#endif
+
+#if !QT_CONFIG(clipboard)
+ ui->actionCut->setEnabled(false);
+ ui->actionCopy->setEnabled(false);
+ ui->actionPaste->setEnabled(false);
+#endif
}
Notepad::~Notepad()
@@ -161,17 +172,23 @@ void Notepad::on_actionExit_triggered()
void Notepad::on_actionCopy_triggered()
{
+#if QT_CONFIG(clipboard)
ui->textEdit->copy();
+#endif
}
void Notepad::on_actionCut_triggered()
{
+#if QT_CONFIG(clipboard)
ui->textEdit->cut();
+#endif
}
void Notepad::on_actionPaste_triggered()
{
+#if QT_CONFIG(clipboard)
ui->textEdit->paste();
+#endif
}
void Notepad::on_actionUndo_triggered()