Jump to content

Recommended Posts

Posted

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?

Posted

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.

Posted

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...