hbQT - Post queries in this thread only

Moderator: Rathinagiri

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

Re: hbQT - Post queries in this thread only

Post by Roberto Lopez »

bedipritpal wrote:
Roberto Lopez wrote: There is no special code. It is simply demoqt with Harbour built from current (a couple of days ago) sources.
The same works perfect on Windows.
Try:

oActNew := QAction():new( oMenu1 )
oActNew:setText( "&New" )
oActNew:setIcon( "new.png" )
oActNew:connect( "triggered(bool)", {|w,l| FileDialog( "New" , w, l ) } )
oMenu1:addAction_4( oActNew )
The problem remains the same. The image is not shown.
Regards/Saludos,

Roberto


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

Re: hbQT - Post queries in this thread only

Post by bedipritpal »

A little suggestion:

Since QT official reference samples (and most of those we can find on the web) are C++ based, could be very useful if you could write a small HOWTO file, explaining how to handle certain situations when the translation of the code is not obvious for a Harbour/xBase programmer without C++ knowledge.
This aspect has gained more importance now as you have decided to base HMG on hbQT.
I do not commit but I will try to write one. In all practical situations you can easily grasp the
idea off hbIDE sources which exploits almost all classes of Qt.

As a rule of hbQT implementation, a pointer has to be encapsulated within return type object,
which on the issue we just resolved is - qPainter:device(). If you read Qt's documentation
QPainter():device() returns the QPaintDevice() *. Just encapsulate it in QPaintDevice():from( painter:device() ).
This holds good for all other classes too.

BTW I just downloaded HMG sources and the first scan have a suggestion for you:
The code is haphazardly formatted, indentation is TAB key but anybody touching the code
takes his/her own path, and many more anomalies. The code is entirely off Harbour standards on formatting levels.

I agree that writing the correct and efficient code is of utmost importance, but it is equally important
to have it presentable. I could not ascertain the correct picture of HMG object modal at all and after
few minutes gave up.

You can suggest your developers to use hbIDE. That could be an important resource for your team
to learn how Qt can be exploited best besides provoding necessary tips on formatting front.

This is simply a suggestion, you may follow or descard, entirely upto you.
enjoy hbIDEing... Pritpal Bedi
User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Re: hbQT - Post queries in this thread only

Post by bedipritpal »

The problem remains the same. The image is not shown.
I have no idea then.
enjoy hbIDEing... Pritpal Bedi
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: hbQT - Post queries in this thread only

Post by Roberto Lopez »

bedipritpal wrote:This aspect has gained more importance now as you have decided to base HMG on hbQT.
<...>
Thanks for your explanations and suggestions.

Of course, I strongly agree with you in the formatting issue. It must be solved.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
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: hbQT - Post queries in this thread only

Post by Rathinagiri »

Thanks a lot for your detailed review Bedi.

I usually don't use tab key and give 3 spaces indentation. I will try HBIDE. Thanks for suggesting.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: hbQT - Post queries in this thread only

Post by mol »

I'm repeatting my post here:
Hi Pritpal!
First - Welcome from Poland!
Second - I have a question about QComboBox.
I need to realize SORT option - when all inserted items are sorted.
I've read about Insert Policies, but, in my opinion, they don't work.
Do you have any suggestion about it?

Code: Select all

			if lValue == .T.
				::oQTObject:setInsertPolicy(6)   //QComboBox::InsertAlphabetically
			else
				::oQTObject:setInsertPolicy(3) //QComboBox::InsertAtBottom
			endif
User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Re: hbQT - Post queries in this thread only

Post by bedipritpal »

mol wrote: I need to realize SORT option - when all inserted items are sorted.
I've read about Insert Policies, but, in my opinion, they don't work.
This is Qt documentation :

enum QComboBox::InsertPolicy
This enum specifies what the QComboBox should do when a new string is entered by the user.
^^^^^^^^^^^^^^^^

So this enum is used when user enters string the the combo-box's edit control.
:addItem()/:insertItem() always takes the bottom, or index of the item.

To simulate thi behavior, you need to keep array of strings into a instance vriable.
clear the combobox contents first and then push the sordted array you just preserved.
Like this :

DATA aComboItems INIT {}
METHOD addItem( cItem ) SETGET

METHOD ClassComboBox:addItem( cItem )
LOCAL s

IF hb_isChar( cItem )
aadd( ::aComboItems, cItem )
asort( ::aComboItems, , , {|e,f| e < f } )
::oQtObject:clear()
FOR EACH s IN ::aComboItems
::oQtObject:addItem( s )
NEXT
ENDIF
RETURN Self

You can tweak the above code to suit your requirements.
Unluckily QComboBox() does not have any sorting methods, we are to simulate ourselves.
enjoy hbIDEing... Pritpal Bedi
User avatar
mol
Posts: 3718
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: hbQT - Post queries in this thread only

Post by mol »

Thanks!
I've expected Qcombobox will sort items :)
Now, I can see, it need to be realized manually.
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: hbQT - Post queries in this thread only

Post by Rathinagiri »

Hi,

Should I do anything else to make this work? I want to add an action enabled label when the user clicks on it. This is to add this widget to the status bar. I tried QPushButton instead. But it looks differently (center aligned, raised) when compared to other non-action oriented status bar items.

Code: Select all

   oWidget := QLabel():New()
   oWidget:setText('Clickable Label')
   oWidget:setMouseTracking(.t.)
   oWidget:disconnect("mouseReleaseEvent()")
   oWidget:connect("mouseReleaseEvent()",bBlock)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
bedipritpal
Posts: 122
Joined: Thu Sep 02, 2010 10:47 pm

Re: hbQT - Post queries in this thread only

Post by bedipritpal »

rathinagiri wrote:Hi,

Should I do anything else to make this work? I want to add an action enabled label when the user clicks on it. This is to add this widget to the status bar. I tried QPushButton instead. But it looks differently (center aligned, raised) when compared to other non-action oriented status bar items.

Code: Select all

   oWidget := QLabel():New()
   oWidget:setText('Clickable Label')
   oWidget:setMouseTracking(.t.)
   oWidget:disconnect("mouseReleaseEvent()")
   oWidget:connect("mouseReleaseEvent()",bBlock)
oWidget := QLabel():New()
oWidget:setText( "<a href='http://harbour-project.org/'>http://har ... ct.org/</a>" )
oWidget:connect( "linkActivated(QString)", {|QString| ::execEvent( QString ) } )
enjoy hbIDEing... Pritpal Bedi
Post Reply