Solved General questions about Model in Qt (docs)
-
@Xilit said in General questions about Model in Qt (docs):
- If I press F2 to name of class (for example QStringListModel) I go to header file. But where is cpp-files to see the impementation of it?
If you checked "Sources" during installation of Qt (in Qt installer) you should be able to go to the .cpp file after pressing F4.
But if you don't have Qt sources, then there is actually no .cpp file so Qt Creator cannot show it.
You can always look the file up, for example in Woboq code browser or by downloading Qt source code manually.
- Also I'd like to find out what is Qt-class is? I mean Qt::green or Qt::TextFormat? When you type Qt:: you have huge list of autocomplite. Is this superglobal class?
It's a namespace. See the docs.
-
Thank you!
That's strange. I've checked "Sources" during installation of Qt but after pressing F4 nothing happend. For exmple I created in my project
QAbstractItemModel *model;
, put cursor onQAbstractItemModel
and press F2 --> go to header (qabstractitemmodel.h
). And after pressing F4 nothing happened. Did I made something wrong?"It's a namespace. See the docs."
Got it. Thank you!
-
@Xilit said in General questions about Model in Qt (docs):
Thank you!
That's strange. I've checked "Sources" during installation of Qt but after pressing F4 nothing happend. For exmple I created in my project
QAbstractItemModel *model;
, put cursor onQAbstractItemModel
and press F2 --> go to header (qabstractitemmodel.h
). And after pressing F4 nothing happened. Did I made something wrong?Perhaps it does not work nowadays. Last time I tried this was a long time ago.
"It's a namespace. See the docs."
Got it. Thank you!
-
-
@Xilit said in General questions about Model in Qt (docs):
That's strange. I've checked "Sources" during installation of Qt but after pressing F4 nothing happend. For exmple I created in my projectQAbstractItemModel *model;, put cursor on QAbstractItemModel and press F2 --> go to header (qabstractitemmodel.h). And after pressing F4 nothing happened. Did I made something wrong?
I'm pretty sure, you have to add the path manually in the settings of QtCreator.
Settings -> Debugger -> General -> Add QtSources -
-
@Xilit More or less, on the right side you can click on
Add Qt sources
that opens a QFileDialog, where you select the QtSource folder you downloaded.
After accepting, QtC should set up everything on its own! -
-
@Xilit Did you use "Add Qt sources..." button to add Qt sources?
-
Yes, I did. I think I pressed just Add instead of Add Qt sources. Now it's look like:
But when I press F4 in header file (qabstractitemmodel.h) nothing happens. It still don't want to show me cpp file.