I am trying to use inputs like QLineEdit and QSlider inside a QGraphicsItemGroup.
I am able to show them, and drag the group around, but unable to interact with them. It is clearly a problem with focus and events.
How do I use the group so that all objects move together, but switch focus on them when clicking specific items?
Minimal code example:
QSlider* slider_ = new QSlider(Qt::Horizontal);
QGraphicsProxyWidget* slider_item_ = new QGraphicsProxyWidget();
slider_item_->setWidget(slider_);
qreal sliderX = 0;
qreal sliderY = 0;
slider_item_->setPos(sliderX, sliderY);
QGraphicsItemGroup* tile_group_ = new QGraphicsItemGroup();
tile_group_->setFlags(QGraphicsItemGroup::ItemIsMovable | QGraphicsItemGroup::ItemIsFocusable | QGraphicsItemGroup::ItemIsSelectable);
tile_group_->addToGroup(slider_item_);
scene = new QGraphicsScene(this);
scene->addItem(tile_group_);
I tried to pinpoint the issue. It only happens when the items are defined inside the group, so I need to handle the events manually somehow. I am on Ubuntu 22.04.