summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ui/qt/uat_delegate.cpp8
-rw-r--r--ui/qt/uat_model.cpp20
2 files changed, 25 insertions, 3 deletions
diff --git a/ui/qt/uat_delegate.cpp b/ui/qt/uat_delegate.cpp
index 7c847a109e..641edbcc24 100644
--- a/ui/qt/uat_delegate.cpp
+++ b/ui/qt/uat_delegate.cpp
@@ -99,7 +99,15 @@ void UatDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
QComboBox *combobox = static_cast<QComboBox *>(editor);
const QString &data = index.model()->data(index, Qt::EditRole).toString();
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
combobox->setCurrentText(data);
+#else
+ int new_index = combobox->findText(data);
+ if (new_index >= 0) {
+ combobox->setCurrentIndex(new_index);
+ }
+#endif
+
break;
}
diff --git a/ui/qt/uat_model.cpp b/ui/qt/uat_model.cpp
index 6927674190..03337e2c51 100644
--- a/ui/qt/uat_model.cpp
+++ b/ui/qt/uat_model.cpp
@@ -179,9 +179,18 @@ bool UatModel::setData(const QModelIndex &index, const QVariant &value, int role
// The validation status for other columns were also affected by
// changing this field, mark those as dirty!
emit dataChanged(this->index(row, updated_cols.first()),
- this->index(row, updated_cols.last()), roles);
+ this->index(row, updated_cols.last())
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ , roles
+#endif
+ );
} else {
- emit dataChanged(index, index, roles);
+
+ emit dataChanged(index, index
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ , roles
+#endif
+ );
}
return true;
}
@@ -252,7 +261,12 @@ bool UatModel::copyRow(int dst_row, int src_row)
QVector<int> roles;
roles << Qt::EditRole << Qt::BackgroundRole;
- emit dataChanged(index(dst_row, 0), index(dst_row, columnCount()), roles);
+ emit dataChanged(index(dst_row, 0), index(dst_row, columnCount())
+#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
+ , roles
+#endif
+ );
+
return true;
}