Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions FindDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <QtGui>

#include <QLabel>
#include <QHBoxLayout>
#include <QPushButton>
#include <QCheckBox>
#include <QVBoxLayout>
#include <QLineEdit>
#include <MainWindow.h>
#include "FindDialog.h"

FindDialog::FindDialog(QWidget *parent) : QDialog(parent)
Expand Down
16 changes: 13 additions & 3 deletions MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,18 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <QtGui>

#include <QFileDialog>
#include <QCloseEvent>
#include <QMessageBox>
#include <QSettings>
#include <QStatusBar>
#include <QString>
#include <QActionGroup>
#include <QAction>
#include <QObject>
#include <QApplication>
#include <QMenuBar>
#include <QMenu>
#include "MainWindow.h"

MainWindow::MainWindow()
Expand Down Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@

#include <QMainWindow>
#include <QTextEdit>

#include <QLabel>
#include <QHBoxLayout>
#include <QPushButton>
#include <QCheckBox>
#include <QVBoxLayout>
#include <QLineEdit>
#include "FindDialog.h"

class QAction;
Expand Down
24 changes: 21 additions & 3 deletions QNotepad.pro
Original file line number Diff line number Diff line change
@@ -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
Expand Down