examples/: fix compiler (GCC) warnings -Wsign-compare

Change-Id: Ie4965e3ce3113e9c7a5d5d5eba4cab143ef1c806
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ahmad Samir 2023-07-21 20:10:40 +03:00
parent ad6fd04609
commit 0b3390f33d

View File

@ -18,7 +18,7 @@ TreeItem::TreeItem(const QVariantList &data, TreeItem *parent)
//! [1] //! [1]
TreeItem *TreeItem::child(int number) TreeItem *TreeItem::child(int number)
{ {
if (number < 0 || number >= m_childItems.size()) if (number < 0 || number >= qsizetype(m_childItems.size()))
return nullptr; return nullptr;
return m_childItems.at(number).get(); return m_childItems.at(number).get();
} }
@ -67,7 +67,7 @@ QVariant TreeItem::data(int column) const
//! [6] //! [6]
bool TreeItem::insertChildren(int position, int count, int columns) bool TreeItem::insertChildren(int position, int count, int columns)
{ {
if (position < 0 || position > m_childItems.size()) if (position < 0 || position > qsizetype(m_childItems.size()))
return false; return false;
for (int row = 0; row < count; ++row) { for (int row = 0; row < count; ++row) {
@ -106,7 +106,7 @@ TreeItem *TreeItem::parent()
//! [9] //! [9]
bool TreeItem::removeChildren(int position, int count) bool TreeItem::removeChildren(int position, int count)
{ {
if (position < 0 || position + count > m_childItems.size()) if (position < 0 || position + count > qsizetype(m_childItems.size()))
return false; return false;
for (int row = 0; row < count; ++row) for (int row = 0; row < count; ++row)