Notices


Reply
Thread Tools
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++]) );
}
 
Posts: 130 | Thanked: 51 times | Joined on Sep 2009
#32
Code:
void MainWindow::buttonClickHandler()
should be
Code:
void MainWindow::buttonClickHandler() 
{
}
and
Code:
do whatever you feel like
should be
Code:
// do whatever you feel like
 
Posts: 23 | Thanked: 0 times | Joined on Dec 2009
#33
C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.cpp:35: error: no 'void MainWindow:n_Button_clicked()' member function declared in class 'MainWindow'

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

Then i get that omg so much errors
 
Posts: 146 | Thanked: 76 times | Joined on Feb 2010 @ Poland
#34
Originally Posted by tdesws View Post
C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.cpp:35: error: no 'void MainWindow:n_Button_clicked()' member function declared in class 'MainWindow'

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

Then i get that omg so much errors
Change:
Code:
// do whatever you feel like
into:
Code:
{ } // do nothing
or
Code:
; // do nothing
__________________
Remember to click Thanks! if this post is of any help
 
Posts: 130 | Thanked: 51 times | Joined on Sep 2009
#35
When you once saw most of the errors next time you may correct them yourself. But you should learn a bit more basics of c++ so you would understand the errors.

C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.cpp:35: error: no 'void MainWindow:n_Button_clicked()' member function declared in class 'MainWindow'C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.cpp:35: error: no 'void MainWindow:n_Button_clicked()' member function declared in class 'MainWindow'
Means you need to declacre the function first in the header file (add it like the initMyWordList to the .h file)
Code:
void On_Button_clicked();
 
Posts: 130 | Thanked: 51 times | Joined on Sep 2009
#36
Oh, and
Code:
error = initMyWordList();
wont work, as you declared the function as "void" so it cant return a value.
 
Venemo's Avatar
Posts: 1,290 | Thanked: 1,753 times | Joined on Aug 2009 @ Budapest, Hungary
#37
I'm also new to Qt.

I have a simple question: How do I make a dialog window uncloseable? I mean, how to create a QDialog (or a QMessageBox) which can't be closed by the user, but only the application itself?
 
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#38
Originally Posted by Venemo View Post
... how to create a QDialog (or a QMessageBox) which can't be closed by the user, but only the application itself?
see if this works for you
__________________
Developer of :
Buddy - budget/expense manager ( website )
Showtime - a telly channel listing viewer/reminder ( website )
Travelapp - london underground status/planner ( website )
Batlevel - desktop widget for battery level ( website )

I hear and I forget. I see and I remember. I do and I understand.
 
Posts: 148 | Thanked: 199 times | Joined on Nov 2009
#39
http://doc.trolltech.com/4.6/qwidget.html#closeEvent

Reimplement this event handler to ignore the close event on a certain condition. Also see the example which explains why this can be useful.
 

The Following User Says Thank You to mikhas For This Useful Post:
Venemo's Avatar
Posts: 1,290 | Thanked: 1,753 times | Joined on Aug 2009 @ Budapest, Hungary
#40
Originally Posted by krk969 View Post
see if this works for you
I already tried modality, but there seems to be no value to set it to for the desired effect.
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 10:59.