summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets')
-rw-r--r--examples/widgets/dialogs/licensewizard/licensewizard.cpp2
-rw-r--r--examples/widgets/graphicsview/chip/view.cpp2
-rw-r--r--examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp8
-rw-r--r--examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h8
-rw-r--r--examples/widgets/itemviews/pixelator/mainwindow.cpp2
-rw-r--r--examples/widgets/mainwindows/dockwidgets/mainwindow.cpp2
-rw-r--r--examples/widgets/richtext/orderform/mainwindow.cpp2
-rw-r--r--examples/widgets/richtext/textedit/textedit.cpp10
-rw-r--r--examples/widgets/touch/fingerpaint/scribblearea.cpp2
-rw-r--r--examples/widgets/tutorials/notepad/notepad.cpp4
-rw-r--r--examples/widgets/widgets/calendarwidget/window.cpp6
-rw-r--r--examples/widgets/widgets/calendarwidget/window.h7
-rw-r--r--examples/widgets/widgets/imageviewer/imageviewer.cpp2
-rw-r--r--examples/widgets/widgets/scribble/scribblearea.cpp2
14 files changed, 30 insertions, 29 deletions
diff --git a/examples/widgets/dialogs/licensewizard/licensewizard.cpp b/examples/widgets/dialogs/licensewizard/licensewizard.cpp
index c082afa876..2eaadd1cba 100644
--- a/examples/widgets/dialogs/licensewizard/licensewizard.cpp
+++ b/examples/widgets/dialogs/licensewizard/licensewizard.cpp
@@ -369,7 +369,7 @@ void ConclusionPage::setVisible(bool visible)
void ConclusionPage::printButtonClicked()
{
-#if QT_CONFIG(printdialog)
+#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QPrinter printer;
QPrintDialog dialog(&printer, this);
if (dialog.exec())
diff --git a/examples/widgets/graphicsview/chip/view.cpp b/examples/widgets/graphicsview/chip/view.cpp
index 86da5b138f..3b1718bdbd 100644
--- a/examples/widgets/graphicsview/chip/view.cpp
+++ b/examples/widgets/graphicsview/chip/view.cpp
@@ -264,7 +264,7 @@ void View::toggleAntialiasing()
void View::print()
{
-#if QT_CONFIG(printdialog)
+#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QPrinter printer;
QPrintDialog dialog(&printer, this);
if (dialog.exec() == QDialog::Accepted) {
diff --git a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp
index b0b4017e62..fd17876f2b 100644
--- a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp
+++ b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -60,7 +60,7 @@ MySortFilterProxyModel::MySortFilterProxyModel(QObject *parent)
//! [0]
//! [1]
-void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
+void MySortFilterProxyModel::setFilterMinimumDate(QDate date)
{
minDate = date;
invalidateFilter();
@@ -68,7 +68,7 @@ void MySortFilterProxyModel::setFilterMinimumDate(const QDate &date)
//! [1]
//! [2]
-void MySortFilterProxyModel::setFilterMaximumDate(const QDate &date)
+void MySortFilterProxyModel::setFilterMaximumDate(QDate date)
{
maxDate = date;
invalidateFilter();
@@ -122,7 +122,7 @@ bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
//! [5] //! [6]
//! [7]
-bool MySortFilterProxyModel::dateInRange(const QDate &date) const
+bool MySortFilterProxyModel::dateInRange(QDate date) const
{
return (!minDate.isValid() || date > minDate)
&& (!maxDate.isValid() || date < maxDate);
diff --git a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h
index e2aff3c829..5fdabbd5df 100644
--- a/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h
+++ b/examples/widgets/itemviews/customsortfiltermodel/mysortfilterproxymodel.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -63,17 +63,17 @@ public:
MySortFilterProxyModel(QObject *parent = 0);
QDate filterMinimumDate() const { return minDate; }
- void setFilterMinimumDate(const QDate &date);
+ void setFilterMinimumDate(QDate date);
QDate filterMaximumDate() const { return maxDate; }
- void setFilterMaximumDate(const QDate &date);
+ void setFilterMaximumDate(QDate date);
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override;
private:
- bool dateInRange(const QDate &date) const;
+ bool dateInRange(QDate date) const;
QDate minDate;
QDate maxDate;
diff --git a/examples/widgets/itemviews/pixelator/mainwindow.cpp b/examples/widgets/itemviews/pixelator/mainwindow.cpp
index f6b67e4dba..abd4a8b1ab 100644
--- a/examples/widgets/itemviews/pixelator/mainwindow.cpp
+++ b/examples/widgets/itemviews/pixelator/mainwindow.cpp
@@ -167,7 +167,7 @@ void MainWindow::openImage(const QString &fileName)
void MainWindow::printImage()
{
-#if QT_CONFIG(printdialog)
+#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
if (model->rowCount(QModelIndex())*model->columnCount(QModelIndex()) > 90000) {
QMessageBox::StandardButton answer;
answer = QMessageBox::question(this, tr("Large Image Size"),
diff --git a/examples/widgets/mainwindows/dockwidgets/mainwindow.cpp b/examples/widgets/mainwindows/dockwidgets/mainwindow.cpp
index a62765cdab..dba4a081df 100644
--- a/examples/widgets/mainwindows/dockwidgets/mainwindow.cpp
+++ b/examples/widgets/mainwindows/dockwidgets/mainwindow.cpp
@@ -128,7 +128,7 @@ void MainWindow::newLetter()
//! [3]
void MainWindow::print()
{
-#if QT_CONFIG(printdialog)
+#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QTextDocument *document = textEdit->document();
QPrinter printer;
diff --git a/examples/widgets/richtext/orderform/mainwindow.cpp b/examples/widgets/richtext/orderform/mainwindow.cpp
index 0b6a2cac6c..ee6758c9cb 100644
--- a/examples/widgets/richtext/orderform/mainwindow.cpp
+++ b/examples/widgets/richtext/orderform/mainwindow.cpp
@@ -248,7 +248,7 @@ void MainWindow::openDialog()
//! [17]
void MainWindow::printFile()
{
-#if QT_CONFIG(printdialog)
+#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QTextEdit *editor = static_cast<QTextEdit*>(letters->currentWidget());
//! [18]
QPrinter printer;
diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp
index 85fb83ab89..7708b25a24 100644
--- a/examples/widgets/richtext/textedit/textedit.cpp
+++ b/examples/widgets/richtext/textedit/textedit.cpp
@@ -419,18 +419,18 @@ bool TextEdit::load(const QString &f)
QByteArray data = file.readAll();
QTextCodec *codec = Qt::codecForHtml(data);
QString str = codec->toUnicode(data);
- QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename);
- textEdit->document()->setBaseUrl(baseUrl);
if (Qt::mightBeRichText(str)) {
+ QUrl baseUrl = (f.front() == QLatin1Char(':') ? QUrl(f) : QUrl::fromLocalFile(f)).adjusted(QUrl::RemoveFilename);
+ textEdit->document()->setBaseUrl(baseUrl);
textEdit->setHtml(str);
} else {
#if QT_CONFIG(textmarkdownreader)
QMimeDatabase db;
if (db.mimeTypeForFileNameAndData(f, data).name() == QLatin1String("text/markdown"))
- textEdit->setMarkdown(str);
+ textEdit->setMarkdown(QString::fromUtf8(data));
else
#endif
- textEdit->setPlainText(QString::fromLocal8Bit(data));
+ textEdit->setPlainText(QString::fromUtf8(data));
}
setCurrentFileName(f);
@@ -545,7 +545,7 @@ bool TextEdit::fileSaveAs()
void TextEdit::filePrint()
{
-#if QT_CONFIG(printdialog)
+#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QPrinter printer(QPrinter::HighResolution);
QPrintDialog *dlg = new QPrintDialog(&printer, this);
if (textEdit->textCursor().hasSelection())
diff --git a/examples/widgets/touch/fingerpaint/scribblearea.cpp b/examples/widgets/touch/fingerpaint/scribblearea.cpp
index 0b0c4476d9..e490495cd9 100644
--- a/examples/widgets/touch/fingerpaint/scribblearea.cpp
+++ b/examples/widgets/touch/fingerpaint/scribblearea.cpp
@@ -170,7 +170,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
//! [21]
void ScribbleArea::print()
{
-#if QT_CONFIG(printdialog)
+#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QPrinter printer(QPrinter::HighResolution);
QPrintDialog printDialog(&printer, this);
diff --git a/examples/widgets/tutorials/notepad/notepad.cpp b/examples/widgets/tutorials/notepad/notepad.cpp
index 2ccd6501a1..5fd0d69cea 100644
--- a/examples/widgets/tutorials/notepad/notepad.cpp
+++ b/examples/widgets/tutorials/notepad/notepad.cpp
@@ -92,7 +92,7 @@ Notepad::Notepad(QWidget *parent) :
connect(ui->actionAbout, &QAction::triggered, this, &Notepad::about);
// Disable menu actions for unavailable features
-#if !QT_CONFIG(printer)
+#if !defined(QT_PRINTSUPPORT_LIB) || !QT_CONFIG(printer)
ui->actionPrint->setEnabled(false);
#endif
@@ -171,7 +171,7 @@ void Notepad::saveAs()
void Notepad::print()
{
-#if QT_CONFIG(printer)
+#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printer)
QPrinter printDev;
#if QT_CONFIG(printdialog)
QPrintDialog dialog(&printDev, this);
diff --git a/examples/widgets/widgets/calendarwidget/window.cpp b/examples/widgets/widgets/calendarwidget/window.cpp
index b8a3d03552..ae10223dd4 100644
--- a/examples/widgets/widgets/calendarwidget/window.cpp
+++ b/examples/widgets/widgets/calendarwidget/window.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -126,7 +126,7 @@ void Window::selectedDateChanged()
//! [2]
//! [3]
-void Window::minimumDateChanged(const QDate &date)
+void Window::minimumDateChanged(QDate date)
{
calendar->setMinimumDate(date);
maximumDateEdit->setDate(calendar->maximumDate());
@@ -134,7 +134,7 @@ void Window::minimumDateChanged(const QDate &date)
//! [3]
//! [4]
-void Window::maximumDateChanged(const QDate &date)
+void Window::maximumDateChanged(QDate date)
{
calendar->setMaximumDate(date);
minimumDateEdit->setDate(calendar->minimumDate());
diff --git a/examples/widgets/widgets/calendarwidget/window.h b/examples/widgets/widgets/calendarwidget/window.h
index 83ea494fc2..1b673b8ce0 100644
--- a/examples/widgets/widgets/calendarwidget/window.h
+++ b/examples/widgets/widgets/calendarwidget/window.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -52,6 +52,7 @@
#define WINDOW_H
#include <QWidget>
+#include <QDateTime>
QT_BEGIN_NAMESPACE
class QCalendarWidget;
@@ -79,8 +80,8 @@ private slots:
void horizontalHeaderChanged(int index);
void verticalHeaderChanged(int index);
void selectedDateChanged();
- void minimumDateChanged(const QDate &date);
- void maximumDateChanged(const QDate &date);
+ void minimumDateChanged(QDate date);
+ void maximumDateChanged(QDate date);
void weekdayFormatChanged();
void weekendFormatChanged();
void reformatHeaders();
diff --git a/examples/widgets/widgets/imageviewer/imageviewer.cpp b/examples/widgets/widgets/imageviewer/imageviewer.cpp
index 1efaad0082..7a0f49308b 100644
--- a/examples/widgets/widgets/imageviewer/imageviewer.cpp
+++ b/examples/widgets/widgets/imageviewer/imageviewer.cpp
@@ -201,7 +201,7 @@ void ImageViewer::print()
//! [5] //! [6]
{
Q_ASSERT(!imageLabel->pixmap(Qt::ReturnByValue).isNull());
-#if QT_CONFIG(printdialog)
+#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
//! [6] //! [7]
QPrintDialog dialog(&printer, this);
//! [7] //! [8]
diff --git a/examples/widgets/widgets/scribble/scribblearea.cpp b/examples/widgets/widgets/scribble/scribblearea.cpp
index 75371b523f..d3937f90d8 100644
--- a/examples/widgets/widgets/scribble/scribblearea.cpp
+++ b/examples/widgets/widgets/scribble/scribblearea.cpp
@@ -210,7 +210,7 @@ void ScribbleArea::resizeImage(QImage *image, const QSize &newSize)
//! [21]
void ScribbleArea::print()
{
-#if QT_CONFIG(printdialog)
+#if defined(QT_PRINTSUPPORT_LIB) && QT_CONFIG(printdialog)
QPrinter printer(QPrinter::HighResolution);
QPrintDialog printDialog(&printer, this);