mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
30 lines
680 B
C++
30 lines
680 B
C++
|
#include "chatlinecontentproxy.h"
|
||
|
#include <QWidget>
|
||
|
#include <QDebug>
|
||
|
|
||
|
ChatLineContentProxy::ChatLineContentProxy(QWidget* widget)
|
||
|
{
|
||
|
proxy = new QGraphicsProxyWidget(this);
|
||
|
proxy->setWidget(widget);
|
||
|
}
|
||
|
|
||
|
QRectF ChatLineContentProxy::boundingRect() const
|
||
|
{
|
||
|
return proxy->boundingRect();
|
||
|
}
|
||
|
|
||
|
QRectF ChatLineContentProxy::boundingSceneRect() const
|
||
|
{
|
||
|
return proxy->boundingRect().translated(scenePos());
|
||
|
}
|
||
|
|
||
|
void ChatLineContentProxy::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||
|
{
|
||
|
proxy->paint(painter, option, widget);
|
||
|
}
|
||
|
|
||
|
void ChatLineContentProxy::setWidth(qreal width)
|
||
|
{
|
||
|
proxy->widget()->setFixedWidth(qMax(width,0.0));
|
||
|
}
|