Abdelrazak Younes <[EMAIL PROTECTED]> writes: | Edwin Leuven wrote: | > Edwin Leuven wrote: | >> Abdelrazak Younes wrote: | >>> + // But Qt doc just say use bits... | >>> + unsigned int * const data = (unsigned int *)img.bits(); | >> | >> kde has this instead: | >> | >> unsigned int *data = img.depth() > 8 ? (unsigned int *)img.bits() : | >> (unsigned int *)img.colorTable(); | >> | > but it turns out i get: | > ../../../../lyx-devel/src/frontends/qt4/QLImage.C:187: error: | > invalid cast from type 'QVector<unsigned int>' to type 'unsigned int* | > which makes me wonder why it works for kde... | | Maybe because they still have QT3_SUPPORT defined? | | > is the following a good solution? | > unsigned int *data = img.depth() > 8 ? (unsigned int *)img.bits() : | > (unsigned int *)img.colorTable().begin(); | | Don't know...
If QVector is too incompatible to std::vector then "&img.colorTable[0]" should be used. (That is a STL idom.) casting begin() is not good.... what if begin returns a "real" iterator and not just a pointer? -- Lgb