da das ganze dazu dienen soll, tasks anzuzeigen welche ein kontextmenu besitzen, habe ich gehofft, dass ich irgendwie die mouse-events an das container-objekt weiterleiten kann.
das habe ich schonmal probiert (sieht man in der protectet function), allerdings klappt es natürlich nicht. weis irgendwer wie ich über so einen weg die mouse-events an das x11embedcontainerwidget kriege?
Code: Alles auswählen
class EmbedContainer : public QGraphicsItem
{
friend class QX11EmbedContainer;
private:
QX11EmbedContainer *m_embedCont;
QIcon *m_embdedIcon;
public:
EmbedContainer ( QWidget * parent = 0 ) {
m_embedCont = new QX11EmbedContainer(parent);
}
~EmbedContainer () {
delete m_embedCont;
}
WId clientWinId () const {
m_embedCont->clientWinId();
}
void discardClient () {
m_embedCont->discardClient();
}
void embedClient ( WId id ) {
m_embedCont->embedClient(id);
m_embdedIcon = new QIcon;
*m_embdedIcon = m_embedCont->windowIcon();
}
QRectF boundingRect() const
{
// qreal penWidth = 1;
return QRectF(0, 0, 32, 32 );
}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
// painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);
painter->drawPixmap(0, 0, 32, 32, m_embdedIcon->pixmap(32, 32) );
}
protected:
virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ) {
// wraps the mouse-event
QMouseEvent *mEvent = new QMouseEvent( QEvent::MouseButtonPress,
event->lastScreenPos(),
event->screenPos(),
event->button(),
event->buttons(),
event->modifiers() );
m_embedCont->mousePressEvent(mEvent);
QGraphicsItem::mousePressEvent(event);
}
};