PDA

View Full Version : Vertical scrolling with the mouse wheel in QGraphicsView in versions 5.15.1 and 6.6.1



VVS
26th January 2024, 10:25
In version 5.15.1, if the mouse cursor is over a widget (as in the example below - QTextEdit), there is scrolling for the entire QGraphicsView. In version 6.6.1, scrolling only occurs when the mouse cursor is not over QTextEdit. Is it possible to achieve the behavior that was present in version 5.15.1 ?


#include <QGraphicsScene>
#include <QGraphicsView>
#include <QVBoxLayout>
#include <QTextEdit>
#include <QWidget>
#include <QGraphicsProxyWidget>

MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);

QGraphicsScene*scene=new QGraphicsScene(1,1,109,1199);

QGraphicsView* graphicsView = new QGraphicsView(scene);

setCentralWidget(graphicsView);

graphicsView->setFrameShape(QFrame::NoFrame);

QTextEdit* textEdit = new QTextEdit();

QGraphicsProxyWidget* proxyWidget = new QGraphicsProxyWidget();
proxyWidget->setWidget(textEdit);

scene->addItem(proxyWidget);

textEdit->move(-100,500);
}