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

ChatLine: cell spacing

This commit is contained in:
krepa098 2015-01-03 20:37:40 +01:00
parent 99a230ccf5
commit d04a79a599

View File

@ -22,6 +22,8 @@
#include <QDebug> #include <QDebug>
#include <QGraphicsScene> #include <QGraphicsScene>
#define CELL_SPACING 15
ChatLine::ChatLine(QGraphicsScene* grScene) ChatLine::ChatLine(QGraphicsScene* grScene)
: scene(grScene) : scene(grScene)
{ {
@ -148,7 +150,7 @@ void ChatLine::layout(qreal w, QPointF scenePos)
width = w; width = w;
pos = scenePos; pos = scenePos;
qreal fixedWidth = 0.0; qreal fixedWidth = (content.size()-1) * CELL_SPACING;
qreal varWidth = 0.0; // used for normalisation qreal varWidth = 0.0; // used for normalisation
for(int i = 0; i < format.size(); ++i) for(int i = 0; i < format.size(); ++i)
@ -183,6 +185,7 @@ void ChatLine::layout(qreal w, QPointF scenePos)
// calculate horizontal alignment // calculate horizontal alignment
qreal xAlign = 0.0; qreal xAlign = 0.0;
switch(format[i].hAlign) switch(format[i].hAlign)
{ {
case ColumnFormat::Right: case ColumnFormat::Right:
@ -198,7 +201,7 @@ void ChatLine::layout(qreal w, QPointF scenePos)
// reposition // reposition
content[i]->setPos(pos.x() + xOffset + xAlign, pos.y()); content[i]->setPos(pos.x() + xOffset + xAlign, pos.y());
xOffset += width; xOffset += width + CELL_SPACING;
} }
for(int i = 0; i < content.size(); ++i) for(int i = 0; i < content.size(); ++i)