Reputation: 948
I have two files player.h and accountTab.h I need references to player() class from player.h in accountTab.h and Ui::accountTab from accountTab.h
In mainwindow.h i declared player() as:
class player *user;
and it works
In player.h i try to declare Ui::accountTab same like player:
class Ui::accountTab *tab;
But it doesn't work. It throws error.
'accountTab' in namespace 'Ui' does not name a type class Ui::accountTab *tab;
accountTab.h:
#include <QMainWindow>
#include <player.h>
namespace Ui {
class accountTab;
}
class accountTab : public QMainWindow
{
Q_OBJECT
public:
explicit accountTab(QWidget *parent = 0);
class player *user;
~accountTab();
private slots:
void on_cleanZoo_clicked();
void on_collectStars_clicked();
private:
Ui::accountTab *ui;
};
Upvotes: 1
Views: 6380
Reputation: 11
you can open the .ui file to ensure that the class in .xml file is accountTab(in general,the name of the class generated by .xml is "Form",if you desinge by Qt designer)
Upvotes: 0
Reputation: 314
If you declare a variable, you don't need to use class
keyword. The correct declaration is:
player *user;
UI::accountTab *tab;
Move definition of accountTab
class into its namespace, where it's declared:
namespace Ui {
class accountTab : public QMainWindow
{
public:
explicit accountTab(QWidget *parent = 0);
class player *user;
~accountTab();
private:
void on_cleanZoo_clicked();
void on_collectStars_clicked();
private:
Ui::accountTab *ui;
};
}
Using of private slots:
and the single word QObject
doesn't seem to be correct. Maybe it's just a misprint, but you should fix it.
Upvotes: 2