Solved QT Creator cannot find <Qdialog> in Windows 10
-
Hi,
It's not
CONFIG
butQT += widgets
that your need.As for the code format it's three backticks, start a new line, then again three backticks on a new line.
-
Thanks for the reply. Lets try the code makers with:
x = y;
Ok, I got that thank you.
-
@jsulm Re If you don't need UWP then please install Qt for the regular Microsoft C++ compiler and try again using the new Kit.
I have installed twice now. It cannot find one or more files. Why would a reduced install make the files easier to find. I have searched a bit and not found anything that describes the purpose of each install option. Does anyone have a link for that information.
testing for quoted text.
Works well, thanks JKSH, will try the other items tomorrow. -
@BKBK said in QT Creator cannot find <Qdialog> in Windows 10:
QT += quick
Change that line into
QT += widgets quick
.(And just to double check: Are you using Qt Quick? If not, then
QT += widgets
is enough)@BKBK said in QT Creator cannot find <Qdialog> in Windows 10:
please advise me of the character strings that will identify quotes and code causing them to be more obvious in our posts.
For quotes, put
>
on the left of your text. -
I am not using Qt Quick, just trying to get the first simple app running.
-
So can you show your .pro file?
-
Here is the pro file. I have added a few lines at the top but otherwise unchanged from the auto-generated file. Most comments removed for brevity.
QT += quick CONFIG += c++11 CONFIG += GUI WIDGETS QT += core gui QT += widgets DEFINES += QT_DEPRECATED_WARNINGS Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ finddialog.cpp RESOURCES += qml.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Additional import path used to resolve QML modules just for Qt Quick Designer QML_DESIGNER_IMPORT_PATH = # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target
I am using QT Creator 4.8.0-rc1 (4.7.84) based on Qt 5.12.0
It is behaving a bit strange. I can manually open the .h file, but it won't stay open in the explorer panel. This is my first attempt with QT Creator. Is that normal?
The code I am using is right out of the book. -
@BKBK Is there a reason why you're using a release candidate and not a stable version?
-
@BKBK said in QT Creator cannot find <Qdialog> in Windows 10:
Here is the pro file. I have added a few lines at the top but otherwise unchanged from the auto-generated file.
Since you are using Qt Widgets and not Qt Quick, I suggest starting from scratch and creating a new project altogether: File > New File or Project... > Application > Qt Widgets Application
Also, when selecting a Kit, pick a "desktop" kit (MSVC or MinGW), not a "mobile" kit (UWP/WinRT or Android)
This should let you find QDialog out-of-the-box, without needing you to mess around with the .pro file.
I am using QT Creator 4.8.0-rc1 (4.7.84) based on Qt 5.12.0
Note: Qt Creator 4.8.0 has not been released yet. This is a preview version.
It should work fine, but it's best to stick to official releases when you're starting out.
-
Just FYI, Qt 5.12 and Qt Creator 4.8 have been released today :-)
-
@SGaist said in QT Creator cannot find <Qdialog> in Windows 10:
Just FYI, Qt 5.12 and Qt Creator 4.8 have been released today :-)
Time to upgrade! :D
-
replying to several posts at once:
From the QT web site I picked the latest release. There was nothing there to indicate that it was beta or anything other than a stable release.
Ok, so I need to install for the third time.
Questions:
Which release should I install?
When items should be and should not be installed? I wish to build applications for Windows 10. I have Visual Studio 2017 installed.
Should I use Visual Studio or some app within the QT environment to build my app?If at some time in the future I wish to rebuild the app for android, how difficult will that be? What will I need to add?
-
@BKBK said in QT Creator cannot find <Qdialog> in Windows 10:
replying to several posts at once:
From the QT web site I picked the latest release. There was nothing there to indicate that it was beta or anything other than a stable release.This sounds like a deficiency in the website; all pre-release builds need to be clearly labelled.
Can you post the link to the page where you picked the latest release? (Note: Qt 5.12 and Qt Creator 4.8 have just been released, so they are now official)
EDIT: I just had a thought: Did you select Preview > Qt Creator 4.8.0-rc1 from the installer? That might have been why you got a preview version. FYI, "RC" stands for "Release Candidate"
Which release should I install?
When items should be and should not be installed? I wish to build applications for Windows 10. I have Visual Studio 2017 installed.
Should I use Visual Studio or some app within the QT environment to build my app?See https://1drv.ms/w/s!AnaQjhA33g0K0lkIZPVjfsWrcPSI for a fully detailed walkthrough. (If you have time, I would be grateful if you provide feedback on what's helpful and what's unclear in the document)
In summary:
- Use the Online installer.
- Install Qt > Qt 5.12.0 > MSVC 2017 32-bit
- Since you already have Visual Studio 2017, this is the only thing you need.
- You can choose MSVC 2017 64-bit instead, if you prefer.
- Qt Creator, the IDE, is automatically installed; you don't need to select it.
- Use Qt Creator to build your app.
In Qt Creator, select File > New File or Project... > Application > Qt Widgets Application to create your first project.
If at some time in the future I wish to rebuild the app for android, how difficult will that be? What will I need to add?
When that time comes,
- Run MaintenanceTool.exe from the root folder where you installed Qt
- Select Add/Remove Components
- Select Qt > Qt 5.12.0 > Android _____
You will also need to separately install the Android development tools from Google. See https://doc.qt.io/qt-5/android-getting-started.html for details.
-
@JKSH said in QT Creator cannot find <Qdialog> in Windows 10:
See https://1drv.ms/w/s!AnaQjhA33g0K0lkIZPVjfsWrcPSI for a fully detailed walkthrough. (If you have time, I would be grateful if you provide feedback on what's helpful and what's unclear in the document)
I detected my first error. When I saw the Preview option in the installed dialogs I presumed it meant to preview what I am about to install. After making that correction the install was much faster.
Some comments.As I follow the Get Started thread of the creator I want the ability to separate that text and guidance from the creator so I can see it while I create the project. One on each monitor.
When selecting the components, please shown the total amount of data to be downloaded for each.
I am working it now but wanted to post before I spend considerable time in getting the first project running.
So far, so good.
Thanks for your details. -
The install has been completed. Worked through a few menus and a few referenced web pages and found the example code for basic layouts. The project directory is here:
C:\QT5\Examples\Qt-5.12.0\widgets\layouts\basiclayouts
This line is flagged
#include <QApplication>
And the error QApplication not found.
I surmise there is a fundamental setup step to perform that I missed. Please advise me of where to find it. -
I would do a search in the Qt installation to ensure that the file is there (and it should).
-
Yes, it exists, here: "C:\QT5\5.12.0\msvc2017_64\include\QtWidgets\QApplication"
After looking around the menu's for Qt Creator I don't see anything to indicate that the paths should be entered there for all projects. A right click on the project in the project explorer (the left panel of Creator) brings up a dialog that leads to a dialog to Add Library. When the path is pasted in the Next button remains disabled. Only the Cancel is enabled. That screen capture has been uploaded.
When Visual Studio was installed, several times and multiple versions over the years, it never required the user to find all the libraries such as <iostream.h> and specifically tell VS where to find them. I do expect the same of Qt.
edit: the point of the image is, in part: The dialog will not allow any editing in field Library:, field Include path contains a path, yet button Next is disabled. Please provide some information as to why the Next button is disabled. -
@BKBK Did you already build the project or was it just the inline error from the code model that showed up? I have seen that too a couple of times before the project was build first.
-
That was from the first attempt. The first project has yet to be built.
-
@BKBK said in QT Creator cannot find <Qdialog> in Windows 10:
The install has been completed. Worked through a few menus and a few referenced web pages and found the example code for basic layouts. The project directory is here:
C:\QT5\Examples\Qt-5.12.0\widgets\layouts\basiclayouts
This line is flagged
#include <QApplication>
And the error QApplication not found.
I surmise there is a fundamental setup step to perform that I missed. Please advise me of where to find it.Please post screenshots of:
- The screen which shows you the "QApplication not found" message
- Tools > Options... > Kits > Kits
- Tools > Options... > Kits > Qt Versions
@BKBK said in QT Creator cannot find <Qdialog> in Windows 10:
As I follow the Get Started thread of the creator I want the ability to separate that text and guidance from the creator so I can see it while I create the project. One on each monitor.
Try the Window > Open in New Window menu item
When selecting the components, please shown the total amount of data to be downloaded for each.
It does, doesn't it? The 2nd screenshot at https://1drv.ms/w/s!AnaQjhA33g0K0lkIZPVjfsWrcPSI shows:
Qt 5.11.0 Prebuilt Components for MinGW 5.3.0 32-bit
This component will occupy approximately 3.64 GB on your hard disk drive.
edit: the point of the image is, in part: The dialog will not allow any editing in field Library:, field Include path contains a path, yet button Next is disabled. Please provide some information as to why the Next button is disabled.
This dialog is for adding 3rd-party libraries. Most Qt applications don't need it.
For now, let's focus on your main issue (the inability to build example projects) -- please provide the screenshots requested above. I'll answer your questions about the Add Library dialog after that's resolved.