<span style="font-size:24px;">下邊這個博客講的很細</span>
<span style="font-size:24px;">http://blog.163.com/chen_lovtime/blog/static/10009874920107258514135/</span>
<span style="font-size:24px;">http://yleesun.blog.163.com/blog/static/2941340220096110165817/
</span>
<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);"><span style="font-size:24px;">QGraphicsView ------>QGraphicsScene------>QGraphicsItem</span></span>
我們將三個依次 命名如下:
視圖------>場景-------->項
</pre><p></p><p><span style="font-size:32px;">場景是一個容器,用來管理項。視圖是用來顯示場景</span></p><pre name="code" class="cpp"><span style="font-size:24px;">QGraphicsScene scene;
QGraphicsRectItem *rect = scene.addRect(QRectF(0, 0, 100, 100));</span>
<pre name="code" class="cpp"><span style="font-size:24px;">QGraphicsView view(&scene);</span>
<pre name="code" class="cpp"><span style="font-size:24px;">view.show();</span>
</pre><p><span style="font-size:24px;">定義一個場景,</span><pre name="code" class="cpp"><span style="font-size:24px;">在定義 RectItem,加入場景這個容器,將場景放入視圖。視圖管理顯示</span>
<span style="font-size:24px;">
</span>