Function matching in Qt

Posted by Alexander on Stack Overflow See other posts from Stack Overflow or by Alexander
Published on 2010-03-29T19:47:44Z Indexed on 2010/03/29 19:53 UTC
Read the original article Hit count: 332

Filed under:
|
|

Hello, I have some trouble with Qt.

I have a class 'Core'

class Core {

   public:

        static QString get_file_content(QString filename);
        static void setMainwindow(MainWindow *w);

   private:
        static MainWindow *main_window;
};

and class 'MainWindow' in namespace Ui:

namespace Ui {
    class MainWindow;
}

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

private:
    Ui::MainWindow *ui;
};

In MainWindow constructor I make

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

and gets error

mainwindow.cpp:8: error: no matching function for call to 'Core::setMainwindow(MainWindow* const)'

Of cource, i include core.h with declaration of 'Core' class.

That's occurs only on setMainwindow method.

So the questions is - why Core class method setMainwindow() is invisible in MainWindow class?

© Stack Overflow or respective owner

Related posts about qt

Related posts about c++