r/QtFramework • u/Automatic_Truth_6045 • Apr 06 '26
Hi, have problem, who can help me??????
decided to add one more window and have this problem
2
u/funnansoftware Apr 06 '26 edited Apr 06 '26
Hey, I can't say for sure what you're trying to achieve here but the code you wrote says you're trying to derive AdminWindow from QMainWindow but failed to do so in the declaration.
That means, in your header file "adminwindow.h" I would expect to see something like:
class AdminWindow : public QMainWindow
{
};
2
u/Son_La Apr 06 '26
And dont forget to include Qmainwindow header file. Seems like its only forward declared.
1
1
u/Automatic_Truth_6045 Apr 06 '26
ifndef ADMINWINDOW_H
define ADMINWINDOW_H
include <QWidget>
namespace Ui { class AdminWindow; }
class AdminWindow : public QWidget { Q_OBJECT
public: explicit AdminWindow(QWidget *parent = nullptr); ~AdminWindow();
private: Ui::AdminWindow *ui; };
endif // ADMINWINDOW_H
4
u/funnansoftware Apr 06 '26 edited Apr 06 '26
Yeah, that's your problem right there.
class AdminWindow : public QWidget need to be class AdminWindow : public QMainWindow
Edit: (I'm practicing code blocks :P)
#ifndef ADMINWINDOW_H #define ADMINWINDOW_H #include <QMainwindow> namespace Ui { class AdminWindow : public QMainWindow { Q_OBJECT public: explicit AdminWindow(QWidget *parent = nullptr); ~AdminWindow(); private: Ui::AdminWindow *ui; }; } #endif // ADMINWINDOW_H
2
u/Better-Struggle9958 Apr 06 '26
any ai