Details
-
Bug
-
Resolution: Done
-
P2: Important
-
Qt Creator 4.7.2, Qt Creator 4.8.0-beta1, Qt Creator 4.8.0-rc1
-
None
-
-
6889f4df80d21b2121eef85cac2a6f58dd946106 (qt-creator/qt-creator/4.8)
Description
Consider the following silly (but functioning) example:
#include <QtCore/QString> #include <iostream> #include <memory> int main(int argc, char const *argv[]) { QString *strPtr = new QString("hello "); QString str("world"); auto smartStrPtr = std::make_unique<QString>("\n"); std::cout << strPtr->toStdString() << str.toStdString() << smartStrPtr->toStdString(); delete strPtr; return 0; }
If the Clang Code Model plugin is enabled, pressing F1 on strPtr or smartStrPtr yields "No documentation available." Pressing F1 on str or any of the occurences of QString opens the help for the QString class. With the Clang Code Model plugin disabled pressing F1 on both strPtr and smartStrPtr works just fine.
This example is contrived, but pressing F1 on e.g. ui->someWidget is very useful if the widget is not well know to you. And there may not be an occurrence of the type in the next nearby:
Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog) { ui->setupUi(this); ui->label->setText("hello"); }
Pressing F1 on label does not provide the help for the QLabel class. But interestingly, I just found out that pressing F1 on setText takes me straight to the help for QLabel's "text" property. I can probably use this trick.
Following these instructions I got the following diagnostics for the last two cases mentioned:
[2908] qtc.clangcodemodel.ipc: >>> RequestToolTipMessage(FileContainer(C:/Users/osse/dev/stats/dialog.cpp, Utf8StringVector(), Utf8StringVector(), 1, UTF-8), 1, 9, 10, ) [2908] qtc.clangcodemodel.hover: Requesting tooltip info at 155 [2908] qtc.clangcodemodel.ipc: <==== ToolTipMessage QLabel * [2908] qtc.clangcodemodel.hover: Processing tooltip info "QLabel *" [2908] qtc.clangcodemodel.hover: Querying help manager with "Ui_Dialog::label" "" Unknown [2908] qtc.clangcodemodel.hover: Querying help manager with "label" "" Unknown [2908] QTextBrowser: No document for about:blank [2908] qtc.clangcodemodel.ipc: ====> DocumentVisibilityChangedMessage(, )
[2908] qtc.clangcodemodel.ipc: ====> DocumentVisibilityChangedMessage(C:/Users/osse/dev/stats/dialog.cpp, C:/Users/osse/dev/stats/dialog.cpp, ) [2908] qtc.clangcodemodel.ipc: ====> RequestReferencesMessage(FileContainer(C:/Users/osse/dev/stats/dialog.cpp, Utf8StringVector(), Utf8StringVector(), 1, ), 2, 9, 16, false, ) [2908] qtc.clangcodemodel.ipc: <==== ReferencesMessage with 1 references [2908] qtc.clangcodemodel.ipc: >>> RequestToolTipMessage(FileContainer(C:/Users/osse/dev/stats/dialog.cpp, Utf8StringVector(), Utf8StringVector(), 1, UTF-8), 2, 9, 17, ) [2908] qtc.clangcodemodel.hover: Requesting tooltip info at 162 [2908] qtc.clangcodemodel.ipc: <==== ToolTipMessage void QLabel::setText(const QString &) [2908] qtc.clangcodemodel.hover: Processing tooltip info "void QLabel::setText(const QString &)" [2908] qtc.clangcodemodel.hover: Querying help manager with "QLabel::setText" "setText(const QString &)" Function [2908] qtc.clangcodemodel.hover: Match! [2908] qtc.clangcodemodel.ipc: ====> DocumentVisibilityChangedMessage(, )