On 3/2/06, Mattias Gaertner <[EMAIL PROTECTED]> wrote:
> DrawText
>
> Well? What does DrawText return under qt?

It wasn't implemented =) This is what I was looking for, thanks.

I did a quick and dirty implementation for DrawText windows API and
TLabel now works =) (no font, size, etc implemented however)

Here is my code:

function TQtWidgetSet.DrawText(DC: HDC; Str: PChar; Count: Integer;
  var Rect: TRect; Flags: Cardinal): Integer;
var
  WideStr: WideString;
begin
  Result := 30;

  WideStr := WideString(Str);

  if DC = 0 then Exit;

  TQtDeviceContext(DC).drawText(Rect.Left, Rect.Top, @WideStr);
end;

The problem is that the Qt function drawText doesn't return
information about the size drawn, so I just hardcoded to 30 until a
better solution arrives.

Another problem, it works, but I think that LCL tryes to paint outside
the paint event, I receive some messages like this:

QPainter::begin: Widget painting can only begin as a result of a paintEvent

I think I will do like Den Jean sugested and use that Qt function to
check if I'm on a paint event.

thanks,
--
Felipe Monteiro de Carvalho

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to