Recent

Author Topic: AnchorDocking + Sparta basic package with QT  (Read 14323 times)

hnb

  • Sr. Member
  • ****
  • Posts: 268
Re: AnchorDocking + Sparta basic package with QT
« Reply #15 on: October 16, 2015, 09:00:29 am »
@zeljko QT is only platform where is not painted correctly Data Module for FreeSparta branch :\
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

zeljko

  • Hero Member
  • *****
  • Posts: 1079
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: AnchorDocking + Sparta basic package with QT
« Reply #16 on: October 16, 2015, 09:11:58 am »
@hnb, according to that statement carbon works perfect ? I've started yesterday to look into sparta docking but haven't investigate code yet.

hnb

  • Sr. Member
  • ****
  • Posts: 268
Re: AnchorDocking + Sparta basic package with QT
« Reply #17 on: October 16, 2015, 09:23:03 am »
DataModule was not tested for carbon yet :\
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

zeljko

  • Hero Member
  • *****
  • Posts: 1079
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: AnchorDocking + Sparta basic package with QT
« Reply #18 on: October 16, 2015, 09:56:56 am »
I suppose that painting problems comes from painting outside of paint event, otherwise Qt paints perfectly.

zeljko

  • Hero Member
  • *****
  • Posts: 1079
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: AnchorDocking + Sparta basic package with QT
« Reply #19 on: October 16, 2015, 02:26:20 pm »
Can be here. We have some bug in QT related to handling form where is set "ParentWindow" :/

Well....Ctrl+V raises error with Gtk2 too. So this is not Qt only problem, but I guess (maybe) some winapi implementation in lcl.
I'd like to extract example (so no need for sparta package) where Qt have problems with ParentWindow. Can you create one ?

hnb

  • Sr. Member
  • ****
  • Posts: 268
Re: AnchorDocking + Sparta basic package with QT
« Reply #20 on: October 16, 2015, 10:55:05 pm »
I suppose that painting problems comes from painting outside of paint event, otherwise Qt paints perfectly.

It is very strange because painting for non visual components works perfectly for normal forms, the only problem is with DataModule.

Well....Ctrl+V raises error with Gtk2 too. So this is not Qt only problem, but I guess (maybe) some winapi implementation in lcl.
I'd like to extract example (so no need for sparta package) where Qt have problems with ParentWindow. Can you create one ?

I will try.
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

zeljko

  • Hero Member
  • *****
  • Posts: 1079
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: AnchorDocking + Sparta basic package with QT
« Reply #21 on: October 17, 2015, 10:52:09 am »
Ok, this is what needs to be done for Qt and Gtk2:

1.main.pp TMainIDE.GetActiveDesignerSkipMainBar always returns nil (gtk2 and Qt), that's why shortcuts does not work , mean copy paste of components inside designed form via keyboard. With menu it does work. So, in this function sparta must return current designer somehow. I'm not sure that shortcuts works on win32 too because of this, or win32 contains some extra magic.

2.sparta_ResizerFrame.pas im procedure TResizerFrame.TryBoundDesignedForm;

{$IF DEFINED(LCLGtk2) OR DEFINED(LCLQt)}
pClient.SendToBack; // <--- this is a must.
{$ENDIF}
pClient.BringToFront;



zeljko

  • Hero Member
  • *****
  • Posts: 1079
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: AnchorDocking + Sparta basic package with QT
« Reply #22 on: October 17, 2015, 11:16:23 am »
I can confirm that TDataModule isn't painted properly, but I guess that root of problem is missing paint event for TDataModule design widget under Qt.I suppose that gtk2 paints TDataModule correct since it can paint outside of paint event, so no need for paintevent.
Now you must investigate why TDataModule does not send single paint event to designer form.

zeljko

  • Hero Member
  • *****
  • Posts: 1079
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: AnchorDocking + Sparta basic package with QT
« Reply #23 on: October 17, 2015, 12:11:13 pm »
Ok, problem with TDataModule is located. gtk2 and win32 works because they paint outside of paintevent. What's exact problem:
1.TDataModule uses TFakeNonControl as design form.
2.TFakeNonControl does not have csDesigning in TFakeNonControl.ComponentState
3.When Qt creates form handle it checks for csDesigning (TFakeNonControl in this case) and it creates TQtDesignWidget. If there's no csDesigning in params, it create normal TQtMainWindow.

I've added simple check in TQtWSCustomForm.CreateHandle (QtWSForms.pp unit), so instead of checking csDesigning I'm checking for csDesigning or AWinControl.ClassName = 'TFakeNonControl'. It creates TQtDesignWidget and voila, TDataModule is properly painted.
So, when TFakeNonControl contains csDesigning (or any other flag which says that it will be design form) then it'll work.

hnb

  • Sr. Member
  • ****
  • Posts: 268
Re: AnchorDocking + Sparta basic package with QT
« Reply #24 on: October 18, 2015, 11:44:32 pm »
@zaljko thanks for your valuable input! Painting and copy/paste problems are fixed (painting in r50111, copy/paste in r50113).  :D

I have one new bugreport : Painting of "selecting rectangle" for designed forms don't work for Qt under Windows (even without "Sparta Basic" package).
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak

zeljko

  • Hero Member
  • *****
  • Posts: 1079
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: AnchorDocking + Sparta basic package with QT
« Reply #25 on: October 19, 2015, 09:31:18 am »
I have one new bugreport : Painting of "selecting rectangle" for designed forms don't work for Qt under Windows (even without "Sparta Basic" package).

Then open an issue and attach example project.

hnb

  • Sr. Member
  • ****
  • Posts: 268
Re: AnchorDocking + Sparta basic package with QT
« Reply #26 on: October 19, 2015, 08:30:02 pm »
Checkout NewPascal initiative and donate beer - ready to use tuned FPC compiler + Lazarus for mORMot project

best regards,
Maciej Izak