mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
renamed firstLineVOffset to getAscent
This commit is contained in:
parent
0692c484f0
commit
fd7fe15e31
|
@ -160,7 +160,7 @@ void ChatLine::layout(qreal w, QPointF scenePos)
|
||||||
|
|
||||||
for(int i = 0; i < content.size(); ++i)
|
for(int i = 0; i < content.size(); ++i)
|
||||||
{
|
{
|
||||||
maxVOffset = qMax(maxVOffset, content[i]->firstLineVOffset());
|
maxVOffset = qMax(maxVOffset, content[i]->getAscent());
|
||||||
|
|
||||||
// calculate the effective width of the current column
|
// calculate the effective width of the current column
|
||||||
qreal width;
|
qreal width;
|
||||||
|
@ -198,7 +198,7 @@ void ChatLine::layout(qreal w, QPointF scenePos)
|
||||||
// vertical alignment may depend on width, so we do it in a second pass
|
// vertical alignment may depend on width, so we do it in a second pass
|
||||||
qreal yOffset = 0.0;
|
qreal yOffset = 0.0;
|
||||||
|
|
||||||
yOffset = maxVOffset - content[i]->firstLineVOffset();
|
yOffset = maxVOffset - content[i]->getAscent();
|
||||||
|
|
||||||
// reposition
|
// reposition
|
||||||
content[i]->setPos(content[i]->pos().x(), content[i]->pos().y() + yOffset);
|
content[i]->setPos(content[i]->pos().x(), content[i]->pos().y() + yOffset);
|
||||||
|
|
|
@ -75,7 +75,7 @@ QString ChatLineContent::getSelectedText() const
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal ChatLineContent::firstLineVOffset() const
|
qreal ChatLineContent::getAscent() const
|
||||||
{
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
|
|
||||||
virtual QString getText() const;
|
virtual QString getText() const;
|
||||||
|
|
||||||
virtual qreal firstLineVOffset() const;
|
virtual qreal getAscent() const;
|
||||||
|
|
||||||
virtual QRectF boundingSceneRect() const = 0;
|
virtual QRectF boundingSceneRect() const = 0;
|
||||||
virtual QRectF boundingRect() const = 0;
|
virtual QRectF boundingRect() const = 0;
|
||||||
|
|
|
@ -40,7 +40,7 @@ void ChatLineContentProxy::paint(QPainter *painter, const QStyleOptionGraphicsIt
|
||||||
proxy->paint(painter, option, widget);
|
proxy->paint(painter, option, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal ChatLineContentProxy::firstLineVOffset() const
|
qreal ChatLineContentProxy::getAscent() const
|
||||||
{
|
{
|
||||||
return proxy->widget()->layout()->contentsMargins().top();
|
return proxy->widget()->layout()->contentsMargins().top();
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@ public:
|
||||||
virtual QRectF boundingSceneRect() const;
|
virtual QRectF boundingSceneRect() const;
|
||||||
virtual void setWidth(qreal width);
|
virtual void setWidth(qreal width);
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
virtual qreal firstLineVOffset() const;
|
virtual qreal getAscent() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGraphicsProxyWidget* proxy;
|
QGraphicsProxyWidget* proxy;
|
||||||
|
|
|
@ -34,7 +34,7 @@ QRectF Image::boundingSceneRect() const
|
||||||
return QRectF(scenePos(), size);
|
return QRectF(scenePos(), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal Image::firstLineVOffset() const
|
qreal Image::getAscent() const
|
||||||
{
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,7 @@ public:
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
virtual void setWidth(qreal width);
|
virtual void setWidth(qreal width);
|
||||||
virtual QRectF boundingSceneRect() const;
|
virtual QRectF boundingSceneRect() const;
|
||||||
virtual qreal firstLineVOffset() const;
|
virtual qreal getAscent() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QSizeF size;
|
QSizeF size;
|
||||||
|
|
|
@ -70,7 +70,7 @@ void Spinner::visibilityChanged(bool visible)
|
||||||
timer.stop();
|
timer.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal Spinner::firstLineVOffset() const
|
qreal Spinner::getAscent() const
|
||||||
{
|
{
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ public:
|
||||||
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||||
virtual void setWidth(qreal width);
|
virtual void setWidth(qreal width);
|
||||||
virtual void visibilityChanged(bool visible);
|
virtual void visibilityChanged(bool visible);
|
||||||
virtual qreal firstLineVOffset() const;
|
virtual qreal getAscent() const;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void timeout();
|
void timeout();
|
||||||
|
|
|
@ -170,7 +170,7 @@ void Text::visibilityChanged(bool visible)
|
||||||
freeResources();
|
freeResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal Text::firstLineVOffset() const
|
qreal Text::getAscent() const
|
||||||
{
|
{
|
||||||
return vOffset;
|
return vOffset;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public:
|
||||||
|
|
||||||
virtual void visibilityChanged(bool isVisible) override;
|
virtual void visibilityChanged(bool isVisible) override;
|
||||||
|
|
||||||
virtual qreal firstLineVOffset() const override;
|
virtual qreal getAscent() const override;
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user