-
-
Save mirosht/a736b611d3e79863c5e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtCore/QFile> | |
#include <QtCore/QTextStream> | |
#include "wordfinder.h" | |
#include "ui_wordfinder.h" | |
WordFinder::WordFinder(QWidget *parent) : | |
QWidget(parent), | |
ui(new Ui::WordFinder) | |
{ | |
ui->setupUi(this); | |
} | |
WordFinder::~WordFinder() | |
{ | |
delete ui; | |
} | |
void WordFinder::on_FindButton_clicked() | |
{ | |
QString word = ui->lineEdit->text(); | |
ui->textEdit->find(word, QTextDocument::FindWholeWords); | |
} | |
void WordFinder:: getTexFile(){ | |
QFile myFile(":/text.txt"); | |
myFile.open(QIODevice::ReadOnly); | |
QTextStream textStream(&myFile); | |
QString line = textStream.readAll(); | |
&QFileDevice::close; | |
ui->textEdit-> setPlainText(line); /*desplays text in text area*/ | |
QTextCursor textCursor = ui->textEdit->textCursor(); | |
textCursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor, 1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment