Some model shit.
This commit is contained in:
parent
dec5f18ad6
commit
a8316e2c2a
1 changed files with 6 additions and 3 deletions
|
@ -162,7 +162,12 @@ void MessagesModel::setupHeaderData() {
|
||||||
Qt::ItemFlags MessagesModel::flags(const QModelIndex &index) const {
|
Qt::ItemFlags MessagesModel::flags(const QModelIndex &index) const {
|
||||||
Q_UNUSED(index)
|
Q_UNUSED(index)
|
||||||
|
|
||||||
|
#if QT_VERSION >= 0x050000
|
||||||
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemNeverHasChildren;
|
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable | Qt::ItemNeverHasChildren;
|
||||||
|
#else
|
||||||
|
|
||||||
|
return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant MessagesModel::data(int row, int column, int role) const {
|
QVariant MessagesModel::data(int row, int column, int role) const {
|
||||||
|
@ -305,9 +310,7 @@ bool MessagesModel::switchMessageImportance(int row_index) {
|
||||||
int current_importance = data(target_index, Qt::EditRole).toInt();
|
int current_importance = data(target_index, Qt::EditRole).toInt();
|
||||||
|
|
||||||
// Rewrite "visible" data in the model.
|
// Rewrite "visible" data in the model.
|
||||||
bool working_change = current_importance == 1 ?
|
bool working_change = current_importance == 1 ? setData(target_index, 0) : setData(target_index, 1);
|
||||||
setData(target_index, 0) :
|
|
||||||
setData(target_index, 1);
|
|
||||||
|
|
||||||
if (!working_change) {
|
if (!working_change) {
|
||||||
// If rewriting in the model failed, then cancel all actions.
|
// If rewriting in the model failed, then cancel all actions.
|
||||||
|
|
Loading…
Add table
Reference in a new issue