Invalid use of qualified-name



  • When I run my file Qt Creator says: @invalid use of qualified-name 'QUiLoader::createLayout'@

    There is my cpp file.
    @#include "harjoittelu.h"
    #include "ui_harjoittelu.h"

    Harjoittelu::Harjoittelu(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Harjoittelu)
    {
    ui->setupUi(this);
    }

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

    void Harjoittelu::on_pushButton_2_clicked()
    {
    QLayout QUiLoader::createLayout(const QString &harjoittelu, QObject Harjoittelu = 0, const QString &Edit = QString());
    }
    @

    And there is header:
    @#ifndef HARJOITTELU_H
    #define HARJOITTELU_H

    #include <QMainWindow>
    #include <QtUiTools/QUiLoader>

    namespace Ui {
    class Harjoittelu;
    }

    class Harjoittelu : public QMainWindow
    {
    Q_OBJECT

    public:
    explicit Harjoittelu(QWidget *parent = 0);
    ~Harjoittelu();

    private:
    Ui::Harjoittelu *ui;
    #include <QtUiTools/QUiLoader>

    private slots:
    void on_pushButton_2_clicked();
    };

    #endif // HARJOITTELU_H@

    Do you know what is the problem???
    Thanx!!!!


  • Moderators

    why is
    @#include <QtUiTools/QUiLoader> @
    in the middle of your class and not on top of your page...?



  • Ups. I just tested where I must put that, and forgot it. I took it out, but nothing happened.


  • Moderators

    your use 'QUiLoader::createLayout'
    in line 18 of your cpp file. Qt Creator is telling to look there.

    There you are using a declaration of a virtual function in the body of a function!!!

    What is it you want to do exactly?



  • Ööö.. [quote author="Eddy" date="1307111920"]There you are using a declaration of a virtual function in the body of a function!!!
    What is it you want to do exactly?
    [/quote]I didn't get this really.
    I want open new layout when I click pushButton_2.

    Is there something simpler solution to do this?
    I looked instructions here: http://doc.qt.nokia.com/latest/quiloader.html#createLayout

    Is it layout even it what shows on top of phone's screen and I can edit it in Qt Designer (set push buttons, list widgets, spin box etc.)?


  • Moderators

    i suggest you read the docs.
    just follow your link and go to the detailed description.

    There is an example that shows the proper way to use a layout.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.