Hello everyone,
I'm relatively new to Qt and to programming as a whole. So be clement ;)
My system is Windows 7, I am using Qt 5.1 with MinGW 32bit.
My problem:
I have a dialog that reads data from an sqlite database and writes it in a QList object. This QList contains objects of a C++ class I created (the class is called 'Card' and contains eight different QStrings).
Code:
QList<Card*>* newcard = new QList<Card*>;
I have one label on my dialog that should display a QString from the first object of my QList.
Code:
ui->textlabel->setText(newcard->takeAt(0)->getfront());
This works fine, the label is correctly displaying the QString. But then I want to change the text of the label when clicking a pushbutton.
Code:
void MyDialog::on_pushbutton_clicked() { ui->textlabel->setText(newcard->takeAt(0)->getback()); }
And this produces a SIGSEGV and the program crashes. I tried to fix the problem with different approaches, but none of them worked. The following code works neither:
I also cannot transmit the QList to another dialog and work with it there. It crashes as well.
I think this problem has a simple solution and I am just to much of an amateur to see that. Please help me!
Well this thread should probably be in the newbie section, but I don't know how to move the thread...sorry.