fäbs
5th May 2015, 11:58
HI,
i have a problem with my qt program.
first of all i have a QTextBrowser and a Button. when the button is clicked it should call a method from a c++ class like this:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_Button_clicked()
{
try{
GUIController guiController;
guiController.somemethode();
}
catch (char const* err){
cout << err << endl;
}
}
This called methode should do something and then call a method from mainwindow class which should set Text to the textBrowser like this:
GUIController::GUIController()
{
}
GUIController::~GUIController()
{
}
void GUIController::somemethode{
...
...
mainwindow.printToOutput(("text"));
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::printToOutput(QString text){
ui->outputText->append(text);
}
But the problem is that the text doesn't appear in the QTextBrowser.
Has anybody an idea whats the problem?
i googled a long time and i think the problem is something with the "render loop" of the gui but i don't know how to fix it.
Thanks for help!
i have a problem with my qt program.
first of all i have a QTextBrowser and a Button. when the button is clicked it should call a method from a c++ class like this:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_Button_clicked()
{
try{
GUIController guiController;
guiController.somemethode();
}
catch (char const* err){
cout << err << endl;
}
}
This called methode should do something and then call a method from mainwindow class which should set Text to the textBrowser like this:
GUIController::GUIController()
{
}
GUIController::~GUIController()
{
}
void GUIController::somemethode{
...
...
mainwindow.printToOutput(("text"));
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::printToOutput(QString text){
ui->outputText->append(text);
}
But the problem is that the text doesn't appear in the QTextBrowser.
Has anybody an idea whats the problem?
i googled a long time and i think the problem is something with the "render loop" of the gui but i don't know how to fix it.
Thanks for help!