Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 7

Qt-interest Archive, April 2007
Drag resize problem when QMainWindow hosts a QAxWidget.


Message 1 in thread

I create a host window by subclassing QMainWindow, and create a 
QAxWidget object as a central widget.

    activeX = new QAxWidget(this);
    activeX->setControl( classID());
    this->setCentralWidget(activeX);

The QAxWidget is shown very well in the host window.
Problem is the host window, then, can only be dragged larger and larger, 
but cannot be dragged smaller.

Does anyone know why, and how to fix it?

BTW, the QAxWidget itself is never given any minimum size hint 
explicitly, and if itself shown in main() it is free to resize anyway.

Thanks,
Lingfa


--
 [ signature omitted ] 

Message 2 in thread

Hi,

Lingfa Yang wrote:

> I create a host window by subclassing QMainWindow, and create a
> QAxWidget object as a central widget.
> 
>     activeX = new QAxWidget(this);
>     activeX->setControl( classID());
>     this->setCentralWidget(activeX);
> 
> The QAxWidget is shown very well in the host window.
> Problem is the host window, then, can only be dragged larger and larger,
> but cannot be dragged smaller.
> 
> Does anyone know why, and how to fix it?
> 
> BTW, the QAxWidget itself is never given any minimum size hint
> explicitly, and if itself shown in main() it is free to resize anyway.

It sounds like one of two things is happening:
* The QAxWidget changes it's minimumSizeHint() to match it's size, or
* it changes it's sizeHint() and has a Fixed sized policy.

Could you check the results of these two functions after you resize the
QMainWindow?

Best regards,

Jacek

--
 [ signature omitted ] 

Message 3 in thread

Jacek Surazski wrote:

>Hi,
>
>Lingfa Yang wrote:
>
>  
>
>>I create a host window by subclassing QMainWindow, and create a
>>QAxWidget object as a central widget.
>>
>>    activeX = new QAxWidget(this);
>>    activeX->setControl( classID());
>>    this->setCentralWidget(activeX);
>>
>>The QAxWidget is shown very well in the host window.
>>Problem is the host window, then, can only be dragged larger and larger,
>>but cannot be dragged smaller.
>>
>>Does anyone know why, and how to fix it?
>>
>>BTW, the QAxWidget itself is never given any minimum size hint
>>explicitly, and if itself shown in main() it is free to resize anyway.
>>    
>>
>
>It sounds like one of two things is happening:
>* The QAxWidget changes it's minimumSizeHint() to match it's size, or
>* it changes it's sizeHint() and has a Fixed sized policy.
>
>Could you check the results of these two functions after you resize the
>QMainWindow?
>
>Best regards,
>
>Jacek
>
Jacek, you are right.
The minimumSizeHint keeps changing during resizing.
But it behaves different in horizontal and vertical resizing ---
In horizontal, drag-stretch, minimumSizeHint.width() increases, but NO 
drag-shrink;
while in vertical, both drag-stretch and -shrink work, which make 
minimumSizeHint.height() increases/decreases.

If I, explicitly, set a small minimum size, problem solved --- free to 
resize (increase/decrease) in both horizontal and vertical.
void HostWin::resizeEvent ( QResizeEvent * event )
{
    activeX->setMinimumSize(QSize(10,10));
}

Thanks,
Lingfa


--
 [ signature omitted ] 

Message 4 in thread

"Lingfa Yang" <lingfa@xxxxxxx> wrote in message 
news:463106C1.4090000@xxxxxxxxxx
>I create a host window by subclassing QMainWindow, and create a QAxWidget 
>object as a central widget.
>
>    activeX = new QAxWidget(this);
>    activeX->setControl( classID());
>    this->setCentralWidget(activeX);
>
> The QAxWidget is shown very well in the host window.
> Problem is the host window, then, can only be dragged larger and larger, 
> but cannot be dragged smaller.
>
> Does anyone know why, and how to fix it?
>
> BTW, the QAxWidget itself is never given any minimum size hint 
> explicitly, and if itself shown in main() it is free to resize anyway.
>
> Thanks,
> Lingfa

Hi Lingfa,

We have seen that when using a QAxServer based control in QAxWidget, which 
is a highly suboptimal setup anyway (why use ActiveX here?).

Can you confirm that this is the case for you as well? The respective 
issue should be solved in 4.3.


Volker


--
 [ signature omitted ] 

Message 5 in thread

Volker Hilsheimer wrote:

>"Lingfa Yang" <lingfa@xxxxxxx> wrote in message 
>news:463106C1.4090000@xxxxxxxxxx
>  
>
>>I create a host window by subclassing QMainWindow, and create a QAxWidget 
>>object as a central widget.
>>
>>   activeX = new QAxWidget(this);
>>   activeX->setControl( classID());
>>   this->setCentralWidget(activeX);
>>
>>The QAxWidget is shown very well in the host window.
>>Problem is the host window, then, can only be dragged larger and larger, 
>>but cannot be dragged smaller.
>>
>>Does anyone know why, and how to fix it?
>>
>>BTW, the QAxWidget itself is never given any minimum size hint 
>>explicitly, and if itself shown in main() it is free to resize anyway.
>>
>>Thanks,
>>Lingfa
>>    
>>
>
>Hi Lingfa,
>
>We have seen that when using a QAxServer based control in QAxWidget, which 
>is a highly suboptimal setup anyway (why use ActiveX here?).
>
>Can you confirm that this is the case for you as well? The respective 
>issue should be solved in 4.3.
>
>
>Volker
>
>  
>
Hi, Volker,

Thanks for your reply

First, your writing “using a QAxServer based control in QAxWidget” is 
not clear to me.
I am using a QAxServer based control, which is a QAxWidget, in QMainWindow.
(The resizeing problem has been solved with the help from Jacek Surazsk)

This is just a test case of the ActiveX control. The goal of developing 
ActiveX controls, in my practice at least, is for automating/programming 
MS Office, for examples, insert them into PowerPoint to enhance/extend 
features of presentations; create template PowerPoint.

The attached figure explains the work flows:
Path 1: QWidget to QApplication (normal cases: you develop ur widgets, 
and you use them in your application.)
Path 2: QWidget + QAxBindable => ActiveX, then, use ActiveX to build an 
application (test case of ActiveX, not target on any real application)
Path 3: QWidget + QAxBindable => ActiveX, use ActiveX in MS office 
(program Office, make interactive presentation, smart document, . . . by 
VBA, MFC, VSTO ... why not Qt? I welcome any progress in ActiveQt 
Framework along this direction.)

Thanks,
Lingfa

GIF image

GIF image