Commit a9fc7f0b authored by Albert Astals Cid's avatar Albert Astals Cid

qt6: workaround QTBUG-86318

parent 418a9373
......@@ -182,11 +182,13 @@ void CrazyThread::run()
if (!annotations.isEmpty()) {
qDebug() << "modify annotation...";
annotations.at(QRandomGenerator::global()->bounded(annotations.size()))->setBoundary(QRectF(0.5, 0.5, 0.25, 0.25));
annotations.at(QRandomGenerator::global()->bounded(annotations.size()))->setAuthor(QStringLiteral("foo"));
annotations.at(QRandomGenerator::global()->bounded(annotations.size()))->setContents(QStringLiteral("bar"));
annotations.at(QRandomGenerator::global()->bounded(annotations.size()))->setCreationDate(QDateTime::currentDateTime());
annotations.at(QRandomGenerator::global()->bounded(annotations.size()))->setModificationDate(QDateTime::currentDateTime());
// size is now a qsizetype which confuses bounded(), pretend we will never have that many annotations anyway
const quint32 annotationsSize = annotations.size();
annotations.at(QRandomGenerator::global()->bounded(annotationsSize))->setBoundary(QRectF(0.5, 0.5, 0.25, 0.25));
annotations.at(QRandomGenerator::global()->bounded(annotationsSize))->setAuthor(QStringLiteral("foo"));
annotations.at(QRandomGenerator::global()->bounded(annotationsSize))->setContents(QStringLiteral("bar"));
annotations.at(QRandomGenerator::global()->bounded(annotationsSize))->setCreationDate(QDateTime::currentDateTime());
annotations.at(QRandomGenerator::global()->bounded(annotationsSize))->setModificationDate(QDateTime::currentDateTime());
}
qDeleteAll(annotations);
......@@ -208,7 +210,9 @@ void CrazyThread::run()
if (!annotations.isEmpty()) {
qDebug() << "remove annotation...";
page->removeAnnotation(annotations.takeAt(QRandomGenerator::global()->bounded(annotations.size())));
// size is now a qsizetype which confuses bounded(), pretend we will never have that many annotations anyway
const quint32 annotationsSize = annotations.size();
page->removeAnnotation(annotations.takeAt(QRandomGenerator::global()->bounded(annotationsSize)));
}
qDeleteAll(annotations);
......
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