Page 3 of 106

Re: Welcome to the Project Developers' Table

Posted: Wed Aug 18, 2010 4:31 am
by dhaine_adp
I'm just learning QT step by step, basically from HBQT samples (complementing it with QT official reference).

So, sorry, I not 'master' QT

Please, take a look at HBQT demos in Harbour distribution. There are Grid and Browse implementations that can give you an idea about how to start.

There is no problem about try and error at this stage of development...
Hi Roberto,

Thanks indeed :D Looks likes it's getting more exciting. Well it's a bit confusing, that's all.... :)

Regards,

Danny

Re: Welcome to the Project Developers' Table

Posted: Wed Aug 18, 2010 10:27 pm
by Roberto Lopez
Hi Team!

Please, check the create() method of your controls for the following problems:

1. Avoid duplicated code: Do not write the code for properties, events and method again, Just invoke it as follows(ie):

if ValType (::nRow)!= 'U'; Self:Row:=::nRow;EndIf

2. Check which are the properties that your control can inherit from control class, and check it to make it work at control creation. ie, for EditBox:

if ValType (::cValue) != 'U' ; Self:Value := ::cValue ; EndIf
if ValType (::nRow) != 'U' ; Self:Row := ::nRow ; EndIf
if ValType (::nCol) != 'U' ; Self:Col := ::nCol ; EndIf
if ValType (::nWidth) != 'U' ; Self:Width := ::nWidth ; EndIf
if ValType (::nHeight) != 'U' ; Self:Height := ::nHeight ; EndIf
if ValType (::ScrollBars) != 'U' ; Self:ScrollBars := ::nScrollBars ; EndIf
if ValType (::cFontName) != 'U' ; Self:FontName := ::cFontName ; EndIf
if ValType (::nFontSize) != 'U' ; Self:FontSize := ::nFontSize ; EndIf
if ValType (::lBold) != 'U' ; Self:FontBold := ::lBold ; EndIf
if ValType (::lItalic) != 'U' ; Self:FontItalic := ::lItalic ; EndIf
if ValType (::lUnderline) != 'U' ; Self:FontUnderline := ::lUnderline ; EndIf
if ValType (::lStrikeout) != 'U' ; Self:FontStrikeOut := ::lStrikeout ; EndIf
if ValType (::cToolTip) != 'U' ; Self:ToolTip := ::cToolTip ; EndIf
if ValType (::lReadOnly) != 'U' ; Self:ReadOnly := ::lReadOnly ; EndIf
if ValType (::lTabStop) != 'U' ; Self:TabStop := ::lTabStop ; EndIf
if ValType (::bOnGotFocus) != 'U' ; Self:OnGotFocus := ::bOnGotFocus ; endif
if ValType (::bOnLostFocus) != 'U' ; Self:OnLostFocus := ::bOnLostFocus ; endif
if ValType (::aBackColor) != 'U' ; Self:backColor := ::aBackColor ; endif
if ValType (::aFontColor) != 'U' ; Self:FontColor := ::aFontColor ; endif
if ValType (::aDisabledFontColor) != 'U' ; Self:DisabledFontColor:= ::aDisabledFontColor ; endif
if ValType (::aDisabledBackColor) != 'U' ; Self:DisabledbackColor:= ::aDisabledBackColor ; endif
if ValType (::lVisible) != 'U' ; Self:Visible := ::lVisible ; else ; ::oQTObject:show() ; endif


Thanks!

Re: Welcome to the Project Developers' Table

Posted: Wed Aug 18, 2010 10:46 pm
by Roberto Lopez
Roberto Lopez wrote:Hi Team!

Please, check the create() method of your controls for the following problems:
<...>
And...

3. Do not forget to initialize font and events. They are needed for various shared properties. ie(for EditBox):

* Create QT Object and other initialization tasks

::oQTObject := QTextEdit():new( ::oParent:oQTObject )
::oFont := QFont():New()
::oQTObject:installEventFilter( ::s_events )

Thanks!

Re: Welcome to the Project Developers' Table

Posted: Thu Aug 19, 2010 12:52 am
by Roberto Lopez
Hi Team,

I've found a way to automatically create a Changelog file (using another svn client).

I've found the way to include the changes files list in the changelog generated, so is no required anymore that you manually paste such list in your commit.

Re: Welcome to the Project Developers' Table

Posted: Thu Aug 19, 2010 1:07 am
by esgici
Roberto Lopez wrote:Hi Team,

I've found a way to automatically create a Changelog file (using another svn client).

I've found the way to include the changes files list in the changelog generated, so is no required anymore that you manually paste such list in your commit.
Very good news, thanks :)

We also have a way for notify forum members about changes (like Harbour).

May be a single post to forum.

Only a thought.

Best Regards

--

Esgici

Re: Welcome to the Project Developers' Table

Posted: Thu Aug 19, 2010 7:24 am
by dhaine_adp
Hi Roberto,

I'll be implementing GRID from QAbstractItemView to support the images in header for GRID control. I'll reuse the existing Q...View if necessary but for the time being I'll start from this point. I'll post the code in three days perhaps not a complete work but a working sample.

As I pondering about the implementation, I was planning to extend the GRID to support something like this:

MASTER->CODE, ITEM->DESCRIPTION, ITEM->UNIT and freeze the column 1 & 2. It seems it is possible with QAbstractItemView.

Anyway I will not talk much about it until I get the code up and running. I'm sticking to our goal, to provide the backward compatibility. If what I have said can be included in few lines of code I'll do it otherwise I'll put it in TODO List.

It's just now that I'd be able to run a test file on this so I am still in the experimental stage. I hope that I can post the code as soon as possible. It seems I'm the only one whose less productive. LOL!

Regards,

Danny

Re: Welcome to the Project Developers' Table

Posted: Thu Aug 19, 2010 7:29 am
by Rathinagiri
Grid?! Great Danny! Awaiting for your code.

As I am a beginner of QT and OOP, I had updated all the properties for frame control (except enabled and transparent) and uploaded the same. :)

Regarding 'enabled' property, it was not mentioned in hmg.ch, however it was already implemented in control.prg. So, shall we include in hmg.ch and all controls?

Re: Welcome to the Project Developers' Table

Posted: Thu Aug 19, 2010 8:20 am
by mol
I've tried to realize AutoSize property for label, but now, I don't know how to calculate text length with given fontname and fontsize.
My idea was to create sth like that:

Code: Select all

	oTextLayout := QTextLayout():new()
	oTextLayout:setFont(::oQTObject:Font())
	oTextLayout:setText(::cValue)
	nWidth := oTextLayout:maximumWidth() 
	Self:Width := nWidth
but I always get 0 as nWidth.
So, I place AutoSize to DOTO list.
Marek

Re: Welcome to the Project Developers' Table

Posted: Thu Aug 19, 2010 8:38 am
by Rathinagiri
From the QTdoc:

QTextLayout::maximumWidth()

Warning: This function only returns a valid value after the layout has been done.

Therefore, had you tried beginLayout () and endLayout()?

Code: Select all

   oTextLayout := QTextLayout():new()
   oTextLayout:beginLayout()
   oTextLayout:setFont(::oQTObject:Font())
   oTextLayout:setText(::cValue)
   oTextLayout:endLayout()
   nWidth := oTextLayout:maximumWidth()
   Self:Width := nWidth

Re: Welcome to the Project Developers' Table

Posted: Thu Aug 19, 2010 11:44 am
by mol
rathinagiri wrote:From the QTdoc:

QTextLayout::maximumWidth()

Warning: This function only returns a valid value after the layout has been done.

Therefore, had you tried beginLayout () and endLayout()?

Code: Select all

   oTextLayout := QTextLayout():new()
   oTextLayout:beginLayout()
   oTextLayout:setFont(::oQTObject:Font())
   oTextLayout:setText(::cValue)
   oTextLayout:endLayout()
   nWidth := oTextLayout:maximumWidth()
   Self:Width := nWidth
Yes, I've tried, but always got 0


I think, it's blind way... :(