PDA

View Full Version : Compile error in dexedit.cpp



Browner87
Aug 19th, 2009, 09:31 PM
C:/Qt/PPSE/Source/./dexEdit.cpp:401: error: 'QTableWidgetItem::setFlags' : cannot convert parameter 1 from 'bool' to 'Qt::ItemFlags'lines 401, 450, 451, 461, 462, 493, and 522 have that error.

The first line of code in question is:


m_ui->tblSC->item( num,2 )->setFlags( !Qt::ItemIsEnabled );
I personally don't see the problem since !Qt::ItemIsEnabled should technically return a 1 or 0, both of which are valid flags for setFlags. Does the return of them have to be casted?


Any ideas?

evandixon
Aug 19th, 2009, 09:33 PM
What are you trying to do?

Browner87
Aug 19th, 2009, 10:13 PM
Just compile. I downloaded all the source code (and everything else too) from the SVN and tried to compile it and the compiler spit this out.

I tried compiling on Visual Studio 2008 Professional with the Qt addon and from Qt Creator 1.2.1.

I have Qt 4.5.0 installed.

---------- Post added at 10:13 PM ---------- Previous post was at 09:43 PM ----------

Oh, I was right. I just cast the answer as Qt::ItemFlags and it *seems* to work right now. It compiled anyways. I'm going to have some fun and test it out now.

Jiggy-Ninja
Aug 20th, 2009, 11:46 AM
Oops. I think the operator I wanted to use there is ~. That's the one that inverts all the bits, right?

Browner87
Aug 20th, 2009, 03:17 PM
um, I don't think so.


!

means 'not'. So, if it was true, not true is false (0).

Maybe I'm wrong, but I just put


m_ui->tblSC->item( num,2 )->setFlags((Qt::ItemFlags) !Qt::ItemIsEnabled );</pre>
I think. That's how I casted it to be a Qt::ItemFlags instead of boolean.