So I have in mainwindow.h:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
void SetBoxTest(const QString &Text);
[...]
and in mainwindow.cpp:
void MainWindow::SetBoxTest(const QString &Text) {
ui->plainTextEdit->setPlainText(Text);
}
I want access
SetBoxTestin other.cppfile. I includedmainwindow.hand now what? How to properly accessSetBoxTestfunction?Is accessing UI in that way is correct?
Also I saw this
const QString &Textsomewhere, why shouldn't I just putQString Textfor such function type (which sets text in text box)? What's better?
EDIT: When I try to do it like :
MainWindow.SetBoxTest(DataString);
or
MainWindow.SetBoxTest(DataString);
It says I'm missing ; before .