PDA

View Full Version : Explaining the Tooltips lingo



Akiva
1st September 2013, 12:06
Only about half the time are tooltips all that helpful to me, only because I don't understand exactly what context they are using the terms in. For example, when typing, "button->setIcon..." a tooltip pops up and shows, "QIcon(const Qstring &fileName) "

I get that they want me to use a string, and list a fileName, but I don't know what the const function has to do with all this. Is it saying that I can't put a variable in there? Or that whatever I put in there will be turned into a constant? Or is it saying I have to put a const before the qstring? What about the &? Does this mean I need a namespace for the filename?

Santosh Reddy
1st September 2013, 12:46
All the questions you have are related to C++ basics, please take time to read more about these concepts

const-correctness (http://en.wikipedia.org/wiki/Const-correctness)
Reference (C++) (http://en.wikipedia.org/wiki/Reference_(C%2B%2B))

Akiva
1st September 2013, 21:00
All the questions you have are related to C++ basics, please take time to read more about these concepts

const-correctness (http://en.wikipedia.org/wiki/Const-correctness)
Reference (C++) (http://en.wikipedia.org/wiki/Reference_(C%2B%2B))

Huh... These types of answers are a) indirect, b) useless.

"Hey I have a specific question about how this term. Ive learned about it, and what it does normally in C++ but I just want to figure out what its doing in a tool-tip."

"RTFM; your question has nothing to do with QT because it references the language QT is built upon. What do you think this is? A newbie area to ask newbie questions? Here is an encyclopedia; read that; you'll just have to assume that you will be able to guess the answer to your question by the time you are done reading that, despite the fact that QT or Tooltips is not brought up in either of the articles. Your welcome!"

ChrisW67
1st September 2013, 21:32
The tooltip that your unspecified IDE is presenting is a context-sensitive aid to what should come next. Sometimes it will be the completion of a partly typed name of a C++ class, object, function or variable, and sometimes it will the prototype for a parameter to a function ( or a list of them). The interpretation of a parameter prototype is entirely to do with C++ and not specific to Qt.

In your example the tooltip is the telling you the prototype for constructing a QIcon object. One of the constructors (there is often more than one option) accepts a constant reference to a QString. The concepts of const and reference are both generic C++. The meaning of the QString to the QIcon constructor is specific to Qt and can be found in Assistant.