[Qt-interest] Critical bug: QWidgets with size > 16383 break on OS X
Constantin Makshin
cmakshin at gmail.com
Thu Jun 24 15:20:10 CEST 2010
On Thursday 24 June 2010 14:43:45 Nikos Chantziaras wrote:
> On 06/24/2010 01:26 PM, Constantin Makshin wrote:
> > To be honest, I'm not sure this bug is *that* serious. Screens are
> > still much smaller than 8191 pixels in any dimension, even in
> > multi-screen configurations AFAIK.
>
> You don't understand. A widget that is big has scrollbars. If you
> visit a web page, the rendered document is much bigger than your screen.
> It's like saying that web pages should never be bigger than your
> screen and to never use scroll bars.
>
> As you can guess, a web page or any other document should be able to be
> higher than 16 thousand pixels. It's a serious limitation otherwise,
> and hence why I consider this bug serious.
Bad example. At least in Qt text editing/viewing widgets (except labels, buttons and other widgets that don't support scroll bars by design) and widgets that render web pages are smart enough to keep their size independent of web page contents. They either render the whole page into some off-screen buffer and display only visible part of it or simply don't render invisible parts of the page at all.
As an example, you may:
1) download Arora (http://code.google.com/p/arora) or other pure Qt web browser, compile/install and run it;
2) open Google, then in "Advanced Search" search for, say, "mac os x" with 100 results per page (http://www.google.com/search?hl=en&as_q=mac+os+x&num=100);
3) enable page previews using the left panel.
Obviously, web page becomes much larger than 8 thousand pixels, but the browser shows it correctly.
> > Also this seems to be a platform
> > limitation, not a Qt's one (else what's the reason to set
> > QWIDGETSIZE_MAX value to something that's not supported?).
>
> No, Qt's widgets are not platform widgets. That was only with Qt3. Qt4
> has internal widgets that are independent of platform widgets.
>
> Qt4 promises to allow widgets of arbitrary sizes without any overhead.
> It was one of the advertised features when Qt4 came to replace Qt3. And
> it doesn't work on OS X :-/
I know that (at least 4.x branch) uses its own methods to handle widgets.
But look at "src/gui/kernel/qwidget_*" files in Qt source package or at http://qt.gitorious.org/qt/qt/blobs/4.7/src/gui/kernel/ . Most of them have either macro or constant named "WRECT_MAX" equal to 8191 for Mac OS and X11 and 16383 for other platforms.
And if you read the description for void QWidgetPrivate::setWSGeometry() function in "qwidget_mac.mm" file, you'll find this:
"Helper function for non-toplevel widgets. Helps to map Qt's 32bit coordinate system to OS X's 16bit coordinate system. Sets the geometry of the widget to data.crect, but *clipped to sizes that OS X can handle*."
(this function in "qwidget_x11.cpp" has similar description)
All this really makes me think it's some sort of platform limitation. Of course, it'd be very nice (and much more useful than these assumptions) to get more or less detailed explanation from Qt developers.
> > As for your problem, the idea to put a "text display widget" into a
> > QScrollView looks a bit strange. Why not use a read-only QTextEdit or
> > QTextBrowser for that purpose?
>
> Because those are not suitable for my application which needs
> pixel-exact positioning of text and images and also CLI-like prompt
> command line input at the bottom of the widget.
Have you tried to ask your question on Qt IRC channel? I guess sometimes it's easier to get an answer there than on this mailing list, at least when the question is related to Qt's internal behavior.
> > On Thursday 24 June 2010 12:26:58 Nikos Chantziaras wrote:
> >> On 06/13/2010 12:47 AM, Nikos Chantziaras wrote:
> >>> I thought the maximum size of a QWidget in Qt4 was something like
> >>> 2^24 (16 million-something) pixels on all platforms. But on OS X,
> >>> this isn't the case. I have a widget inside a QScrollView, and
> >>> that widget can grow very big in the Y (height) dimension (it's a
> >>> text display where new text is added at the bottom all the time.)
> >>> Heights over 40000 are not uncommon.
> >>>
> >>> However, on Mac OS X, I'm busted. When the widget grows over
> >>> 16383 pixels in height, it wraps back to 8191, and my application
> >>> gets very messed up. Note that QWIDGETSIZE_MAX is 16777215 on OS
> >>> X too, so this shouldn't happen.
> >>
> >> I've opened a bug about this a while ago:
> >>
> >> http://bugreports.qt.nokia.com/browse/QTBUG-11415
> >>
> >> I'm surprised to see no one at least confirmed the bug, given the
> >> seriousness of it. :-/
More information about the Qt-interest-old
mailing list