No member named X in
-
Hello Everyone,
I got the following error :
I can call my page itselft and it's work, but when i call another (MainWindow), it doesn't find the "setModal".
Why ?
If you need mainwindow.h :#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: void on_pushButton_3_clicked(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
and my pageprincipale.h :
#ifndef PAGEPRINCIPALE_H #define PAGEPRINCIPALE_H #include <QDialog> namespace Ui { class pagePrincipale; } class pagePrincipale : public QDialog { Q_OBJECT public: explicit pagePrincipale(QWidget *parent = nullptr); ~pagePrincipale(); private slots: void on_pushButton_clicked(); private: Ui::pagePrincipale *ui; }; #endif // PAGEPRINCIPALE_H
Thank you
-
Hello Everyone,
I got the following error :
I can call my page itselft and it's work, but when i call another (MainWindow), it doesn't find the "setModal".
Why ?
If you need mainwindow.h :#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: void on_pushButton_3_clicked(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
and my pageprincipale.h :
#ifndef PAGEPRINCIPALE_H #define PAGEPRINCIPALE_H #include <QDialog> namespace Ui { class pagePrincipale; } class pagePrincipale : public QDialog { Q_OBJECT public: explicit pagePrincipale(QWidget *parent = nullptr); ~pagePrincipale(); private slots: void on_pushButton_clicked(); private: Ui::pagePrincipale *ui; }; #endif // PAGEPRINCIPALE_H
Thank you
@Cervo2paille said in No member named X in:
I can call my page itselft and it's work, but when i call another (MainWindow), it doesn't find the "setModal".
Because QMainWindow has no such a function: https://doc.qt.io/qt-6/qmainwindow-members.html, only QDialog has such functions.
-
Hello Everyone,
I got the following error :
I can call my page itselft and it's work, but when i call another (MainWindow), it doesn't find the "setModal".
Why ?
If you need mainwindow.h :#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } QT_END_NAMESPACE class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = nullptr); ~MainWindow(); private slots: void on_pushButton_3_clicked(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
and my pageprincipale.h :
#ifndef PAGEPRINCIPALE_H #define PAGEPRINCIPALE_H #include <QDialog> namespace Ui { class pagePrincipale; } class pagePrincipale : public QDialog { Q_OBJECT public: explicit pagePrincipale(QWidget *parent = nullptr); ~pagePrincipale(); private slots: void on_pushButton_clicked(); private: Ui::pagePrincipale *ui; }; #endif // PAGEPRINCIPALE_H
Thank you
@Cervo2paille
Salut,There is some confusion between pageprincipale and MainWidow.
pageprincipale is your dialog.
And this is MainWindow that receives the signal on_pushButton_3_clicked, not pageprincipale.Cerveau de paille tĂȘte en l'air :)
-
@Cervo2paille said in No member named X in:
I can call my page itselft and it's work, but when i call another (MainWindow), it doesn't find the "setModal".
Because QMainWindow has no such a function: https://doc.qt.io/qt-6/qmainwindow-members.html, only QDialog has such functions.
@Christian-Ehrlicher
Thank you. So i can't call my QMainWindow ? Maybe another way exists do to that ?@mpergand Thanks for you answer.
I got a pushbutton in my pagePrincipale to go to my MainWindow, and i got another push button in my MainWindow to go to my pagePrincipale too ;) -
@Christian-Ehrlicher
Thank you. So i can't call my QMainWindow ? Maybe another way exists do to that ?@mpergand Thanks for you answer.
I got a pushbutton in my pagePrincipale to go to my MainWindow, and i got another push button in my MainWindow to go to my pagePrincipale too ;)@Cervo2paille said in No member named X in:
So i can't call my QMainWindow ?
You can, but you can't call a method on an instance of a class which does not have such a method - isn't that logical?
-
@Christian-Ehrlicher
Thank you. So i can't call my QMainWindow ? Maybe another way exists do to that ?@mpergand Thanks for you answer.
I got a pushbutton in my pagePrincipale to go to my MainWindow, and i got another push button in my MainWindow to go to my pagePrincipale too ;)@Cervo2paille
your QMainWinow instance it telling you to "Go Fish".Nothing you can do about it. Use a QDialog or one of its derivatives.
That said, what exactly do you want to archive here, can you describe it a bit more?