Lazarus

Programming => Widgetset => QT => Topic started by: andyH on February 10, 2022, 07:46:14 pm

Title: [solved] TFrame + TTabSheet
Post by: andyH on February 10, 2022, 07:46:14 pm
I have posted on a similar topic and not had any useful response. I have a sample project to demonstrate:

Main form + TPageControl with tabsheets. A TFrame as a container for a number of objects that sit on the tabsheet. Compiles and runs okay with GTK - screenshot (deliberately set the frame colour red).

Compile with QT and not okay - screenshot. It appears as if the TFrame is not rendered on the tabsheet. FButton is a button on the tabsheet - to confirm that QT will display objects on a tabsheet. With GTK FButton is hidden behind the TFrame.

I had previously tried this with a TPanel and got the same behaviour, switched from a TPanel as a container to a TFrame - no change.

I've attached the sample project.

I'm running Linux Mint 20.3 with Lazarus 2.0.10 and have installed libqt5pas version 2.9 (https://github.com/davidbannon/libqt5pas/releases/tag/v1.2.9 (https://github.com/davidbannon/libqt5pas/releases/tag/v1.2.9)).

Is it me or a bug?
Title: Re: TFrame + TTabSheet
Post by: zoltanleo on February 11, 2022, 08:32:24 am
Hey andyH

I have no problem on win32 with frame as container
Title: Re: TFrame + TTabSheet
Post by: zeljko on February 11, 2022, 08:36:26 am
It works here BUT change Anchors and Width/Height with align:
  TestFrame:= TFrame2.Create(self);
  //with TestTab do
  with TestFrame do
      begin
        Align := alClient;
        // Anchors:=[akLeft,akTop,akRight,akBottom]; //dont think does anything.
        Parent:= PageCtrl.Page[0];
        //Width:= Parent.ClientWidth;
        //Height:= Parent.ClientHeight;
      end;
Title: Re: TFrame + TTabSheet
Post by: andyH on February 11, 2022, 01:00:47 pm
@zeljko - thanks 

Made the changes, from:
Code: Pascal  [Select][+][-]
  1.   with TestFrame do
  2.       begin
  3.         Anchors:=[akLeft,akTop,akRight,akBottom]; //dont think does anything.
  4.         Parent:= PageCtrl.Page[0];
  5.         Width:= Parent.ClientWidth;
  6.         Height:= Parent.ClientHeight;
  7.       end;
to
Code: Pascal  [Select][+][-]
  1.    with TestFrame do
  2.       begin
  3.         Align := alClient;
  4.         Parent:= PageCtrl.Page[0];
  5.       end;
and it worked. Although why it was okay with GTK2 and not QT5, don't know.

So simple, but I suspect I would not have found that on my own.

Thanks again.

TinyPortal © 2005-2018