src/gui/itemviews/qstyleditemdelegate.cpp
branchRCL_3
changeset 8 3f74d0d4af4c
parent 4 3b1da2848fc7
equal deleted inserted replaced
6:dee5afe5301f 8:3f74d0d4af4c
   745             return false;
   745             return false;
   746     } else {
   746     } else {
   747         return false;
   747         return false;
   748     }
   748     }
   749 
   749 
   750     Qt::CheckState state;
   750     Qt::CheckState state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
   751     if ( flags & Qt::ItemIsTristate ) {
       
   752         state = static_cast<Qt::CheckState>( (value.toInt() + 1) % 3 );
       
   753     } else {
       
   754         state = (static_cast<Qt::CheckState>(value.toInt()) == Qt::Checked
       
   755                             ? Qt::Unchecked : Qt::Checked);
   751                             ? Qt::Unchecked : Qt::Checked);
   756     }
       
   757     return model->setData(index, state, Qt::CheckStateRole);
   752     return model->setData(index, state, Qt::CheckStateRole);
   758 }
   753 }
   759 
   754 
   760 QT_END_NAMESPACE
   755 QT_END_NAMESPACE
   761 
   756