From 2c390e85cffbfa1eaeabaadfa823abcb61c1156a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 9 Mar 2020 15:49:03 +0100 Subject: QFileDialog: Improve default implementation of getOpenFileContent() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use QFileDialog::ExistingFile and check whether file can be opened, fixing warnings like: QIODevice::read (QFile, "/home/.../blub"): device not open Change-Id: I7ee1d59f01383c581bc09fb44855835aae8c246b Reviewed-by: Morten Johan Sørvig --- src/widgets/dialogs/qfiledialog.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index add8e6db91..34c2c4ecb5 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -2438,14 +2438,15 @@ void QFileDialog::getOpenFileContent(const QString &nameFilter, const std::funct (*openFileImpl)(); #else QFileDialog *dialog = new QFileDialog(); + dialog->setFileMode(QFileDialog::ExistingFile); dialog->selectNameFilter(nameFilter); auto fileSelected = [=](const QString &fileName) { QByteArray fileContent; if (!fileName.isNull()) { QFile selectedFile(fileName); - selectedFile.open(QIODevice::ReadOnly); - fileContent = selectedFile.readAll(); + if (selectedFile.open(QIODevice::ReadOnly)) + fileContent = selectedFile.readAll(); } fileOpenCompleted(fileName, fileContent); }; -- cgit v1.2.3 From 65a7648329fc710c200ce238c339e4f1e6873d1f Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Mon, 2 Mar 2020 14:45:49 +0100 Subject: Doc: Remove incorrect see-also link The link is actually a self-reference; setCurrentSection() is setter for the currentSection property, and has no dedicated documentation. Change-Id: I4977650566913c590d46aede92d8678b7b7ea291 Reviewed-by: Paul Wicking --- src/widgets/widgets/qdatetimeedit.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index c52bb89f28..d145985c1d 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -691,8 +691,6 @@ QDateTimeEdit::Sections QDateTimeEdit::displayedSections() const \property QDateTimeEdit::currentSection \brief The current section of the spinbox. - - \sa setCurrentSection() */ QDateTimeEdit::Section QDateTimeEdit::currentSection() const -- cgit v1.2.3 From 26ed956cbc5b081b972fe0c435e77e62d3f7944b Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Sat, 14 Mar 2020 22:31:42 +0100 Subject: Doc: Remove \contentspage commands The command is deprecated and has no effect apart from generating a documentation warning. Change-Id: I30871bfd6975f8268930cce99993a8579242fdb8 Reviewed-by: Paul Wicking --- src/widgets/doc/src/widgets-and-layouts/layout.qdoc | 1 - src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc | 6 ------ src/widgets/doc/src/windows-and-dialogs/dialogs.qdoc | 1 - 3 files changed, 8 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc index e42e6d42ec..24f8cd836f 100644 --- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc @@ -33,7 +33,6 @@ layouts. \previouspage Qt Widgets - \contentspage Qt Widgets \nextpage {Styles and Style Aware Widgets}{Styles} \ingroup frameworks-technologies diff --git a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc index 50f626e7a6..be0a23f79c 100644 --- a/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/stylesheet.qdoc @@ -35,7 +35,6 @@ \ingroup qt-gui-concepts \previouspage {Styles and Style Aware Widgets}{Styles} - \contentspage Widgets and Layouts \nextpage The Style Sheet Syntax \keyword style sheet @@ -139,7 +138,6 @@ /*! \page stylesheet-syntax.html - \contentspage {Qt Style Sheets}{Contents} \previouspage Qt Style Sheets \nextpage Qt Designer Integration \title The Style Sheet Syntax @@ -562,7 +560,6 @@ /*! \page stylesheet-designer.html - \contentspage {Qt Style Sheets}{Contents} \previouspage The Style Sheet Syntax \nextpage Customizing Qt Widgets Using Style Sheets \title Qt Designer Integration @@ -588,7 +585,6 @@ /*! \page stylesheet-customizing.html - \contentspage {Qt Style Sheets}{Contents} \previouspage Qt Designer Integration \nextpage Qt Style Sheets Reference \title Customizing Qt Widgets Using Style Sheets @@ -692,7 +688,6 @@ /*! \page stylesheet-reference.html - \contentspage {Qt Style Sheets}{Contents} \previouspage Customizing Qt Widgets Using Style Sheets \nextpage Qt Style Sheets Examples \title Qt Style Sheets Reference @@ -3506,7 +3501,6 @@ /*! \page stylesheet-examples.html - \contentspage {Qt Style Sheets}{Contents} \previouspage Qt Style Sheets Reference \title Qt Style Sheets Examples diff --git a/src/widgets/doc/src/windows-and-dialogs/dialogs.qdoc b/src/widgets/doc/src/windows-and-dialogs/dialogs.qdoc index 81bc6dd279..5b1ce435d8 100644 --- a/src/widgets/doc/src/windows-and-dialogs/dialogs.qdoc +++ b/src/widgets/doc/src/windows-and-dialogs/dialogs.qdoc @@ -39,7 +39,6 @@ \brief An overview over dialog windows. \previouspage Application Main Window - \contentspage Application Windows and Dialogs \nextpage Desktop Integration Dialogs can be \e{modal}, in which case the user is required to provide -- cgit v1.2.3