I've been googling for a while, and I can find no solution to my problem. I want to access items in the ui from different files, but haven't had any luck. But anyway here's the code:
main.cpp
#include <QtGui/QApplication>
#include "window.h"
int main(int argc, char *argv[])
{
window w;
w.show();
return a.exec();
}
#include <QtGui/QApplication>
#include "window.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
window w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
window.cpp
#include "window.h"
#include "ui_window.h"
#include "worldBackup.h"
#include <QString>
ui(new Ui::window)
{
ui->setupUi(this);
}
window::~window()
{
delete ui;
}
void window
::updateStatus(QString text
) {
ui->statusBar->setText(text);
}
void window::on_quitButton_clicked()
{
listWorlds();
}
#include "window.h"
#include "ui_window.h"
#include "worldBackup.h"
#include <QString>
window::window(QWidget *parent) :
QWidget(parent),
ui(new Ui::window)
{
ui->setupUi(this);
}
window::~window()
{
delete ui;
}
void window::updateStatus(QString text)
{
ui->statusBar->setText(text);
}
void window::on_quitButton_clicked()
{
listWorlds();
}
To copy to clipboard, switch view to plain text mode
worldBackup.cpp
#include "window.h"
//#include "ui_window.h"
bool listWorlds(){
window::updateStatus("Status: Quitting...");
return true;
}
#include "window.h"
//#include "ui_window.h"
bool listWorlds(){
window::updateStatus("Status: Quitting...");
return true;
}
To copy to clipboard, switch view to plain text mode
window.h
#ifndef WINDOW_H
#define WINDOW_H
#include <QWidget>
namespace Ui {
class window;
}
{
Q_OBJECT
public:
explicit window
(QWidget *parent
= 0);
~window();
private slots:
void on_quitButton_clicked();
private:
Ui::window *ui;
};
#endif // WINDOW_H
#ifndef WINDOW_H
#define WINDOW_H
#include <QWidget>
namespace Ui {
class window;
}
class window : public QWidget
{
Q_OBJECT
public:
explicit window(QWidget *parent = 0);
~window();
void updateStatus(QString text);
private slots:
void on_quitButton_clicked();
private:
Ui::window *ui;
};
#endif // WINDOW_H
To copy to clipboard, switch view to plain text mode
worldBackup.h
#ifndef WORLDBACKUP_H
#define WORLDBACKUP_H
bool listWorlds();
#endif // WORLDBACKUP_H
#ifndef WORLDBACKUP_H
#define WORLDBACKUP_H
bool listWorlds();
#endif // WORLDBACKUP_H
To copy to clipboard, switch view to plain text mode
The error is thrown by line 5 of backupWorld.cpp
Bookmarks