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

Qt-interest Archive, December 2006
Sheet fails to open [SOLUTION]


Message 1 in thread

This took me a little while to figure out, so I thought I'd just post  
the question and answer to the list for future reference for others.

I was trying to open a QDialog on MacOS X as a sheet. This was  
failing and I was seeing the following message being printed to the  
debugger: "Qt: QWidget: Unable to show as sheet [-50]". Previously  
this had been working.

The Macintosh error code -50 is paramErr. Qt is making a call to  
WindowSheet() which is returning this error. It was not immediately  
clear to me what was causing this error.

It turns out that the when you make the call setWindowTitle() on the  
QDialog, this will cause it not to open correctly as a sheet. This is  
probably causing the QDialog to create the wrong attributes for the  
window to be a sheet which may be the cause for the paramErr.

Someone (like me) may add this call so that on platforms other than  
MacOS X (Windows, Linux), the dialog will be shown with a correct  
title. With sheets, obviously you don't need a windowTitle.

One solution for this is simply not to call setWindowTitle() on your  
QDialog on MacOS X. This can be accomplished by using #ifndef  
Q_WS_MAC around the call to setWindowTitle().

Brant Sears

--
 [ signature omitted ] 

Message 2 in thread

Hi,

Brant Sears wrote:
> It turns out that the when you make the call setWindowTitle() on the 
> QDialog, this will cause it not to open correctly as a sheet. This is 
> probably causing the QDialog to create the wrong attributes for the 
> window to be a sheet which may be the cause for the paramErr.
> 
> Someone (like me) may add this call so that on platforms other than 
> MacOS X (Windows, Linux), the dialog will be shown with a correct title. 
> With sheets, obviously you don't need a windowTitle.

Did you file this as a defect? Seems like one to me... (apologies if 
someone already suggested this)

Tim

--
 [ signature omitted ]