Qt called from WVG, crashs and painting bugs

121 views
Skip to first unread message

Karsten Stücker

unread,
Jan 16, 2015, 4:56:01 AM1/16/15
to qtcon...@googlegroups.com
Hello Guys,

some time ago i reported a bug within QT and the WVT GT:
https://groups.google.com/forum/?hl=de#!topic/qtcontribs/hsXQeW4x2co

I could solve this by setting up a fix for the gtwvt.c

but now with GT_WVG i wasnt able to fix it :(

The result of the "bug" are crashs and wrong displayed/painted QT forms.

I think the problem is like in WVT the duplicated message handling. 

In appendix i added a complete testing project.

Perhaps you have a idea how to fix this.

best regards
Karsten


buggedWindow.jpg
crash.jpg
Problem_QT_WVG.zip
hb_out_1.log

Massimo Belgrano

unread,
Jan 16, 2015, 6:13:54 AM1/16/15
to qtcon...@googlegroups.com
I not good undestrand wich is your problem , difficult understand your sample, but want notice you
Recent evolution in qt seem give new feature in using gtqtc and hbqt 

 + hbqt/tests/gt_in_qt.prg
    + Added: another app to demonstrate how to execute a GT window
       from within a HbQt window. Both windows remain active and can 
       be switched back and forth. Note, only one GT window can remain 
       active at a time in ST applications.


    ! Adopted: GtQTC code belonging to QApplication() initialization.
       This is Przemek's tip, thanks.
       It makes it possible to call HbQt components from GtQTC based 
       console applications and vice-versa.

    ; W A R N I N G - Incompatible. Any application using 
                      QApplication():quit() should be fixed to use 
                      other methods.



Karsten Stücker

unread,
Jan 16, 2015, 7:14:34 AM1/16/15
to qtcon...@googlegroups.com
Hey Massimo,
Problem is that the QT form isnt painted right. The reason is, that some windows messages are handled in the console window and never reach the QT form.
This also causes the app to crash sometimes.

In the GTWVT i cut down the complete message handling, after this the QT form is running right, without any errors.


In WVG the same doesnt work. but the message handling is much complex than in WVT.

With the GtQTC i didnt tested it.




Massimo Belgrano

unread,
Jan 16, 2015, 10:21:33 AM1/16/15
to qtcon...@googlegroups.com

2015-01-16 13:14 GMT+01:00 Karsten Stücker <ks....@gmail.com>:
With the GtQTC i didnt tested it.

Can you?


--
Massimo Belgrano
Delta Informatica S.r.l. (Cliccami per scoprire 

Karsten Stücker

unread,
Jan 16, 2015, 1:10:55 PM1/16/15
to qtcon...@googlegroups.com


Can you?


Same behavior with GT_QTC:


Karsten Stücker

unread,
Jan 22, 2015, 2:15:44 AM1/22/15
to qtcon...@googlegroups.com
I have made the Demo much simpler.

As base i used the example harbour\addons\hbqt\tests\qt_in_gt.prg

in this example a console application calls a QT widget.

The example works. But it uses the GT_WIN.
In the GT-WIN the bug wont apear and it works correct.

BUT WVG,WVT and QTC are bugged.

if you want to test the sample with the normal current build of QTContribs you have to replace the gtqtc.hbc in qt_in_qt.prg with -gtqtc


bin_and_dbf.zip
brws_funcs.prg
qt_in_gt.hbp
qt_in_gt.prg

Karsten Stücker

unread,
Jan 28, 2015, 10:52:52 AM1/28/15
to qtcon...@googlegroups.com

Finally this is the fix:
contrib\gtwvg\gtwvgd.c

static WPARAM hb_gt_wvt_ProcessMessages( PHB_GTWVT pWVT )
{
   MSG msg;

   //Workaround: i added this to disable event handling in GT while QT is visible
   if (testDisable_WVG) //this is set before showing the QT, after QT exit set to false
       return 0; 

   while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
   {
      if( ! hb_gt_wvt_IsDialogMessage( pWVT, &msg ) )
      {
         TranslateMessage( &msg );
         DispatchMessage( &msg );
      }
   }

   return msg.wParam;
}


if testDisable_WVG is set, QT works normal.
If someone looking for the same bug, you have to build your own workaround, or write me.

Karsten Stücker

unread,
Jan 29, 2015, 2:19:30 AM1/29/15
to qtcon...@googlegroups.com
here is the Fix For QTC:
harbour\contrib\gtqtc\gtqtc1.cpp

static int hb_gt_qtc_ReadKey( PHB_GT pGT, int iEventMask )
{
   PHB_GTQTC pQTC;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_qtc_ReadKey(%p,%d)", pGT, iEventMask ) );

   HB_SYMBOL_UNUSED( iEventMask );

   pQTC = HB_GTQTC_GET( pGT );
   if( pQTC )
   {
      int iKey;

     //Workaround: i added this to disable event handling in GT while QT is visible

     if (testInkeyDisable_QTC)
       return 0; 


      HB_QTC_LOCK();
      if( pQTC->qEventLoop )
         pQTC->qEventLoop->processEvents( QEventLoop::AllEvents );
      else
         QApplication::processEvents( QEventLoop::AllEvents );
      HB_QTC_UNLOCK();

      if( hb_gt_qtc_getKeyFromInputQueue( pQTC, &iKey ) )
         return iKey;
   }
   return 0;
}

Same like in WVT and WVG. 
you have to set the testInkeyDisable_QTC while qt form is running.

Reply all
Reply to author
Forward
0 new messages