Fix compilation of examples with QStringBuilder
In sub-attack an interview, one can't make two implicit conversions at
once, so explicitly convert to the right type.
The change in the torrent example is required because of
https://codereview.qt-project.org/16168 (commit 9491272
)
But in that case, using a QByteArray is better anyway.
Change-Id: Ieed22ac7f0d700d5ba5d1e70af3db4dd6c139c8f
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
d91add71e7
commit
ffa072655d
@ -48,9 +48,9 @@
|
||||
PixmapItem::PixmapItem(const QString &fileName,GraphicsScene::Mode mode, QGraphicsItem * parent) : QGraphicsObject(parent)
|
||||
{
|
||||
if (mode == GraphicsScene::Big)
|
||||
pix = ":/big/" + fileName;
|
||||
pix = QPixmap(QStringLiteral(":/big/") + fileName);
|
||||
else
|
||||
pix = ":/small/" + fileName;
|
||||
pix = QPixmap(QStringLiteral(":/small/") + fileName);
|
||||
}
|
||||
|
||||
PixmapItem::PixmapItem(const QString &fileName, QGraphicsScene *scene) : QGraphicsObject(), pix(fileName)
|
||||
|
@ -95,7 +95,7 @@ QVariant Model::data(const QModelIndex &index, int role) const
|
||||
if (!index.isValid())
|
||||
return QVariant();
|
||||
if (role == Qt::DisplayRole)
|
||||
return "Item " + QString::number(index.row()) + ":" + QString::number(index.column());
|
||||
return QVariant("Item " + QString::number(index.row()) + ":" + QString::number(index.column()));
|
||||
if (role == Qt::DecorationRole) {
|
||||
if (index.column() == 0)
|
||||
return iconProvider.icon(QFileIconProvider::Folder);
|
||||
|
@ -108,10 +108,10 @@ void TrackerClient::fetchPeerList()
|
||||
|
||||
// Percent encode the hash
|
||||
QByteArray infoHash = torrentDownloader->infoHash();
|
||||
QString encodedSum;
|
||||
QByteArray encodedSum;
|
||||
for (int i = 0; i < infoHash.size(); ++i) {
|
||||
encodedSum += '%';
|
||||
encodedSum += QString::number(infoHash[i], 16).right(2).rightJustified(2, '0');
|
||||
encodedSum += QByteArray::number(infoHash[i], 16).right(2).rightJustified(2, '0');
|
||||
}
|
||||
|
||||
bool seeding = (torrentDownloader->state() == TorrentClient::Seeding);
|
||||
|
Loading…
Reference in New Issue
Block a user