View Single Post
Posts: 23 | Thanked: 0 times | Joined on Dec 2009
#31
:S now i get those:

C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.cpp:33: error: expected initializer before 'void'

C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.cpp:41: error: declaration of 'void MainWindow::initMyWordList()' outside of class is not definition

C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.cpp:42: error: expected unqualified-id before '{' token

mainwindow.cpp:
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLabel>
int MainWindow::_clickCounter = 0;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}

MainWindow::~MainWindow()
{
delete ui;
}

void MainWindow::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type())
{ //maybe
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
} //maybe
}

void MainWindow::buttonClickHandler()


void MainWindow:n_Button_clicked()
{
error = initMyWordList();
if ( error )
do whatever you feel like
}

//init my word file
void MainWindow::initMyWordList();
{
QFile * wordFile = new QFile("test.txt");
wordFile->open(QIODevice::ReadOnly);

QTextStream stream(wordFile);

// create the map of channel and date until which data is available
while ( !stream.atEnd() )
{
QString word = stream.readLine();
_wordList << word;
}

wordFile->close();
}

void MainWindow:n_Button_clicked()
{
ui->label->setText(QString("the word of the day is %1").arg(_wordList[_clickCounter++]) );
}