1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

refactor(chat): fix type conversion warnings

This commit is contained in:
Nils Fenner 2016-07-11 11:36:08 +02:00
parent b204d0abad
commit b7f65ffe28
No known key found for this signature in database
GPG Key ID: 9591A163FF9BE04C
2 changed files with 15 additions and 15 deletions

View File

@ -176,7 +176,7 @@ void ChatLine::layout(qreal w, QPointF scenePos)
qreal fixedWidth = (content.size()-1) * columnSpacing;
qreal varWidth = 0.0; // used for normalisation
for (size_t i = 0; i < format.size(); ++i)
for (int i = 0; i < format.size(); ++i)
{
if (format[i].policy == ColumnFormat::FixedSize)
fixedWidth += format[i].size;
@ -191,9 +191,9 @@ void ChatLine::layout(qreal w, QPointF scenePos)
qreal maxVOffset = 0.0;
qreal xOffset = 0.0;
qreal xPos[content.size()];
QVector<qreal> xPos(content.size());
for (size_t i = 0; i < content.size(); ++i)
for (int i = 0; i < content.size(); ++i)
{
// calculate the effective width of the current column
qreal width;
@ -210,14 +210,14 @@ void ChatLine::layout(qreal w, QPointF scenePos)
switch(format[i].hAlign)
{
case ColumnFormat::Left:
break;
case ColumnFormat::Right:
xAlign = width - content[i]->boundingRect().width();
break;
case ColumnFormat::Center:
xAlign = (width - content[i]->boundingRect().width()) / 2.0;
break;
default:
break;
}
// reposition
@ -227,7 +227,7 @@ void ChatLine::layout(qreal w, QPointF scenePos)
maxVOffset = qMax(maxVOffset, content[i]->getAscent());
}
for (size_t i = 0; i < content.size(); ++i)
for (int i = 0; i < content.size(); ++i)
{
// calculate vertical alignment
// vertical alignment may depend on width, so we do it in a second pass

View File

@ -21,9 +21,9 @@
#define CHATLINE_H
#include <memory>
#include <vector>
#include <QPointF>
#include <QRectF>
#include <QVector>
class ChatLog;
class ChatLineContent;
@ -101,8 +101,8 @@ protected:
private:
int row = -1;
std::vector<ChatLineContent*> content;
std::vector<ColumnFormat> format;
QVector<ChatLineContent*> content;
QVector<ColumnFormat> format;
qreal width = 100.0;
qreal columnSpacing = 15.0;
QRectF bbox;