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. 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 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 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.
-
There is something, make that, there are a few things that are probably here but I am missing. This is a weekend and most developers have better things to do so I am going to split this into two threads.
First, I answer the immediate questions posed about why Creator will not build the example project.
After posting that, I have a suspicion that it might not like installing in directory QT5 rathner than just QT so I will uninstall and perform the same install to the true default directory C:\QT.
To the first part, I am not able to build the example program. Here are the steps.
Note that I was ready to change virus detection app to Bit Defender and currently have no protection application installed.- Start QT Creator, click Example, scroll down to what looks like the most simple example, Basic Layouts and click it. A new window is opened
Side note: I must capture each image again and save it to a file to insert here.
The goal is to simply run an example so click Running the Example
From the dialog, …open the Welcome mode …
That is how I arrived here, circular, but understandable.
Click Building and Running an Example and am rewarded with web page: http://doc.qt.io/qtcreator/creator-build-example-application.html
It starts over. Repeat steps 1 and 2.
This time the code is displayed, the main app.
The first line if code is flagged as an error. It’s a mouse hover display so the display cannot be captured.
Look across the bottom to see what is in the various items there. Compile Output is empty.
General Messages contains this text:Running Windows Runtime device detection.
No winrtrunner.exe found.
Could not find qmake spec 'default'.
Error while parsing file C:\QT5\Examples\Qt->5.12.0\widgets\layouts\basiclayouts\basiclayouts.pro. Giving up.The others are empty except search results which is a blank search form.
Return to the web page for step 3:
…, click the Kit Selector and select a kit for the device.
After checking all the menu items the best fit is: Build -> Open Build and Run Kit Selector
Click that to be rewarded with a popup in the lower left corner. When the snipping tool is clicked the popup closes prohibiting capture. The text is:The project basiclayouts is not yet configured.
You can configure it in the Projects ModeClick that link: Projects Mode to get here:
In the main panel: Configure Project, as a novice Creator users, I don’t know what to enter in the field: Type to filter kits by name.
Try the top down Import Build from to get the path
C:\QT5\Examples\Qt-5.12.0\widgets\layouts
Click the wide pushbutton Import. No response. The button Configure Project is disabled.
Go to the left panel and select Manage Kits and the reward is the Options dialog.This novice is quite unsure of what to do.
As the basic path is to configure kits, go that way.
The Auto-detected looks good. The down arrow only closes it.
There are two options available: the Add button and the OK button.
I presume ( I presume you understand the word presume, grin.) the dialog is correctly configured and select OK.
The window closes with no apparent action taken.I presume, but only because there is little other choice, that the proper activity was completed. I do suspect that is not the case.
Next step is a guess. The dialog to Manage Kits was taken and apparently completed so click Build.
The only option enabled is:
Build -> Open Build and Run Kit SelectorThat is circular. That’s enough here. This will require quite a bit of time to edit into a response.
I stop here to uninstall and re-install with the default location unchanged.
Should I back up to a previous version or use the same version. I suspect that the previous version has a higher probability of success, but that is changing two variables in one step. I will stay with the latest version. -
@BKBK said in QT Creator cannot find <Qdialog> in Windows 10:
The key is this: "No valid kits found".
We need to find out what's missing in your kits configuration.
- Click on Desktop Qt 5.12.0 MSVC2017 64-bit in your screenshot to reveal the detailed properties. Post a screenshot.
- Mouse-over the 2 yellow exclamation marks in your screenshot. Post the exact pop-up messages.
- Post a screenshot of the Qt versions tab.
-
OK, root cause found: https://forum.qt.io/topic/97455/qt-install-fourth-attempt
Qt Creator needs to find your installation of MSVC 2017.
Let's continue the discussion in the other thread. I'm locking this one to help focus on troubleshooting.