is there a way to create a floating table widget that you can move around on a QGrahicsView. Just using addWidget gets you an immobile table in the view. I tried embedding it in a QFocusFrame but when i add it, I dont' know how to make it render. Here's the code
void MainWindow::on_actionAddTable_triggered() { //add table QTableWidget* newTable = new QTableWidget( 3, 3); //newTable->setHorizontalHeaderLabels(QStringList()<<"1"<<"2"<<"3"); //newTable->setVerticalHeaderLabels(QStringList()<<"A"<<"B"<<"C"); //qDebug() <<" table labled"; // row mod(26) = letter; QWidget * thisPage = pageStack->currentWidget(); QGraphicsView * thePage = dynamic_cast<QGraphicsView*>(thisPage); QGraphicsScene * thisScene = thePage->scene(); qDebug() << "scene aquired "; thisScene->addWidget(newTable); qDebug() <<"table added"; QFocusFrame * tableProxy = new QFocusFrame(); qDebug() << "new frame"; tableProxy->setWidget(newTable); qDebug()<< "set widgit"; tableProxy->setVisible(true); qDebug()<< "set widgit"; } and it crashes after qDebug outputs set widgit, mean time so does this void MainWindow::on_actionAddTable_triggered() { //add table QTableWidget* newTable = new QTableWidget( 3, 3); //newTable->setHorizontalHeaderLabels(QStringList()<<"1"<<"2"<<"3"); //newTable->setVerticalHeaderLabels(QStringList()<<"A"<<"B"<<"C"); //qDebug() <<" table labled"; // row mod(26) = letter; QWidget * thisPage = pageStack->currentWidget(); QGraphicsView * thePage = dynamic_cast<QGraphicsView*>(thisPage); QGraphicsScene * thisScene = thePage->scene(); qDebug() << "scene aquired "; QFocusFrame * tableProxy = new QFocusFrame(newTable); thisScene->addWidget(newTable); qDebug() <<"table added"; qDebug() << "new frame"; //tableProxy->setWidget(newTable); //qDebug()<< "set widgit"; tableProxy->setVisible(true); qDebug()<< "set visible";
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest