Faced a problem in QGraphicsView, when placing a QGraphicsProxyWidget QGraphicsProxyWidget widget proxy on QGraphicsScene, the mouse cursor does not always correctly resize columns or rows. Here is a small test case.

#include "MainWindow.h" #include "ui_MainWindow.h" #include <QGraphicsScene> #include <QGraphicsProxyWidget> #include <QGraphicsView> #include <QTableWidget> MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent ), ui( new Ui::MainWindow ) { ui->setupUi( this ); QGraphicsView *view = new QGraphicsView ; QGraphicsScene *scene = new QGraphicsScene ; scene->setSceneRect( 0, 0, 1000, 1000 ); QGraphicsProxyWidget *item = new QGraphicsProxyWidget ; QTableWidget *table = new QTableWidget ; table->setRowCount( 10 ); table->setColumnCount( 5 ); table->setHorizontalHeaderLabels( QStringList() << "1" << "2" << "3" << "4" << "5" ); table->setGeometry( 0, 0, 640, 480 ); item->setWidget( table ); scene->addItem( item ); scene->setFocusItem( item ); view->setScene( scene ); setCentralWidget( view ); } MainWindow::~MainWindow() { delete ui; } #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H 

I suspect that it is a matter of mouse pointing events, maybe someone solved a similar problem?

enter image description here

  • Can you throw a screenshot for an example? don't quite understand what is happening - goldstar_labs
  • Added a screenshot. If you hover the mouse between columns or lines, the cursor should change, but this happens every other time, but you can still do resizing columns or lines - Dunkan

0