[Qt-interest] Why does QWinWidget has a minimum size?

cheng long kevinclcn at gmail.com
Tue May 25 11:07:33 CEST 2010


Hi guys, I found the reason:
I've added the QGraphicsView into a QHBoxLayout, which has a size
constraint. After I set it to no constraint by
hbox->setSizeConstraint(QLayout::SetNoConstraint), the issue is resolved.

Cheers!

On Tue, May 25, 2010 at 4:57 PM, cheng long <kevinclcn at gmail.com> wrote:

> After debugging, I found that QWinWidget can't be smaller than 69 * 69, is
> it a bug? Or can we change it by setting some option? Thanks!
>
>
> On Tue, May 25, 2010 at 4:03 PM, cheng long <kevinclcn at gmail.com> wrote:
>
>> I hosted a QGraphicsView with QWinWidget in a MFC CView and want to resize
>> the QWinWidget and QGraphicsView along with zooming. The issue is when width
>> < 26 and height < 8, QWinWidget::resize() fails to work. The QWinWidget
>> becomes a large square, while the QGraphicsView is still a smaller
>> rectangle. The area not occupied by QGraphicsView is gray, i.e. the
>> QWinWidget's background color. Any one experiences that? What's the problem?
>> Thanks!
>>
>> Qt 4.5.2, Win7
>> Codes:
>>          QRectF sceneRect = view->scene()->itemsBoundingRect();
>>          QRect rect = view->mapFromScene(sceneRect).boundingRect();
>>          view->resize(rect.size()); // resize view
>>          CChildView::m_pWinWidget->resize(rect.size()); // resize
>> QWinWidget
>>          view->scene()->items()[0]->setPos(view->mapToScene(0, 0)); //
>> center the QGraphicsItem
>>
>> Thanks,
>> Kevin
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100525/da1accf4/attachment.html 


More information about the Qt-interest-old mailing list