File: code_policy.txt

package info (click to toggle)
quassel 1%3A0.13.1-1%2Bdeb10u2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 24,888 kB
  • sloc: cpp: 66,948; perl: 15,837; ansic: 4,418; sql: 1,225; sh: 328; xml: 263; python: 224; makefile: 25
file content (26 lines) | stat: -rw-r--r-- 843 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
This file is intended to keep notes about general coding stuff, code
conventions or how to best interact with certain parts of Qt.



Regarding QSortFilterProxyModel:
========================================
When subclassing QSortFilterProxyModel avoid the use of the following
calls on QModelIndex and use their equivalents of QAbstractItemModel:

inline QModelIndex QModelIndex::parent() const
inline QModelIndex QModelIndex::sibling(int arow, int acolumn) const
inline QModelIndex QModelIndex::child(int arow, int acolumn) const
inline QVariant QModelIndex::data(int arole) const
inline Qt::ItemFlags QModelIndex::flags() const

For Example when reimplementing QSortFilterProxyModel::data(const
QModelIndex &idx, int role):

Avoid:
 idx.data(role); 

Instead:
 QModelIndex source_index = mapToSource(idx);
 sourceModel()->data(idx, role);