diff --git a/src/chatlog/chatline.cpp b/src/chatlog/chatline.cpp index 27653ae97..4e27be0eb 100644 --- a/src/chatlog/chatline.cpp +++ b/src/chatlog/chatline.cpp @@ -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 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::Right: - xAlign = width - content[i]->boundingRect().width(); - break; - case ColumnFormat::Center: - xAlign = (width - content[i]->boundingRect().width()) / 2.0; - break; - default: - break; + 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; } // 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 diff --git a/src/chatlog/chatline.h b/src/chatlog/chatline.h index e2e46cef8..e4d0a308f 100644 --- a/src/chatlog/chatline.h +++ b/src/chatlog/chatline.h @@ -21,9 +21,9 @@ #define CHATLINE_H #include -#include #include #include +#include class ChatLog; class ChatLineContent; @@ -101,8 +101,8 @@ protected: private: int row = -1; - std::vector content; - std::vector format; + QVector content; + QVector format; qreal width = 100.0; qreal columnSpacing = 15.0; QRectF bbox;