<span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.727272033691406px;background-color:rgb(255,255,255)">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Ā </span><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.727272033691406px;background-color:rgb(255,255,255)">

<br></div><div style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:12.727272033691406px;background-color:rgb(255,255,255)"><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">MainWindow</span>::on_actionAddTable_triggered()</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">{</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//add table</span></pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QTableWidget</span>*<span style="color:rgb(192,192,192)"> </span>newTable<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QTableWidget</span>(<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">3</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">3</span>);</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//newTable->setHorizontalHeaderLabels(QStringList()<<"1"<<"2"<<"3");</span></pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//newTable->setVerticalHeaderLabels(QStringList()<<"A"<<"B"<<"C");</span></pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//qDebug() <<" table labled";</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

<span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">// row mod(26) = letter;</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QWidget</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(192,192,192)"> </span>thisPage<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">pageStack</span>->currentWidget();</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QGraphicsView</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(192,192,192)"> </span>thePage<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">dynamic_cast</span><<span style="color:rgb(128,0,128)">QGraphicsView</span>*>(thisPage);</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QGraphicsScene</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(192,192,192)"> </span>thisScene<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>thePage->scene();</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>qDebug()<span style="color:rgb(192,192,192)"> </span><<<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"scene aquired "</span>;</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>thisScene->addWidget(newTable);</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

<span style="color:rgb(192,192,192)">    </span>qDebug()<span style="color:rgb(192,192,192)"> </span><<<span style="color:rgb(0,128,0)">"table added"</span>;</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

<span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QFocusFrame</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(192,192,192)"> </span>tableProxy<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QFocusFrame</span>();</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>qDebug()<span style="color:rgb(192,192,192)"> </span><<<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"new frame"</span>;</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>tableProxy->setWidget(newTable);</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

<span style="color:rgb(192,192,192)">    </span>qDebug()<<<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"set widgit"</span>;</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

<span style="color:rgb(192,192,192)">    </span>tableProxy-><span style="font-style:italic">setVisible</span>(<span style="color:rgb(128,128,0)">true</span>);</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

<span style="color:rgb(192,192,192)">    </span>qDebug()<<<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"set widgit"</span>;</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

}</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">and it crashes after qDebug outputs set widgit, mean time so does thisĀ </pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">void</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">MainWindow</span>::on_actionAddTable_triggered()</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">{</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//add table</span></pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QTableWidget</span>*<span style="color:rgb(192,192,192)"> </span>newTable<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QTableWidget</span>(<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">3</span>,<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">3</span>);</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//newTable->setHorizontalHeaderLabels(QStringList()<<"1"<<"2"<<"3");</span></pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//newTable->setVerticalHeaderLabels(QStringList()<<"A"<<"B"<<"C");</span></pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//qDebug() <<" table labled";</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

<span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">// row mod(26) = letter;</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QWidget</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(192,192,192)"> </span>thisPage<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,0)">pageStack</span>->currentWidget();</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QGraphicsView</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(192,192,192)"> </span>thePage<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">dynamic_cast</span><<span style="color:rgb(128,0,128)">QGraphicsView</span>*>(thisPage);</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QGraphicsScene</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(192,192,192)"> </span>thisScene<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span>thePage->scene();</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>qDebug()<span style="color:rgb(192,192,192)"> </span><<<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"scene aquired "</span>;</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">QFocusFrame</span><span style="color:rgb(192,192,192)"> </span>*<span style="color:rgb(192,192,192)"> </span>tableProxy<span style="color:rgb(192,192,192)"> </span>=<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">new</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">QFocusFrame</span>(newTable);</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>thisScene->addWidget(newTable);</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

<span style="color:rgb(192,192,192)">    </span>qDebug()<span style="color:rgb(192,192,192)"> </span><<<span style="color:rgb(0,128,0)">"table added"</span>;</pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

<span style="color:rgb(192,192,192)">    </span>qDebug()<span style="color:rgb(192,192,192)"> </span><<<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"new frame"</span>;</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//tableProxy->setWidget(newTable);</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px">

<span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,128,0)">//qDebug()<< "set widgit";</span></pre><pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>tableProxy-><span style="font-style:italic">setVisible</span>(<span style="color:rgb(128,128,0)">true</span>);</pre>

<pre style="white-space:pre-wrap;margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span>qDebug()<<<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"set visible"</span>; </pre>

</div>