Hey there,
I have a QGraphicsView which contains another QGraphicsView embeded in a QGraphicsProxyWidget.
Here is my insertWidget function :
/* virtual */ void qkListBase::insertWidget(int index,
int stretch,
Qt::Alignment alignment)
{
if (contains(widget)) return;
Q_D(qkListBase);
QGraphicsProxyWidget * proxyWidget = scene()->addWidget(widget);
p.
setColor(QPalette::Window, Qt
::transparent);
widget->setPalette(p);
qkListBasePrivate::item * Item = new qkListBasePrivate::item(proxyWidget);
Item->proxyWidget = proxyWidget;
Item->stretch = stretch;
Item->alignment = alignment;
d->items.push_back(Item);
d->resetGeometry();
}
/* virtual */ void qkListBase::insertWidget(int index,
QWidget * widget,
int stretch,
Qt::Alignment alignment)
{
if (contains(widget)) return;
Q_D(qkListBase);
QGraphicsProxyWidget * proxyWidget = scene()->addWidget(widget);
QPalette p(widget->palette());
p.setColor(QPalette::Window, Qt::transparent);
widget->setPalette(p);
qkListBasePrivate::item * Item = new qkListBasePrivate::item(proxyWidget);
Item->proxyWidget = proxyWidget;
Item->stretch = stretch;
Item->alignment = alignment;
d->items.push_back(Item);
d->resetGeometry();
}
To copy to clipboard, switch view to plain text mode
- When I add a widget into my main QGraphicsView / scene : it works fine.
- When I add a widget into a QGraphicsView inside my main QGraphicsView I get the following :
warning
: QPainter::begin: A paint device can only be painted by one painter at a
time.
warning: QPainter::begin: A paint device can only be painted by one painter at a
time.
warning: ASSERT: "state" in file kernel\qwidget.cpp, line 4470
warning: Invalid parameter passed to C runtime function.
warning: Invalid parameter passed to C runtime function.
warning: QPainter::begin: A paint device can only be painted by one painter at a
time.
warning: QPainter::begin: A paint device can only be painted by one painter at a time.
warning: QPainter::begin: A paint device can only be painted by one painter at a time.
warning: ASSERT: "state" in file kernel\qwidget.cpp, line 4470
warning: Invalid parameter passed to C runtime function.
warning: Invalid parameter passed to C runtime function.
warning: QPainter::begin: A paint device can only be painted by one painter at a time.
To copy to clipboard, switch view to plain text mode
Anyone knows why ?
Bookmarks