Code: Select all
QFont myFont;
QString str("I wonder how wide this is?");
QFontMetrics fm(myFont);
int width=fm.width(str);
Moderator: Rathinagiri
Code: Select all
QFont myFont;
QString str("I wonder how wide this is?");
QFontMetrics fm(myFont);
int width=fm.width(str);
Sorry, I don't know how to implement it in harbourrathinagiri wrote:I had found this code from a site. Does this help?
Code: Select all
QFont myFont; QString str("I wonder how wide this is?"); QFontMetrics fm(myFont); int width=fm.width(str);
Code: Select all
qfm := QFontMetrics(::oQTObject:Font())
nWidth := qfm:width(::cValue)
Code: Select all
#include "..\..\include\hmg.ch"
Set Procedure To ..\..\source\hmg
Function Main
local oFont := QFont():New()
local oFM := QFontMetrics():New(oFont)
local nWidth := 0
nWidth := oFM:width('What would be the Width?')
msginfo(str(nWidth))
return nil
esgici wrote:Very good news, thanksRoberto 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.
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
Good news!dhaine_adp wrote: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.
Ok.dhaine_adp wrote: 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
I've coded enabled property in control class, so, it is already supported for all controls.rathinagiri wrote: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?
This should be tested, but properties, events and methods like the following should work for all (or most) of the controls we coded:Roberto Lopez wrote:I've coded enabled property in control class, so, it is already supported for all controls.rathinagiri wrote: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?
<...>
So, even in this early stage of development, HMG.4 supersedes HMG.3 in a lots of aspects for the controls we are working on (ie: backcolor and fontcolor for buttons).
Code: Select all
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
The only exception to this, is the case in that we want that new properties can be changed at control creation, so, it could be done, since being optional clauses or properties this will not affect backwards compatibility.Roberto Lopez wrote:There is no need to add special code for it in hmg.ch to support that: it is already working.
Yes! it works!rathinagiri wrote:I think you can use like this...
Believe me, it works.Code: Select all
#include "..\..\include\hmg.ch" Set Procedure To ..\..\source\hmg Function Main local oFont := QFont():New() local oFM := QFontMetrics():New(oFont) local nWidth := 0 nWidth := oFM:width('What would be the Width?') msginfo(str(nWidth)) return nil