Commit 372ad510 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🐛 Committed by Wolthera van Hövell
Browse files

Check that the model index is beneath colorchannel count.

It seems the real bug is that the thumbnails/model can take a bit to
update when generating the thumbnails, while the model/view is faster.
In this time, we shouldn't try to access information that doesn't exist.

BUG:442117


(cherry picked from commit 1eaf9dc7)
parent 3503242e
Pipeline #79132 skipped with stage
......@@ -39,30 +39,33 @@ QVariant ChannelModel::data(const QModelIndex& index, int role) const
int channelIndex = index.row();
switch (role) {
case Qt::DisplayRole: {
if (index.column() == 2) {
return channels.at(channelIndex)->name();
if (index.row() < m_channelCount) {
switch (role) {
case Qt::DisplayRole: {
if (index.column() == 2) {
return channels.at(channelIndex)->name();
}
return QVariant();
}
return QVariant();
}
case Qt::DecorationRole: {
if (index.column() == 1) {
Q_ASSERT(m_thumbnails.count() > index.row());
return QVariant(m_thumbnails.at(index.row()));
case Qt::DecorationRole: {
if (index.column() == 1) {
Q_ASSERT(m_thumbnails.count() > index.row());
return QVariant(m_thumbnails.at(index.row()));
}
return QVariant();
}
return QVariant();
}
case Qt::CheckStateRole: {
Q_ASSERT(index.row() < rowCount());
Q_ASSERT(index.column() < columnCount());
case Qt::CheckStateRole: {
Q_ASSERT(index.row() < rowCount());
Q_ASSERT(index.column() < columnCount());
if (index.column() == 0) {
QBitArray flags = rootLayer->channelFlags();
return (flags.isEmpty() || flags.testBit(channelIndex)) ? Qt::Checked : Qt::Unchecked;
if (index.column() == 0) {
QBitArray flags = rootLayer->channelFlags();
return (flags.isEmpty() || flags.testBit(channelIndex)) ? Qt::Checked : Qt::Unchecked;
}
return QVariant();
}
}
return QVariant();
}
}
}
return QVariant();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment