[Qt-interest] QString from char* [] ?
Thiago Macieira
thiago at kde.org
Sat Oct 2 12:16:10 CEST 2010
On Saturday 2. October 2010 12.06.32 Aaron Lewis wrote:
> Hi,
> Assume an array like this one ,
>
> const char * planets [] = { "sun" , "moon" };
>
> So how do i add these elements to a combo box ?
>
> If i do like this , it will drop a segment fault.
>
> Code:
> for ( ... ) {
> cout << planets [i] << endl; // See outputs , all correctly
> ui->comboBox->addItems ( planets [i] ); // Segfault on
> QString constructions.
Can you post the backtrace of the crash and the valgrind log of it? QString is
crashing because some pointer is invalid, but we don't know which.
PS: neither the sun nor the moon are planets...
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20101002/a95f2ef3/attachment.bin
More information about the Qt-interest-old
mailing list