Hi all,
I have the following classes:
MainWindow class:
namespace Ui {
class MainWindow;
}
Q_OBJECT
public:
explicit MainWindow
(QWidget *parent
= 0);
};
ui->setupUi(this);
}
return "...";
}
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
QString someData();
};
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) {
ui->setupUi(this);
}
QString MainWindow::someData() {
return "...";
}
To copy to clipboard, switch view to plain text mode
Dialog class:
namespace Ui {
class Dialog;
}
Q_OBJECT
void anyFunction();
public:
explicit Dialog
(QWidget *parent
= 0);
};
Dialog
::Dialog(QWidget *parent
) : QDialog(parent
), ui
(new Ui
::Dialog) { ui->setupUi(this);
}
void Dialog::anyFunction() {
qDebug() << MainWindow->someData();
}
namespace Ui {
class Dialog;
}
class Dialog : public QDialog {
Q_OBJECT
void anyFunction();
public:
explicit Dialog(QWidget *parent = 0);
};
Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) {
ui->setupUi(this);
}
void Dialog::anyFunction() {
qDebug() << MainWindow->someData();
}
To copy to clipboard, switch view to plain text mode
In the Dialog class (row 19.): how can I access the someData() function from MainWindow?
Thanks in advance!
Chris
Bookmarks