[Qt-interest] Works in 4.53, but not 4.6.
Samuel Rødal
sroedal at trolltech.com
Tue Dec 22 11:50:03 CET 2009
Freak . wrote:
> Hi, recently i have been using Qt 4.53 with Direct3D 10 under Windows 7
> x64. (Works great)
>
> When configuring Qt4.53 I used a "-direct3D" switch to ensure that it
> worked, with things like
> setAttribute(Qt::WA_MSWindowsUseDirect3D, true);
>
> I'm aware Nokia removed the "experimental Direct3D support" in 4.6, but
> does this mean my code will never work with Qt4.6 and above?
> I'm not sure what that "-direct3D" switch was actually doing when
> building the libraries?
>
> My code compiles but i now have fighting between my MainWindow and the
> Direct3D drawing, even though i implemented my own
> paint event. Basically i get a grey background, if i resize or use a
> Qtimer to refresh the screen i can still see my Direct3D windows being
> drawn,
> but the Mainwindow is obviously drawing on top of it.
>
> How can i fix this behavior?
>
> Is there any fix, a flag or switch that can be set or a way to stop the
> MainWin.
> Any help on shedding some light on this subject would be appreciated,
> I'm sure it will come up again in the future.
>
> Cheers,
> Scott.
You might want to call setUpdatesEnabled(false) on the widget that
you're doing native drawing on, and move your Direct3D drawing code out
of the paint event and into a different function. You can make that
function a slot and have it be triggered by a timer or similar.
Without setUpdatesEnabled(false), Qt will draw the widget into an
offscreen surface, and then blit from the offscreen surface into the
actual window after all the paint events have been called. This is Qt's
double buffering and it's done to prevent flicker, but in your case
where you draw directly to the window it means Qt will overwrite
whatever you've painted shortly after you've painted it.
--
Samuel
More information about the Qt-interest-old
mailing list