[Qt-interest] Critical bug: QWidgets with size > 16383 break on OS X
Constantin Makshin
cmakshin at gmail.com
Sun Jun 13 14:46:49 CEST 2010
"src/gui/kernel/qwidget_mac.mm" has 2 lines that seem to be related to your problem:
#define XCOORD_MAX 16383
#define WRECT_MAX 8191
Names of these macros and their usage make me think it's some sort of platform restriction Qt has to obey. I've never worked with MacOS so this is just a guess.
On Sunday 13 June 2010 01:47:37 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 will be reporting this to the bug tracker, but if someone knows of
> some workaround for this, I would be very thankful, because right now,
> the application is useless on the Mac :-/
>
> This happens with 4.6.2 and 4.7.0 beta1, both 32-bit. Mac OS X 10.6.3
> and 10.5.8.
>
> What follows is some example code that triggers the bug. On Linux, this
> shows a window that (once you scroll to the very bottom) prints "20000"
> (the height of the widget). On OS X, it prints "8191", which is the
> height of the widget on the Mac, even though 20000 was set.
>
>
> #include <QApplication>
> #include <QScrollArea>
> #include <QWidget>
> #include <QPainter>
>
> class Widget: public QWidget
> {
> protected:
> void paintEvent( QPaintEvent* )
> {
> QPainter p(this);
> p.drawText(10, this->height(), QString::number(this->height()));
> }
>
> public:
> Widget(QWidget *parent = 0)
> : QWidget(parent)
> { }
> };
>
>
> int main(int argc, char *argv[])
> {
> QApplication a(argc, argv);
> QScrollArea* scr = new QScrollArea;
> Widget* w = new Widget(scr);
> w->resize(500, 20000);
> scr->setWidget(w);
> scr->show();
> return a.exec();
> }
More information about the Qt-interest-old
mailing list