phpstorm + qcubed

Login or register to post comments
5 replies [Last post]
kon
Offline
Joined: 12/08/2009

hey there

i am currently giving phpstorm a try, i like it very much so far.
only thing that doesn't seem to work well yet is autocompletion/intellisense for more than one object level, e.g.

$someObj->[ctrl-space] - works but

$someObj->anotherOne->[ctrl-space] - yields no suggestions

even though it should be easy for phpstorm to find out about the type of "anotherOne" because earlier in the code there is
$someObj->anotherOne = new whatever(...)

i found a post in the forums that jetbrains gave free licenses to the qcubed developers, so i hope some of the core developers here also ran into the same problem and have a solution :D

alex94040's picture
Offline
Joined: 11/06/2008

I'm using PHPStorm and I absolutely love it.

I actually have not hit the issue you're describing - auto-complete works for me for all levels.

For example, inside a QForm Form_Create() method:

$this->[ctrl-space] - yields a list of all properties of the form
$this->txtMyTextBox->[ctrl-space] - yields a list a properties of the QTextbox class.

Can you give a concrete example that's not working for you?

kon
Offline
Joined: 12/08/2009

Hey Alex

Yes you are right, when i am in a QForm and use $this->txtSomething->[here autocompletion works].

But for example when i use $this->mctSomething->txtSomething->[here it doesn't work].
Or another example when i have a panel with children, then $this->pnlInstance->ctlSomeControl->[here it doesn't work].

I really love phpstorm too and this is the only thing that i couldn't get to work so far.

alex94040's picture
Offline
Joined: 11/06/2008

I'll tell you exactly why QForm-based controls are working and MetaControls are not working for autocomplete :) Ready? :)

Here's my guess: if you do $this->mctMyMetaControl->[generated property - from MetaControlGen class]->[ctrl+Space] - you'll see the auto-complete. For the properties you added to the child meta control, you don't see auto-complete.

It's because QCubed uses magic methods (__get() and __set()). In order for PhpStorm to understand which properties to show through autocomplete, the class that uses magic methods needs to expose them through @property and @var declarations. Look at how the MetaControlGen parent class does it. Here's an example:

@property QFloatTextBox $MonthlyFeeControl
@var Employer objEmployer

These hints in the comments are what allows PhpStorm to show autocomplete. Add those to your hand-written properties and you'll see autocomplete for them.

kon
Offline
Joined: 12/08/2009

Ah, thanks a lot for that information! :)

Offline
Joined: 10/11/2010

I hate this stupidity... Eclipse did not need stupidity. I mean its my code and I know what all variables stand for. Why should an IDE ask for extra favors? I mean there is a $this->lblSome = new QLabel($this) in the same code block. Is PhpStorm code blind or plain stupid? Looks like I have to go back and use Eclipse for this. I am not going to do the '@var' for zillions of variables in all the pages. This is irritating :(