From 9d5038c13301d19f9610d319bb009cb1f271c64e 2014-04-08 04:44:18 From: Titta Heikkala Date: 2014-04-08 04:44:18 Subject: [PATCH] Fix bar category rendering for empty category The category in bar category axis can be an empty string (only one category can be empty for an axis as duplicates are removed). Task-number: QTRD-2343 Change-Id: I88e0130c2caac0675573907e52f9089c24197454 Reviewed-by: Miikka Heikkinen --- diff --git a/src/axis/barcategoryaxis/qbarcategoryaxis.cpp b/src/axis/barcategoryaxis/qbarcategoryaxis.cpp index c33e6c6..c222412 100644 --- a/src/axis/barcategoryaxis/qbarcategoryaxis.cpp +++ b/src/axis/barcategoryaxis/qbarcategoryaxis.cpp @@ -514,19 +514,22 @@ void QBarCategoryAxisPrivate::setRange(const QString &minCategory, const QStrin emit q->maxChanged(maxCategory); emit q->rangeChanged(m_minCategory, m_maxCategory); emit rangeChanged(m_min,m_max); + return; } if (m_categories.indexOf(maxCategory) < m_categories.indexOf(minCategory)) return; - if (!minCategory.isEmpty() && m_minCategory != minCategory && m_categories.contains(minCategory)) { + if (!minCategory.isNull() && (m_minCategory != minCategory || m_minCategory.isNull()) + && m_categories.contains(minCategory)) { m_minCategory = minCategory; m_min = m_categories.indexOf(m_minCategory) - 0.5; changed = true; emit q->minChanged(minCategory); } - if (!maxCategory.isEmpty() && m_maxCategory != maxCategory && m_categories.contains(maxCategory)) { + if (!maxCategory.isNull() && (m_maxCategory != maxCategory || m_maxCategory.isNull()) + && m_categories.contains(maxCategory)) { m_maxCategory = maxCategory; m_max = m_categories.indexOf(m_maxCategory) + 0.5; changed = true;