Markus Grabner wrote:
> In Qt3, I could open a window on a different screen in a multi-head
> configuration with a command like this:
> new QWidget(qApp->desktop()->screen(1));
> In Qt4, the same code compiles without errors or warnings, but when I try
> to draw anything on such a widget, there is no graphics output, instead
> the following XWindows error is reported on the console:
> X Error: BadMatch (invalid parameter attributes) 8
> Major opcode: 62 (X_CopyArea)
> Resource id: 0x0
> Any ideas how to solve this problem? Or is there an entirely different
> (recommended) way to create windows on a screen other than the
> application's primary screen?
Ok, it took me three hours to identify and fix the bug...
When creating a new window, Qt4 uses the application's *default* screen for
the root window of the new widget's backingstore buffer, even if the widget
is created on a screen other than the default screen. This results in a
BadMatch error (see XCopyArea manpage).
As a workaround, one can use "QPixmap::x11SetDefaultScreen(screen)" whenever
creating a widget on a different screen. The attached patch (against
Qt-4.1.0-snapshot-20051023) takes care of this automatically.
Markus Grabner - Computer Graphics and Vision
Graz University of Technology, Inffeldgasse 16/II, 8010 Graz, Austria
Phone: +43/316/873-5041, Fax: +43/316/873-5050
Description: Text Data