Welcome to the Project Developers' Table

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Welcome to the Project Developers' Table

Post by Rathinagiri »

Hi Roberto
had you checked with the new version of hbqt without constructor? Because i had changed the code from window.prg to dialogs.prg. Try to use with ::s_qApp:clipboard(). Now i am out of station and could not verify.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Welcome to the Project Developers' Table

Post by Roberto Lopez »

rathinagiri wrote:Hi Roberto
had you checked with the new version of hbqt without constructor? Because i had changed the code from window.prg to dialogs.prg. Try to use with ::s_qApp:clipboard(). Now i am out of station and could not verify.
I'm testing HBIDE with current (10 minutes ago) Harbour sources.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Re: Welcome to the Project Developers' Table

Post by bedipritpal »

Roberto Lopez wrote:
mrduck wrote:
I use xp pro sp3.
So, the only explanation to the fact that Pritpal was unable to reproduce the problem, is that for his system (like mine with the MingW QT SDK) the error does not arises on every execution but in a random basis.
Me too on XP Pro.

Hence because error does not arise on every execution,
It cannot be termed as error with QClipboard. Especially so because
error is reported in qtcore.dll while QClipboard() is a module of qtgui.dll.
So we need more tracing. It seems error is buries somewhere else.

As a tip, try to put traces before AND after call to QClipboard():setText( someText ).
enjoy hbIDEing... Pritpal Bedi
User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Re: Welcome to the Project Developers' Table

Post by bedipritpal »

Roberto Lopez wrote:Pritpal,

There is another problem with current HBQT code (r 15658).

You can check it in testbrow.

When you edit a cell and confirm with [enter] the program ends.

When you restart the demo you'll notice that the position used to save was incorrect.

The problem is here:

STATIC PROCEDURE my_select( pModelIndex, nCX, nCY )
LOCAL qModelIndex := QModelIndexFromPointer( pModelIndex )

nCX := qModelIndex:column()
nCY := qModelIndex:row()
RETURN

Since HMG browse is based on testbrow, the same problem arises on browse demos. The position retrieved from QModelIndex is incorrect.

Please verify after this changelog:

2010-10-21 12:51 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtcore/hbqt_hbqslots.cpp
+ Added: "QModelIndex,QModelIndex" constant.

* contrib/hbqt/tests/testbrow.prg
- Replaced: BREAK => EXIT.
Under such context, BREAK ( break; ) is a C statement not Harbour.
enjoy hbIDEing... Pritpal Bedi
User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Re: Welcome to the Project Developers' Table

Post by bedipritpal »

rathinagiri wrote:Hi Roberto
had you checked with the new version of hbqt without constructor? Because i had changed the code from window.prg to dialogs.prg. Try to use with ::s_qApp:clipboard(). Now i am out of station and could not verify.
You misread the ChangeLog.

QClipboard() returns a valid pointer but have not to be
released by GC. I just made it to not be freed by Harbour.
It is responsibility of Qt to free it.

So ::s_qApp:clipboard() and QClipboard() returns the same system clipboard.
enjoy hbIDEing... Pritpal Bedi
User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Re: Welcome to the Project Developers' Table

Post by bedipritpal »

2010-10-21 13:04 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* source/browse.prg
! Optimization.
Just do not pass variables to other methods if those are
declared as instance variables of the class.
enjoy hbIDEing... Pritpal Bedi
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Welcome to the Project Developers' Table

Post by Roberto Lopez »

bedipritpal wrote:Please verify after this changelog:

2010-10-21 12:51 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtcore/hbqt_hbqslots.cpp
+ Added: "QModelIndex,QModelIndex" constant.
Is working fine now.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Welcome to the Project Developers' Table

Post by Roberto Lopez »

bedipritpal wrote:2010-10-21 13:04 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* source/browse.prg
! Optimization.
Just do not pass variables to other methods if those are
declared as instance variables of the class.
You are right.

That comes from testbrow (function based) to browse class transition.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
mrduck
Posts: 497
Joined: Fri Sep 10, 2010 5:22 pm

Re: Welcome to the Project Developers' Table

Post by mrduck »

IMPORTANT:
hmg code must be updated for this change:
HB_*Class:from( pPtr ) => *ClassFromPointer( pPtr )

For example, run grid\demo_3.prg and try to edit a cell...
then change in grid.prg
METHOD DoCellKeyBoardEvents( e ) Class GRID
LOCAL oKeyEvent := QKeyEventFromPointer( e ) <--------here




here is a diff:


diff -r 3c2156624809 source/grid.prg
--- a/source/grid.prg Thu Oct 21 19:50:03 2010 +0200
+++ b/source/grid.prg Thu Oct 21 23:43:15 2010 +0200
@@ -251,7 +251,7 @@
ELSE // cellnavigation ON MultiSelect ON
oList := ::oQTObject:SelectedItems()
FOR i := 0 to oList:Size() - 1
- oItem := HB_QTableWidgetItem():from( oList:At( i ) )
+ oItem := QTableWidgetItemFromPointer( oList:At( i ) )
nRow := oItem:Row() + 1
nCol := oItem:Column() + 1
aAdd( aValue,{nRow,nCol} )
@@ -264,7 +264,7 @@
ELSE // cellnavigation OFF MultiSelect ON
oList := ::oQTObject:SelectedItems()
FOR i := 0 to oList:Size() - 1
- oItem := HB_QTableWidgetItem():from( oList:At( i ) )
+ oItem := QTableWidgetItemFromPointer( oList:At( i ) )
nRow := oItem:Row() + 1
IF aScan( aValue,nRow ) == 0
aAdd( aValue,nRow )
@@ -1539,7 +1539,7 @@
/*----------------------------------------------------------------------*/

METHOD DoCellKeyBoardEvents( e ) Class GRID
- LOCAL oKeyEvent := HB_QKeyEvent():from( e )
+ LOCAL oKeyEvent := QKeyEventFromPointer( e )
LOCAL nKey := oKeyEvent:key()
LOCAL nModifiers := oKeyEvent:modifiers()
LOCAL xValue
diff -r 3c2156624809 source/listbox.prg
--- a/source/listbox.prg Thu Oct 21 19:50:03 2010 +0200
+++ b/source/listbox.prg Thu Oct 21 23:43:15 2010 +0200
@@ -121,7 +121,7 @@
IF ValType( ::lMultiSelect ) != 'U' .and. ::lMultiSelect
oList := ::oQTObject:SelectedItems()
FOR i := 0 to oList:size() - 1
- oLWItem := HB_QListWidgetItem():from( oList:at( i ) )
+ oLWItem := QListWidgetItemFromPointer( oList:at( i ) )
aAdd( aValue,::oQTObject:row( oLWItem ) + 1 )
NEXT i
RETURN aValue
diff -r 3c2156624809 source/window.prg
--- a/source/window.prg Thu Oct 21 19:50:03 2010 +0200
+++ b/source/window.prg Thu Oct 21 23:43:15 2010 +0200
@@ -1548,9 +1548,9 @@
IF valtype( ::oDropDownMenu:aItems ) == 'O'

IF valtype( ::oDropDownMenu:aItems:image ) == 'C'
- ::oDropDownMenu:aItems:oQTObject := QAction():from( ::oDropDownMenu:oQTObject:addAction( ::oDropDownMenu:aItems:image , ::oDropDownMenu:aItems:caption ) )
+ ::oDropDownMenu:aItems:oQTObject := QActionFromPointer( ::oDropDownMenu:oQTObject:addAction( ::oDropDownMenu:aItems:image , ::oDropDownMenu:aItems:caption ) )
ELSE
- ::oDropDownMenu:aItems:oQTObject := QAction():from( ::oDropDownMenu:oQTObject:addAction( "" , ::oDropDownMenu:aItems:caption ) )
+ ::oDropDownMenu:aItems[i]:oQTObject := QActionFromPointer( ::oDropDownMenu:oQTObject:addAction( "" , ::oDropDownMenu:aItems[i]:caption ) )
ENDIF

IF valtype( ::oDropDownMenu:aItems[i]:enabled ) == 'L'
@@ -1748,7 +1748,7 @@

::oQTObject:setContextMenuPolicy( 3 )

- ::oQTObject:connect( "customContextMenuRequested(QPoint)", {|p| ::oContextMenu:oQTObject:exec( ::oQTObject:mapToGlobal( QPoint():from( p ) ) ) } )
+ ::oQTObject:connect( "customContextMenuRequested(QPoint)", {|p| ::oContextMenu:oQTObject:exec( ::oQTObject:mapToGlobal( QPointFromPointer( p ) ) ) } )

ENDIF
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Welcome to the Project Developers' Table

Post by Roberto Lopez »

Pritpal,

I've found another problem after conversion.

Print text alignment is not working anymore.

The relevant code is between lines #669 to #679 in printer.prg:

Code: Select all

         IF valtype( nToRow )=='N' .and. valtype( nToCol )=='N'
            QRectF := QRectF( nCol , nRow , nToCol - nCol , nToRow - nRow )
            QTextOption := QTextOption()

            IF valtype( nAlignment ) == 'N'
               QTextOption:setAlignment( nAlignment )
            ELSE
               QTextOption:setAlignment( 0 )
            ENDIF

            ::qPainter:drawText( QRectF , cData , QTextOption )

Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply