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

Qt-interest Archive, December 2006
Xlib operations on Qt


Message 1 in thread

Hey everyone,

 I am trying to do a Qt style that uses GTK to render the widgets. However, I 
seem to run in races when sometimes the GTK widgets get drawn over (the 
opposite also happens, though less often, with relation to the widget's label 
that is drawn by Qt).

 What I'm doing is to get the Xlib's Window from the widget passed on 
drawControl() (through QWidget::winId()) and tell GTK to draw on it. There 
should be no difference between using Xlib drawing routines or GTK higher 
level ones as Xlib is used.

 Based on that, I have done this test which does Xlib drawing on a QWidget and 
goes alright:
http://rpmcruz.planetaclix.pt/trash/x11qt-window.cpp

 So, is the GTK code to be fault or is this approach not safe (maybe QPainter 
draws sometimes to an offscreen QPixmap to then blit it to the QWidget in 
order to avoid flickering?).
 Would it be better to draw GTK stuff to a Xlib Pixmap, export this somehow to 
a QPixmap and use QPainter::drawPixmap() to have it drawn in the widget?

 But it doesn't seem possible to create a QPixmap from a Pixmap (is it?). I 
have tried the following approach, but it failed:
http://rpmcruz.planetaclix.pt/trash/x11qt.cpp

 Any insight on how would you accomplish this would be appreciated?

Cheers,
 Ricardo

-- 
 [ signature omitted ] 

Message 2 in thread

 Sorry. It does seem that my x11qt.cpp test works; I just mistake 
QPaintDevice::bitBlt() syntax and was passing the source as destination and 
the inverse. :P

 Still didn't manage to have that approach working though. But it isn't likely 
Qt related.

Cheers,
 Ricardo

Ricardo Cruz wrote (@ Sexta, 1 de Dezembro de 2006 04:35):
> Hey everyone,
>
>  I am trying to do a Qt style that uses GTK to render the widgets. However,
> I seem to run in races when sometimes the GTK widgets get drawn over (the
> opposite also happens, though less often, with relation to the widget's
> label that is drawn by Qt).
>
>  What I'm doing is to get the Xlib's Window from the widget passed on
> drawControl() (through QWidget::winId()) and tell GTK to draw on it. There
> should be no difference between using Xlib drawing routines or GTK higher
> level ones as Xlib is used.
>
>  Based on that, I have done this test which does Xlib drawing on a QWidget
> and goes alright:
> http://rpmcruz.planetaclix.pt/trash/x11qt-window.cpp
>
>  So, is the GTK code to be fault or is this approach not safe (maybe
> QPainter draws sometimes to an offscreen QPixmap to then blit it to the
> QWidget in order to avoid flickering?).
>  Would it be better to draw GTK stuff to a Xlib Pixmap, export this somehow
> to a QPixmap and use QPainter::drawPixmap() to have it drawn in the widget?
>
>  But it doesn't seem possible to create a QPixmap from a Pixmap (is it?). I
> have tried the following approach, but it failed:
> http://rpmcruz.planetaclix.pt/trash/x11qt.cpp
>
>  Any insight on how would you accomplish this would be appreciated?
>
> Cheers,
>  Ricardo

-- 
 [ signature omitted ]