From e14479b794fe1f8a6eff60f2cd7def06b9ccb08f Mon Sep 17 00:00:00 2001 From: lzzy12 Date: Tue, 8 May 2018 17:22:24 +0530 Subject: [PATCH] Modify sources for Qt-5 standards Signed-off-by: lzzy12 --- FindDialog.cpp | 10 +++++++--- MainWindow.cpp | 16 +++++++++++++--- MainWindow.h | 7 ++++++- QNotepad.pro | 24 +++++++++++++++++++++--- 4 files changed, 47 insertions(+), 10 deletions(-) diff --git a/FindDialog.cpp b/FindDialog.cpp index 31c776a..090ce28 100644 --- a/FindDialog.cpp +++ b/FindDialog.cpp @@ -24,9 +24,13 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -#include - +#include +#include +#include +#include +#include +#include +#include #include "FindDialog.h" FindDialog::FindDialog(QWidget *parent) : QDialog(parent) diff --git a/MainWindow.cpp b/MainWindow.cpp index 0e2a155..ecf1a9d 100644 --- a/MainWindow.cpp +++ b/MainWindow.cpp @@ -25,8 +25,18 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include - +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "MainWindow.h" MainWindow::MainWindow() @@ -206,7 +216,7 @@ bool MainWindow::saveFile(const QString& fileName) return false; QString content = textEdit->toPlainText(); - QByteArray byteContent = QByteArray(content.toAscii()); + QByteArray byteContent = QByteArray(content.toUtf8()); file.write(byteContent); setCurrentFile(fileName); diff --git a/MainWindow.h b/MainWindow.h index 1f9b2b4..f4cf267 100644 --- a/MainWindow.h +++ b/MainWindow.h @@ -30,7 +30,12 @@ #include #include - +#include +#include +#include +#include +#include +#include #include "FindDialog.h" class QAction; diff --git a/QNotepad.pro b/QNotepad.pro index 18e0e73..a7bfb90 100644 --- a/QNotepad.pro +++ b/QNotepad.pro @@ -1,11 +1,29 @@ ###################################################################### # Automatically generated by qmake (2.01a) Fri Feb 25 16:04:50 2011 ###################################################################### +#------------------------------------------------- +# +# Project created by QtCreator 2018-03-18T12:53:09 +# +#------------------------------------------------- +QT += core gui + +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets + +TARGET = Qnotepad TEMPLATE = app -TARGET = -DEPENDPATH += . -INCLUDEPATH += . + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 # Input HEADERS += FindDialog.h MainWindow.h