tellico/boolean_fields_fix.patch
2011-10-18 12:31:18 +00:00

35 lines
1.1 KiB
Diff

--- a/src/models/entrymodel.cpp
+++ b/src/models/entrymodel.cpp
@@ -104,22 +104,23 @@ QVariant EntryModel::data(const QModelIn
if(!field) {
return QVariant();
}
- if(field->type() == Data::Field::Bool) {
- return m_checkPix;
- } else if(field->type() == Data::Field::Rating) {
- return GUI::RatingWidget::pixmap(value);
- }
-
entry = this->entry(index_);
if(!entry) {
return QVariant();
}
-
- // we don't need a formatted value for image id
+ // we don't need a formatted value for any pixmaps
value = entry->field(field);
if(value.isEmpty()) {
return QVariant();
}
+
+ if(field->type() == Data::Field::Bool) {
+ // assume any non-empty value equals true
+ return m_checkPix;
+ } else if(field->type() == Data::Field::Rating) {
+ return GUI::RatingWidget::pixmap(value);
+ }
+
if(m_imagesAreAvailable && field->type() == Data::Field::Image) {
const Data::Image& img = ImageFactory::imageById(value);
if(!img.isNull()) {