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

30 lines
680 B
C++
Raw Normal View History

2014-11-12 21:11:25 +08:00
#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));
}