It's perfectly true !HMG4 is OOP based and "open" for enhancements of every control without touching the core but using inheritance.
If you google for Qt sample code you will see that the standard way of using Qt is by inheritance. In this way we can override protected and virtual protected c++ methods to allows us to do almost everything.
Unfortunately hbQt doesn't allow us to do this at prg level. Python does, hbQt doesn't.
Qt is a great piece of code. And there are different possibilities to do the same thing. For example, instead of overriding a protected method, you can intercept the event or the signal. Sometimes it is enough, and infact Ricci produced Orchid, and Pritpal the more complex hbide.
But as you can see in hbQt source code, sometimes it is absolutely necessary to override a class in order to expose its methods to harbour VM. I can make examples and explain the whys if you want, but for the moment believe to me, sometimes it is absolutely necessary.
hbQt is quite complete. But is not 100% Qt. There are missing bits. The most notable for us at the moment is the implementation of the one-shot-timer.
So, what I'm trying to do ? Well, I'm trying to implement VALID/WHEN. I did a first implementation more gui-oriented (you can leave the textbox but if valid is false the background turns red) but I was requested to try to implement a more clipper-compliant VALID: if it is .F. you can't leave the field.
And since I'm not succesful in my tast at harbour level, I started trying to add c++ inheritance...
I don't know if this will solve my problems, but I should try. It will help in other situations...
What changes for HMG4 users ? Nothing, since they are using a precompiled library.
What changes for HMG4 developers ?
- have Qt SDK installed
- have harbour source code installed
And if you are a serious HMG4 core code developers you should have them installed anyway ! Qt SDK is required to compile hbQt anyway....
So, in my tests, in textbox.prg
Code: Select all
::oQtObject := QLineEdit()
Code: Select all
::oQtObject := hmgQLineEdit()
And let the other Ricci phrase come true:
When using HMG3 you always have to think "What is possible?", with HMG4 you can think "What do I want to do?"