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

Qt-interest Archive, June 2007
QWorkspace to QMdiArea


Message 1 in thread

I switch from 4.2.3 to 4.3 for several improvements, One of the main ones is
the QMdiArea to replace QWorkspace (which is being deprecated).

I was hoping, perhaps foolishly, that there would be a transition document
of the differences between the two and how to change over. I have gotten the
initial code done, but QMdiArea behaves differently in many important
places.

In particular, QMdiSubWindows leave a margin under my scroll bar at the
bottom of the window, and make the QSizeGrip disappear or appear in the
wrong corner (bottom left instead of right). The same forms lay out fine
with QWorkspace. I tried reconstructing a simple window from scratch in
Designer, but the problem remains.

I create a simple widget with a QToolBar at the top (hidden because no
buttons yet) and a QTextEdit. Upon creation a QSizeGrip is added as the
QTextEdit's cornerWidget:

Here is the Designer view:


Here is the Widget in a QWorkspace (Qt 4.2.3/4.3). This is how it is
supposed to look.



Here it is in a QMdiSubWindow:


Notice, the window icon is missing, the QSizeGrip is in the wrong corner,
and there is a big space at the bottom of the window. (At least the maximize
button is finally back.)

The only lines of code that changed for this window are this in the
constructor:

> DpScriptWindow::DpScriptWindow()
>     : DpBaseWindow()
>     , m_pSizeGrip(NULL)
> {
>     m_Ui.setupUi(this);
>     m_pSizeGrip = new QSizeGrip(NULL);
>     m_Ui.textEdit->setCornerWidget(m_pSizeGrip);
>     setFocusProxy(m_Ui.textEdit);
> #ifdef QT_VERSION_43
>     DpMainWindow::getWorkspace()->addSubWindow(this, scriptFlags);
> #else
>     DpMainWindow::getWorkspace()->addWindow(this);
> #endif
> }

DpMainWindow::getWorkspace() returns the central widget of a QMainWindow, a
QMdiArea in Qt 4.3, and a QWorkspace in earlier versions. The scriptFlags
were ignored in earlier versions, so we removed them. DpBaseWindow is
derived from a QWidget for an interface layer.

Can anyone see anything I am doing wrong here, or are there major bugs in
QMdiArea? I could not find any related bugs in Task Tracker.

Keith
**Please do not reply to me, reply to the list.**

JPEG image

JPEG image

JPEG image

JPEG image


Message 2 in thread

Hi Keith,

> Can anyone see anything I am doing wrong here, or are there major bugs 
> in QMdiArea? I could not find any related bugs in Task Tracker.

You're probably doing the right thing. The reason it doesn't work is 
that we had to do some magic with QSizeGrip because it didn't handle 
sub-windows properly. But now as QSizeGrip is fixed, there's no need for 
this magic (which in your case will mess things up) anymore.

This is now fixed for 4.3.1 and will show up in the next snapshot.


Thanks for the report.

-- 
 [ signature omitted ] 

Message 3 in thread

Thanks for the info on QSizeGrip. This still doesn't explain the big gap at
the bottom of the window that I can't get rid of.

Keith
**Please do not reply to me, reply to the list.**


On 06-29-2007 6:21 AM, "Bjoern Erik Nilsen" wrote:

> Hi Keith,
> 
>> Can anyone see anything I am doing wrong here, or are there major bugs
>> in QMdiArea? I could not find any related bugs in Task Tracker.
> 
> You're probably doing the right thing. The reason it doesn't work is
> that we had to do some magic with QSizeGrip because it didn't handle
> sub-windows properly. But now as QSizeGrip is fixed, there's no need for
> this magic (which in your case will mess things up) anymore.
> 
> This is now fixed for 4.3.1 and will show up in the next snapshot.
> 
> 
> Thanks for the report.


--
 [ signature omitted ] 

Message 4 in thread


It turns out the QSizeGrip was causing the unexplained space. I removed the
QSizeGrip from each of my layouts, and the gap disappeared.

Now the only problems are the overlapping of scroll bars and tools bars onto
the window frame, and that the window icons are the Qt default instead of
the ones in my form.

Keith
**Please do not reply to me, reply to the list.**

On 06-29-2007 12:16 PM, "Keith Esau" wrote:

> Thanks for the info on QSizeGrip. This still doesn't explain the big gap at
> the bottom of the window that I can't get rid of.
> 
> Keith
> **Please do not reply to me, reply to the list.**
> 
> 
> On 06-29-2007 6:21 AM, "Bjoern Erik Nilsen" wrote:
> 
>> Hi Keith,
>> 
>>> Can anyone see anything I am doing wrong here, or are there major bugs
>>> in QMdiArea? I could not find any related bugs in Task Tracker.
>> 
>> You're probably doing the right thing. The reason it doesn't work is
>> that we had to do some magic with QSizeGrip because it didn't handle
>> sub-windows properly. But now as QSizeGrip is fixed, there's no need for
>> this magic (which in your case will mess things up) anymore.
>> 
>> This is now fixed for 4.3.1 and will show up in the next snapshot.
>> 
>> 
>> Thanks for the report.


--
 [ signature omitted ]