maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   I'm learning with Qt and I have a question (https://talk.maemo.org/showthread.php?t=47962)

tdesws 2010-03-21 19:25

I'm learning with Qt and I have a question
 
Hello, I'm trying to learn to code something with Qt by myself, so now I have a problem:
http://edvinas.edas.lt/images/sth7c8gwsnuvm1s237.png
This is what I've made, when i press next it just cleares that 'TEXT TEXT TEXT', i want to know how to make that change to 'TEXT2 TEXT2 TEXT2' and later change that to 'Whatever other text' and so on to change it to other text.
Sorry my english is very bad.

bousch 2010-03-21 20:32

Re: I'm learning with Qt and I have a question
 
Are you using python or c++? If the control displaying "TEXT TEXT TEXT" in your example is a simple label and you are using c++ you should use the label->setText(const QString &text) method.

Your english is fine by the way...

tdesws 2010-03-21 20:39

Re: I'm learning with Qt and I have a question
 
Well i did everything using that mainwindow.ui not coding :| I've started learning with that Qt only like 5hours ago..
And yea it's a label there

TNiga 2010-03-21 20:49

Re: I'm learning with Qt and I have a question
 
In case you haven't already found out (since you are so new to Qt): Qt has very good documentation with nice examples here http://doc.trolltech.com/4.5/index.html

For example: http://doc.trolltech.com/4.5/qlabel.html

tdesws 2010-03-21 20:55

Re: I'm learning with Qt and I have a question
 
omg, I didn't think that so much of everything is to make text change (I didn't make it to work yet) :O

BTW. Can u gudie me what i have to change (to make text text text to text2 text2 text2 and later to something else and so on...) and why? I would be very grateful, here's my current script:
Code:

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLabel>
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()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void MainWindow::buttonClickHandler()
{
}

void MainWindow::on_Button_clicked()
{
}

(yes, I know it's totally empty)

Sasler 2010-03-21 21:59

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by tdesws (Post 576282)
omg, I didn't think that so much of everything is to make text change (I didn't make it to work yet) :O

BTW. Can u gudie me what i have to change (to make text text text to text2 text2 text2 and later to something else and so on...) and why? I would be very grateful, here's my current script:
Code:

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QLabel>
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()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void MainWindow::buttonClickHandler()
{
}

void MainWindow::on_Button_clicked()
{
}

(yes, I know it's totally empty)

If I understood you correctly, you could try this:

Code:

void MainWindow::on_Button_clicked()
{
      ui->label->setText("text2 text2 text2");
}

Assuming that on_Button_clicked() is called when you click "next" and that the QLabel ID is "label".

Hope this helps :)

tdesws 2010-03-21 22:16

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by Sasler (Post 576359)
If I understood you correctly, you could try this:

Code:

void MainWindow::on_Button_clicked()
{
      ui->label->setText("text2 text2 text2");
}

Assuming that on_Button_clicked() is called when you click "next" and that the QLabel ID is "label".

Hope this helps :)

thanks for helping me out, but how do i change that on third click it would change to text3 text3 text3

krk969 2010-03-21 22:52

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by tdesws (Post 576373)
thanks for helping me out, but how do i change that on third click it would change to text3 text3 text3

using a global/class static variable as a counter is an option.

tdesws 2010-03-22 14:05

Re: I'm learning with Qt and I have a question
 
erm.. how do I do that?

gabby131 2010-03-22 14:10

Re: I'm learning with Qt and I have a question
 
this is telling me that QT is like a Programming language or something to do with code, strings and etc....

krk969 2010-03-22 15:01

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by tdesws (Post 577137)
erm.. how do I do that?

mainwindow.h
Code:

class MainWindow
{
........

private:
        static int  _clickCounter;
};

mainwindow.cpp
in the first line of the file just after all the #includes define this variable,
Code:

int MainWindow::_clickCounter = 0;
and modfiy your slot with something like this
Code:

void MainWindow::on_Button_clicked()
{
      ui->label->setText(QString("this is text %1").arg(QString::number(++_clickCounter) );
}


krk969 2010-03-22 15:05

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by gabby131 (Post 577146)
this is telling me that QT is like a Programming language or something to do with code, strings and etc....

QT is mainly a graphical toolkit that will allow you to create cross platform code with graphical interfaces, you can use it for backend server coding also, if you like :D
QT is based on C++, so if you know C++ ( even some basics ), you should feel at home.

tdesws 2010-03-22 17:57

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by krk969 (Post 577230)
mainwindow.h
Code:

class MainWindow
{
........

private:
        static int  _clickCounter;
};

mainwindow.cpp
in the first line of the file just after all the #includes define this variable,
Code:

int MainWindow::_clickCounter = 0;
and modfiy your slot with something like this
Code:

void MainWindow::on_Button_clicked()
{
      ui->label->setText(QString("this is text %1").arg(QString::number(++_clickCounter) );
}


I've made it to work, but i meant that later it wont be just +1 it will be something like: Hello changes to Mouse and then word mouse changes to some other word or sentence

krk969 2010-03-22 17:58

Re: I'm learning with Qt and I have a question
 
so you want to print a random text from a list every time you click ?
whats the requirement ?

tdesws 2010-03-22 18:08

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by krk969 (Post 577535)
so you want to print a random text from a list every time you click ?
whats the requirement ?

Well I have like 500 lines of text
something like this:
1. Hello
2. Meow
3. Lol
......
500. Text

and i want it to show next line everytime i press next

krk969 2010-03-22 18:21

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by tdesws (Post 577564)
Well I have like 500 lines of text
and i want it to show next line everytime i press next

put all your words in a file(example /home/user/wordlist) , 1 word per line.

mainwindow.h
Code:

class MainWindow
{
...
private:  // member functions
        void MainWindow::initMyWordList();
private: // member variables
        static int  _clickCounter;
        QStringList _wordList;
};

mainwindow.cpp
Code:

in the first line of the file just after all the #includes define this variable,

int MainWindow::_clickCounter = 0;

and in

MainWindow()
{
....
error = initMyWordList();
if ( error )
  do whatever you feel like
....
}

//init my word file
void MainWindow::initMyWordList()
{
        QFile * wordFile = new QFile("/home/user/wordlist");
        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::on_Button_clicked()
{
      ui->label->setText(QString("the word of the day is %1").arg(_wordList[_clickCounter++]) );
}


tdesws 2010-03-24 13:44

Re: I'm learning with Qt and I have a question
 
Here's my window.h
Code:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

public slots:
    void buttonClickHandler();

protected:
    void changeEvent(QEvent *e);

private:
    Ui::MainWindow *ui;
    {
    private:  // member functions
            void MainWindow::initMyWordList()
    private: // member variables
            static int  _clickCounter;
            QStringList _wordList;
    };
private slots:

private slots:
    void on_Button_clicked();
};


#endif // MAINWINDOW_H

and mainwindow.cpp
Code:

#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()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void MainWindow::buttonClickHandler()
{
}

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

//init my word file
void MainWindow::initMyWordList()
{
        QFile * wordFile = new QFile("/home/user/wordlist");
        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::on_Button_clicked()
{
      ui->label->setText(QString("the word of the day is %1").arg(_wordList[_clickCounter++]) );
}

but when i try to build i get: C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.h:24: error: expected unqualified-id before '{' token

VDVsx 2010-03-24 14:13

Re: I'm learning with Qt and I have a question
 
Removes the brackets in line 24 and 30.

krk969 2010-03-24 14:14

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by tdesws (Post 580293)
Here's my window.h
Code:

....
private:
    Ui::MainWindow *ui;
    {
    private:  // member functions
            void MainWindow::initMyWordList()
    private: // member variables
            static int  _clickCounter;
            QStringList _wordList;
    };

but when i try to build i get: C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.h:24: error: expected unqualified-id before '{' token

change the above to
....
private:
Ui::MainWindow *ui;
// member functions
void MainWindow::initMyWordList()
// member variables
static int _clickCounter;
QStringList _wordList;
};
....

tdesws 2010-03-24 14:52

Re: I'm learning with Qt and I have a question
 
now it looks like that:

mainwindow.h:
Code:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

public slots:
    void buttonClickHandler();

protected:
    void changeEvent(QEvent *e);

private:

    {
    Ui::MainWindow *ui;
    // member functions
    void MainWindow::initMyWordList();
    // member variables
    static int _clickCounter;
    QStringList _wordList;
    }

//private slots:
    //void on_Button_clicked();


#endif // MAINWINDOW_H

main.cpp:
Code:

#include <QtGui/QApplication>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}
}

mainwindows.cpp:
Code:

#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()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void MainWindow::buttonClickHandler()
{
}

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

//init my word file
void MainWindow::initMyWordList()
{
        QFile * wordFile = new QFile("C:\Users\Edvinas\Desktop\MAEMO\N900\Development\test");
        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::on_Button_clicked()
{
      ui->label->setText(QString("the word of the day is %1").arg(_wordList[_clickCounter++]) );
}

And i get:

C:/Users/Edvinas/Documents/InteractiveHelloWorld/main.cpp:2: In file included from main.cpp:2:

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

C:/Users/Edvinas/Documents/InteractiveHelloWorld/main.cpp:10: error: expected unqualified-id at end of input

nath 2010-03-24 14:56

Re: I'm learning with Qt and I have a question
 
Your curly brackets aren't matching. You can easily see that in the main.cpp where you have two closing ones right after each other.

emeni 2010-03-24 15:00

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by krk969 (Post 577237)
QT is mainly a graphical toolkit that will allow you to create cross platform code with graphical interfaces, you can use it for backend server coding also, if you like :D
QT is based on C++, so if you know C++ ( even some basics ), you should feel at home.

Nice, I actually haven't programed in C++ since... ages :))) I'm going to give it a try :D

tdesws 2010-03-24 15:06

Re: I'm learning with Qt and I have a question
 
If I remove one i get theese errors:
C:/Users/Edvinas/Documents/InteractiveHelloWorld/main.cpp:2: In file included from main.cpp:2:

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

C:/Users/Edvinas/Documents/InteractiveHelloWorld/main.cpp:10: error: expected '}' at end of input

C:/Users/Edvinas/Documents/InteractiveHelloWorld/main.cpp:10: error: expected unqualified-id at end of input

tdesws 2010-04-02 10:03

Re: I'm learning with Qt and I have a question
 
Anyone? :(

Robb 2010-04-02 10:17

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by tdesws (Post 580417)
now it looks like that:

mainwindow.h:
Code:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow {
    Q_OBJECT
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();

public slots:
    void buttonClickHandler();

protected:
    void changeEvent(QEvent *e);

private:

    {
    Ui::MainWindow *ui;
    // member functions
    void MainWindow::initMyWordList();
    // member variables
    static int _clickCounter;
    QStringList _wordList;
    }

//private slots:
    //void on_Button_clicked();


#endif // MAINWINDOW_H

main.cpp:
Code:

#include <QtGui/QApplication>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}
}

mainwindows.cpp:
Code:

#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()) {
    case QEvent::LanguageChange:
        ui->retranslateUi(this);
        break;
    default:
        break;
    }
}

void MainWindow::buttonClickHandler()
{
}

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

//init my word file
void MainWindow::initMyWordList()
{
        QFile * wordFile = new QFile("C:\Users\Edvinas\Desktop\MAEMO\N900\Development\test");
        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::on_Button_clicked()
{
      ui->label->setText(QString("the word of the day is %1").arg(_wordList[_clickCounter++]) );
}

And i get:

C:/Users/Edvinas/Documents/InteractiveHelloWorld/main.cpp:2: In file included from main.cpp:2:

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

C:/Users/Edvinas/Documents/InteractiveHelloWorld/main.cpp:10: error: expected unqualified-id at end of input

Remove the curlys from: main.cpp
and add them to: mainwindow.h

Like someone said before: Compare and match the curly braces

Code:

private:

    { //REMOVE!!
    Ui::MainWindow *ui;
    // member functions
    void MainWindow::initMyWordList();
    // member variables
    static int _clickCounter;
    QStringList _wordList;
    } //REMOVE!!

Remove the curly's from above

arne.anka 2010-04-02 10:25

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by tdesws (Post 580417)
mainwindow.h:
Code:

class MainWindow : public QMainWindow {
...
}
#endif // MAINWINDOW_H


you are missing the closing bracket. put one } before #endif

Quote:

main.cpp:
Code:

#include <QtGui/QApplication>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
...
}


here you got one } to much. remove the last }.

every opening bracket (curly, square, round) has to be closed again.
check your ide's or editor's settings -- almost all should have some kind of visual markers helping you to detect those trivial and easily overlocked syntactical errors.

tdesws 2010-04-05 20:01

Re: I'm learning with Qt and I have a question
 
Ok, now i get only this:

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

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

here's mainwindow.h:

Quote:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow;
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
~MainWindow();

public slots:
void buttonClickHandler();

protected:
void changeEvent(QEvent *e);

private:
Ui::MainWindow *ui;
// member functions
void MainWindow::initMyWordList();
// member variables
static int _clickCounter;
QStringList _wordList;

//private slots:
//void on_Button_clicked();

}
#endif // MAINWINDOW_H



krk969 2010-04-05 20:19

Re: I'm learning with Qt and I have a question
 
class MainWindow : public QMainWindow;

remove the semicolon from the end of the line, you put a semicolon only when you finish a definition or statement, here the class definition isnt over.
Put the semi-colon at the end of the mainwindow.h after the last curly brace marking the end of the class definition.

tdesws 2010-04-06 11:15

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by krk969 (Post 596780)
class MainWindow : public QMainWindow;

remove the semicolon from the end of the line, you put a semicolon only when you finish a definition or statement, here the class definition isnt over.
Put the semi-colon at the end of the mainwindow.h after the last curly brace marking the end of the class definition.

Did that, but now I get

C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.h:26: error: extra qualification 'MainWindow::' on member 'initMyWordList'

arne.anka 2010-04-06 11:21

Re: I'm learning with Qt and I have a question
 
do what the error says, remove the "extra qualification 'MainWindow::' " at line 26:

void MainWindow::initMyWordList();

should be

void initMyWordList();

in your header you are declaring the class itself, no need for the namespace here.

tdesws 2010-04-06 12:46

Re: I'm learning with Qt and I have a question
 
: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:
Quote:

#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::on_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::on_Button_clicked()
{
ui->label->setText(QString("the word of the day is %1").arg(_wordList[_clickCounter++]) );
}

gunni 2010-04-06 13:14

Re: I'm learning with Qt and I have a question
 
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

tdesws 2010-04-06 13:22

Re: I'm learning with Qt and I have a question
 
C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.cpp:35: error: no 'void MainWindow::on_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

Robb 2010-04-06 13:29

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by tdesws (Post 597661)
C:/Users/Edvinas/Documents/InteractiveHelloWorld/mainwindow.cpp:35: error: no 'void MainWindow::on_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

gunni 2010-04-06 13:32

Re: I'm learning with Qt and I have a question
 
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.

Quote:

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();

gunni 2010-04-06 13:55

Re: I'm learning with Qt and I have a question
 
Oh, and
Code:

error = initMyWordList();
wont work, as you declared the function as "void" so it cant return a value.

Venemo 2010-04-19 20:37

Re: I'm learning with Qt and I have a question
 
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 2010-04-20 07:36

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by Venemo (Post 618351)
... 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

mikhas 2010-04-20 07:57

Re: I'm learning with Qt and I have a question
 
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.

Venemo 2010-04-20 10:35

Re: I'm learning with Qt and I have a question
 
Quote:

Originally Posted by krk969 (Post 618904)
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.


All times are GMT. The time now is 08:31.

vBulletin® Version 3.8.8