Solved Autocomplete
-
@Ian-Bray, @mrjj
I don't use Qt Creator, but I do use auto-completers in other IDEs, which I assume work similarly.
I still don't get just what either of you are expecting to happen? When it comes to the available parameters/overloads to a function call, the completers cannot know what you want to actually pass. The overloads they show you are purely for your information, so you can see what the number & types of arguments are. You do not "pick" anything at this point, and it does not "fill in" anything at this point either. You type in whatever you want to pass (which itself will give autocomplete, but nothing to do with the function declaration), and sometimes they recognise purely by number of parameters which overload you are selecting as you type the comma at the end of each parameter. They often mark what they think the parameter is that you have reached by highlighting that in bold in the list of parameters. If what you are expecting is that it will paste the formal parameters into the call, they don't, what would be the point? That's it for auto-complete! In my experience.
-
@JonB
Well it sounds like poster can make it fill in
parameters even i never seen it or can make it do it.
As my first post indicates im also very skeptical about completion on the parameters but
it sounds like poster can make it do it some types so hence im still trying. -
@mrjj
I don't follow you. Neither of his 2 screenshots show any "filling in", they show possible parameters in a "pop-up tooltip", like I said that's all?If you think about it, what (I think) you/he are asking is, in that example, for it to offer every single literal/variable/function retuning type
QMargins
. It won't do this. Plus, you could have an unknown number of objects etc. which happen to have a member or function of typeQMargins
too. so it would have to offer every object which "might lead to" aQMargins
as the start of the completion. It won't do that either! -
@JonB
There is no picture of poster's idea of auto filled parameters.
So either poster want something that is impossible or
something i dont understand/have seen.like ". It doesn't autocomplete like "connect" for instance."
i cant connect to auto complete in any way.
-
@mrjj
Like I said, that's because the parameters are not supposed to be "auto-completable", they are there only as a "tooltip" to help you understand the types/overloads available, not as a "picker"/"paster"! -
@mrjj
QObject::connect
has indeed an autocomplete functionRight after the class Reference (Qt5 Syntax)
MyClass::
and right after the signal or slot macro(Qt4 Syntax)QT4Syntax actually fills in the argument Types
-
@J.Hilk
ah, in that way. well i didnt think of it as parameters filling. just suggestion for context as it can do anywhere.
Ok, that concludes the post :)
Not possible. -
@JonB
Hi, Yes im fully aware of that but poster had completion working (he said)
Just trying to determine what poster saw.
And i fully agree, auto filling of parameters sounded really fishy :) -
@mrjj Crikey.
I want to type for instance ProgressBar::paintEvent(QPaintEvent *event)
I type Prog autocomplete pops up, I hit return yay ProgressBar
Then I type :: and autocomplete kicks in again, I make my selection and hit return Now I have
ProgressBar::paintEvent. and the Parameter List is offered in a little floating box. and ctrl+spacebar inserts it.Now I have ProgressBar::paintEvent(QPaintEvent *event)
Didn't mean to start a fire or anything!
-
@Ian-Bray
Oh, no fires here. Just a bit confusion :)
Now i understand.
There you select a member and yes then it inserts the complete signature ( meaning with the parameters)
as it can see how it should be from the .h file.How ever when shows
It shows possible parameters and u must type variable names as its a function callAs far as i know, there is no key to have it paste the signature in such cases. :(
But you can press F2 on the method name to go there and then copy the signature. -
If I type QColor and then a semi-colon "("
I get a menu popup with 11 options. Using the up/down keys I scroll to number 3 and hit return to insert, but the carriage returns and ctrl + spacebar just resets it to the first option.
-
@Ian-Bray
Hmm, you should get what u select in drop-down. sounds odd.
Like this ?
-
@mrjj No QColor(
-
@Ian-Bray
Like
You cannot make it paste that into editor. (in this case, QRgb64 rgba64)
-
@mrjj Yes. I know. I was wondering if there was an exotic keystroke to insert it. See my first post!!
Tell them to fix it so it does insert! :-) I hold Q_PROPERTY up as an example.Especially connect()
-
@Ian-Bray
Hi
You are the first ever to ask for that.
Can i ask why you want that text since it just lists possible parameters?
You would have to replace it with a variable anyways ?For connect you want it to paste something lie
?Would be like
connect( const typename QtPrivate::FunctionPointer<Func1>::Object *sender, Func1 signal, const QObject *context, Func2 slot,Qt::ConnectionType type = Qt::AutoConnection)
Im not sure i understand why :) -
@mrjj What I would do is insert it, and comment it out, and use it as a guide for my own connect or if it was close I'd just edit the necessary bits.
-
@Ian-Bray
ok, i see :)
You can open a request on https://bugreports.qt.io/
and if enough people vote for it, they might create such feature.In the mean time, you can
ctrl+alt+left click the connect and
it opens a split view where you can copy from. -
@mrjj No, I wouldn't consider it a bug as such. It would be a convenience, that's all. I'm still learning Qt and I'm amazed by the hidden stuff. Click inside a class definition say - class myclass : public qobject {} and hit ctrl+spacebar and it throws up all the functions from the inherited class, I only found that recently. Or type "class" and hit ctrl+spacebar gives you a menu, which autocompletes a class from QObject or QWidget.
If all things were treated equally.
-
@Ian-Bray
Oh, not. its not that way. One can also report feature wishes there.
Its perfectly normal.There are many hidden features. Tons in right click and Refactor menu. depends on where u stand.
If it shows a little yellow lamp when you change parameters, press alt + enter to apply same change to the .h file ( or cpp if in .h)