I have strange behaviour while using an array of QTextEdit widgets.
-
I have implemented an array of QTextEdit boxes as follows:
QTextEdit* ntr_array[45];
ntr_array[1] = ui->textEdit_1;
I have a std::vector std::stringmyvector containing 45 text words of type std::string
Then I do this
Qstring tempstr = QString::fromStdString(myvector[1]);
ntr_array[1]->setText(tempstr);This compiles and when executed will seg fault at the last line: ntr_array[1]->setText(tempstr);
I've tried substituting
ui->textEdit_1->setText(tempstr);It still seg faults on this line.
I am using QT 4.8
QtCreator 3.2.2
on linux Fedora.Thanks for any help
-
@emp1953
You could try puttingui->textEdit_1
into the debugger's Watch window and having a look at what seems to be in it.I assume you created that in the designer. Have you done the
ui->setupUi()
call in your code? Make sure you have done a full rebuild. -
Yes ui->setup() happens
nutr[2] has a big hex number that looks like a pointer.I did a qmake on the .pro file and got a Makefile.
Did a 'make clean; make' now all is good. Apparently the clean function in qtCreator doesn't really function as advertisedThanks for the help