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
) : 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;
}
}
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;
}
}
To copy to clipboard, switch view to plain text mode
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"));
}
GUIController::GUIController()
{
}
GUIController::~GUIController()
{
}
void GUIController::somemethode{
...
...
mainwindow.printToOutput(("text"));
}
To copy to clipboard, switch view to plain text mode
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow
::printToOutput(QString text
){
ui->outputText->append(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);
}
To copy to clipboard, switch view to plain text mode
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!
Bookmarks