diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 20:26:39 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2021-01-02 20:26:39 +0100 |
| commit | 8de7b79a2b211805a4ba348e490a7ab8eac15eef (patch) | |
| tree | 98dae2b10b0d4cd368fcc3346fefaffa73df1242 /src/modelutils.cpp | |
| parent | d96dcf02b131808a25045afc23667ed6a26274a6 (diff) | |
Move markers management for overwrite/overwritten to ModListView.
Diffstat (limited to 'src/modelutils.cpp')
| -rw-r--r-- | src/modelutils.cpp | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/modelutils.cpp b/src/modelutils.cpp index 7b54d258..83054806 100644 --- a/src/modelutils.cpp +++ b/src/modelutils.cpp @@ -90,38 +90,4 @@ QModelIndexList indexViewToModel(const QModelIndexList& index, const QAbstractIt return result; } -QColor childrenColor(const QModelIndex& index, QTreeView* view, int role) -{ - auto* model = view->model(); - auto rowIndex = index.sibling(index.row(), 0); - - if (model->hasChildren(rowIndex) && !view->isExpanded(rowIndex)) { - - // this is a non-expanded item - std::vector<QColor> colors; - for (int i = 0; i < model->rowCount(rowIndex); ++i) { - auto childData = model->data(model->index(i, index.column(), rowIndex), role); - if (childData.isValid() && childData.canConvert<QColor>()) { - colors.push_back(childData.value<QColor>()); - } - } - - if (colors.empty()) { - return QColor(); - } - - int r = 0, g = 0, b = 0, a = 0; - for (auto& color : colors) { - r += color.red(); - g += color.green(); - b += color.blue(); - a += color.alpha(); - } - - return QColor(r / colors.size(), g / colors.size(), b / colors.size(), a / colors.size()); - } - - return QColor(); -} - } |
