Lazarus

Programming => Widgetset => QT => Topic started by: Groffy on September 28, 2015, 10:29:17 am

Title: AnchorDocking + Sparta basic package with QT
Post by: Groffy on September 28, 2015, 10:29:17 am
There was a discussion about that topic two weeks ago on the qt mailing list. I installed the package under Win7 /qt and win32 widgets + Lazarus 1.5 trunk. Its working for me so far, but with qt the keyboard keys CTRL+C / CTRL+V / CTRL+X  and the [Delete] key are not working. Can I post these issues here or should it stay separately in the QT mailing list?

Best regards
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: hnb on September 28, 2015, 09:03:10 pm
Can be here. We have some bug in QT related to handling form where is set "ParentWindow" :/
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko on September 28, 2015, 10:50:48 pm
Where exactly ? Maybe I can fix it
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: Groffy on September 29, 2015, 07:05:51 am
An issue I noticed so far (Lazarus trunk revision 49877 + qt 4.8.5) : Place a control on an empty form. Focus the control and press CTRL+C, focus the form and press CTRL+V. Exception message : "Cannot focus a disabled or invisible window"

Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko on September 29, 2015, 08:04:10 am
Can you fill an issue about it ?
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko on September 29, 2015, 09:19:09 am
btw. I cannot reproduce it with trunk lazarus, fpc.2.6.4, linux 32 bit, qt 4.7.4
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: Groffy on September 29, 2015, 09:35:10 am
@zelko

http://bugs.freepascal.org/view.php?id=28744

I did not test it under Linux Mint, I read somewhere that Sparta basic package is only compiling with fpc3.x (?)

Title: Re: AnchorDocking + Sparta basic package with QT
Post by: hnb on September 29, 2015, 09:40:12 am
You need to install "Sparta Basic" package. As mentioned above keyboard keys CTRL+C / CTRL+V / CTRL+X  and the [Delete] key are not working for "docked designed form". Same for Popup menu - is not handled/detected for "docked designed form". Right click on form will bring to front PopupMenu assigned to PageControl (ide/sourceeditor.pp)
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko on September 29, 2015, 10:47:58 am
@hnb, ok I'll take a look into
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko on September 29, 2015, 01:23:48 pm
Is there anywhere howto install sparta package ? Where I can download it ?
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: balazsszekely on September 29, 2015, 01:31:10 pm
@zeljko
You can find it in the FreeSparta branch(components directory): http://svn.freepascal.org/svn/lazarus/branches/free-sparta
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko on September 29, 2015, 01:57:26 pm
Thanks
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: Groffy on September 30, 2015, 08:13:46 am
I made a mistake, I checked out the

http://svn.freepascal.org/svn/lazarus/branches/free-sparta

source, not Lazarus trunk. I guess the Sparta basic package will not compile under Lazarus trunk(?)
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: hnb on September 30, 2015, 08:26:23 am
@Groffy

It should compile with trunk without any problems (ofc you need to use FPC 3.x). All changes from Sparta branch are merged to trunk (only "Sparta Basic" package is outside trunk. I need to fix few things. Anyway it is almost done :) ).
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: Groffy on September 30, 2015, 09:08:17 am
@hnb

Thank you, Sparta basic package is compiling with Lazarus trunk / FPC3.0rc1

Title: Re: AnchorDocking + Sparta basic package with QT
Post by: hnb on October 16, 2015, 09:00:29 am
@zeljko QT is only platform where is not painted correctly Data Module for FreeSparta branch :\
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko 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.
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: hnb on October 16, 2015, 09:23:03 am
DataModule was not tested for carbon yet :\
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko on October 16, 2015, 09:56:56 am
I suppose that painting problems comes from painting outside of paint event, otherwise Qt paints perfectly.
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko 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 ?
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: hnb 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.
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko 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;


Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko 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.
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko 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.
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: hnb 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).
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: zeljko 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.
Title: Re: AnchorDocking + Sparta basic package with QT
Post by: hnb on October 19, 2015, 08:30:02 pm
Then open an issue and attach example project.

Done.

http://bugs.freepascal.org/view.php?id=28882
TinyPortal © 2005-2018