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
SetBoxTest
in other.cpp
file. I includedmainwindow.h
and now what? How to properly accessSetBoxTest
function?Is accessing UI in that way is correct?
Also I saw this
const QString &Text
somewhere, why shouldn't I just putQString Text
for 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 .