Don't use QMap::firstKey() and lastKey(), which introduced in Qt5.2
This commit is contained in:
+18
-19
@@ -2297,39 +2297,38 @@ bool Worksheet::loadFromXmlFile(QIODevice *device)
|
||||
}
|
||||
}
|
||||
|
||||
validateDimension();
|
||||
d->validateDimension();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Worksheet::validateDimension()
|
||||
/*
|
||||
* Documents imported from Google Docs does not contain dimension data.
|
||||
*/
|
||||
void WorksheetPrivate::validateDimension()
|
||||
{
|
||||
Q_D(Worksheet);
|
||||
|
||||
if (d->dimension.isValid() || d->cellTable.isEmpty())
|
||||
if (dimension.isValid() || cellTable.isEmpty())
|
||||
return;
|
||||
|
||||
int firstRow = d->cellTable.firstKey();
|
||||
int lastRow = d->cellTable.lastKey();
|
||||
int firstCell = -1;
|
||||
int lastCell = -1;
|
||||
int firstRow = cellTable.constBegin().key();
|
||||
int lastRow = (cellTable.constEnd()-1).key();
|
||||
int firstColumn = -1;
|
||||
int lastColumn = -1;
|
||||
|
||||
for (QMap<int, QMap<int, QSharedPointer<Cell> > >::const_iterator it = d->cellTable.begin(),
|
||||
lim = d->cellTable.end(); it != lim; ++it)
|
||||
for (QMap<int, QMap<int, QSharedPointer<Cell> > >::const_iterator it = cellTable.begin(); it != cellTable.end(); ++it)
|
||||
{
|
||||
if (it.value().isEmpty())
|
||||
continue;
|
||||
Q_ASSERT(!it.value().isEmpty());
|
||||
|
||||
if (firstCell == -1 || it.value().firstKey() < firstCell)
|
||||
firstCell = it.value().firstKey();
|
||||
if (firstColumn == -1 || it.value().constBegin().key() < firstColumn)
|
||||
firstColumn = it.value().constBegin().key();
|
||||
|
||||
if (lastCell == -1 || it.value().lastKey() > lastCell)
|
||||
lastCell = it.value().lastKey();
|
||||
if (lastColumn == -1 || (it.value().constEnd()-1).key() > lastColumn)
|
||||
lastColumn = (it.value().constEnd()-1).key();
|
||||
}
|
||||
|
||||
CellRange cr(firstRow, firstCell, lastRow, lastCell);
|
||||
CellRange cr(firstRow, firstColumn, lastRow, lastColumn);
|
||||
|
||||
if (cr.isValid())
|
||||
d->dimension = cr;
|
||||
dimension = cr;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -152,7 +152,6 @@ private:
|
||||
|
||||
void saveToXmlFile(QIODevice *device) const;
|
||||
bool loadFromXmlFile(QIODevice *device);
|
||||
void validateDimension();
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE_XLSX
|
||||
|
||||
@@ -160,6 +160,7 @@ public:
|
||||
QString generateDimensionString() const;
|
||||
void calculateSpans() const;
|
||||
void splitColsInfo(int colFirst, int colLast);
|
||||
void validateDimension();
|
||||
|
||||
void saveXmlSheetData(QXmlStreamWriter &writer) const;
|
||||
void saveXmlCellData(QXmlStreamWriter &writer, int row, int col, QSharedPointer<Cell> cell) const;
|
||||
|
||||
Reference in New Issue
Block a user