QT crator podstawy
Ostatnio zmodyfikowano 2016-07-13 11:46
aaadam Temat założony przez niniejszego użytkownika |
QT crator podstawy » 2016-07-13 09:53:16 Witam, Robię sobie ten tutorial : http://doc.qt.io/qtcreator/creator-writing-program.htmlto jest kawałek kodu: #include "textfinder.h" #include "ui_textfinder.h" #include <QFile> #include <QTextStream> #include <QTextCursor> #include <QString> #include <QTextDocument> TextFinder::TextFinder( QWidget * parent ) : QMainWindow( parent ) , ui( new Ui::TextFinder ) { ui->setupUi( this ); loadTextFile(); }
TextFinder::~TextFinder() { delete ui; }
void TextFinder::on_findButton_clicked() { QString searchString = ui->lineEdit->text(); ui->textEdit->find( searchString, QTextDocument::FindWholeWords ); }
void TextFinder::loadTextFile() { QFile inputfile( ":/input.txt" ); inputfile.open( QIODevice::ReadOnly ); QTextStream in( & inputfile ); QString line = in.readAll(); inputfile.close(); ui->textEdit->setPlainText( line ); QTextCursor cursor = ui->textEdit->textCursor(); cursor.movePosition( QTextCursor::Start, QTextCursor::MoveAnchor, 1 ); }
a to są błędy : \textFinder\textfinder.cpp:23: error: C2039: 'lineEdit': is not a member of 'Ui::TextFinder' \textFinder\textfinder.cpp:23: error: C2227: left of '->text' must point to class/struct/union/generic type \textFinder\textfinder.cpp:24: error: C2039: 'textEdit': is not a member of 'Ui::TextFinder' \textFinder\textfinder.cpp:24: error: C2227: left of '->find' must point to class/struct/union/generic type \textFinder\textfinder.cpp:34: error: C2039: 'textEdit': is not a member of 'Ui::TextFinder' \textFinder\textfinder.cpp:34: error: C2227: left of '->setPlainText' must point to class/struct/union/generic type \textFinder\textfinder.cpp:35: error: C2039: 'textEdit': is not a member of 'Ui::TextFinder' \textFinder\textfinder.cpp:35: error: C2227: left of '->textCursor' must point to class/struct/union/generic type
pomoże ktoś :) ? |
|
marcolo2307 |
» 2016-07-13 11:15:46 Zmieniłeś nazwy obiektów w designerze? |
|
aaadam Temat założony przez niniejszego użytkownika |
» 2016-07-13 11:32:07 1 nazwa : lineEdit 2 nazwa : findButton 3 nazwa : textEdit najlepsze jest to że po '->' mogę odwoływać się do tych obiektów więcej rzeczy tam nie ma, zrobię chyba nowy projekt może zadziała.
|
|
aaadam Temat założony przez niniejszego użytkownika |
» 2016-07-13 11:46:46 można temat zamknąć ponieważ zrobiłem nowy projekt i działa ... dziękuje dobranoc |
|
« 1 » |