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).
QList<Card*>* newcard = new QList<Card*>;
QList<Card*>* newcard = new QList<Card*>;
To copy to clipboard, switch view to plain text mode
I have one label on my dialog that should display a QString from the first object of my QList.
ui->textlabel->setText(newcard->takeAt(0)->getfront());
ui->textlabel->setText(newcard->takeAt(0)->getfront());
To copy to clipboard, switch view to plain text mode
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.
void MyDialog::on_pushbutton_clicked()
{
ui->textlabel->setText(newcard->takeAt(0)->getback());
}
void MyDialog::on_pushbutton_clicked()
{
ui->textlabel->setText(newcard->takeAt(0)->getback());
}
To copy to clipboard, switch view to plain text mode
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:
QMessageBox::information(this,"Title",QString::number(newcard->count()));
To copy to clipboard, switch view to plain text mode
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.
Bookmarks