Unsolved Widget Applications
-
I think I do not have an option to create such a project using my Qt Creator!
-
@tomy Well you can modify the project file it creates for you to include that stuff.
But in Creator I'm sure there's an option for a QtQuick/QML project. That is the one you want.
But you could literally create any project and add those things.
You could even go into your terminal (linux/osx) and do this:
mkdir mynewproject cd mynewproject touch main.cpp qmake -project
That would make your project for you, then just edit the mynewproject.pro file and add the QT line from my post above.
But again I'm sure there are projects in Creator that will match what you want.
-
Unfortunately I don't use a Linux! (But I will chat with you :-))
And I think I should create a project like this in the Qt Creator IDE:
File ‣ New File or Project ‣ Qt Quick Project ‣ Qt Quick UI
and then modify the.qml
file and paste that snipped-code.
(But I also have doubts on that way!!) -
@tomy No worries, you can do this in windows as well with this in a command shell:
mkdir project cd project echo "" > main.cpp qmake -project
This requires you have your qt bin dir in your path though. And like above it will generate the project file in this case
project.pro
that you can edit and add the QT += line from above. -
@tomy said in Widget Applications:
I think I should create a project like this in the Qt Creator IDE:
File ‣ New File or Project ‣ Qt Quick Project ‣ Qt Quick UI
and then modify the.qml
file and paste that snipped-code.If you want to follow the "Widget Application" part of the tutorial (sections 2.3.2 to 2.3.3), then the most suitable option for you is File -> New File or Project... -> Application -> Qt Widgets Application. You don't need anything related to Qt Quick or QML.
Note: This tutorial looks old, from Qt 4. You will need to replace
#include <QtGui>
with#include <QtWidgets>
for Qt 5. -
If you want to follow the "Widget Application" part of the tutorial (sections 2.3.2 to 2.3.3), then the most suitable option for you is File -> New File or Project... -> Application -> Qt Widgets Application.
Hi,
Thanks for addressing all the part not only that only one. And I created one like you said named "widget_1" and changed nothing but the main.cpp like below:
An error!You don't need anything related to Qt Quick or QML.
I, too, think that this part of the book is recalling the reader the basics of Qt yet.
Note: This tutorial looks old, from Qt 4. You will need to replace
#include <QtGui>
with#include <QtWidgets>
for Qt 5.It, as says,is of 2013!
-
Hi,
Where's
CustomWidget
declared ?It usually means that you are missing
#include "customwidget.h"
.However from your screen shot, it looks like you have no sources matching that widget i.e. no header nor cpp file.
-
Hi,
A simple answer that solves all issues: How do you run the code written in section 2.3.2. Widget Application? (I was trying to run that example).
-
-
@tomy
in the tutorial, it write aCustomWidget
in another file, so you have to write all the files it provide and then run the program.so you need a main.cpp, customwidget.h, customwidget.cpp. in main.cpp and customwidget.cpp, you need to include customwidget.h.
-
I think we had this before :-P
StefenStrange: Warnings come after the instructions
In your case the following paragraphs describe the
CustomWidget
class refered to in the main cpp.You'll have to add a new cpp+ class in the Creator and include it in the main.cpp with
#include "customwidget.h"
then the compiler should find the type specifier -
@tomy said in Widget Applications:
It, as says,is of 2013!
@tomy said in Widget Applications:
A simple answer that solves all issues: How do you run the code written in section 2.3.2. Widget Application? (I was trying to run that example).
Actually... now that I look more closely at Section 2.3.2, I realized that it is a poorly-written tutorial. It has missing parts and it doesn't explain the code in detail. I don't recommend it for beginners.
Follow this tutorial instead: http://doc.qt.io/qt-5/gettingstartedqt.html
-
Actually... now that I look more closely at Section 2.3.2, I realized that it is a poorly-written tutorial. It has missing parts and it doesn't explain the code in detail. I don't recommend it for beginners.
Ow, Thank God, finally someone believed me. Thank you so much. Again and again.
Follow this tutorial instead: http://doc.qt.io/qt-5/gettingstartedqt.html
I can't do that! That is, for Qt, I've decided to learn and follow a book, sorry.
And for QML, again a book, that one. But as you, too, agree, it's not well written (especially for a learner of QML) and I may face difficulties that I hope cope with them by both my hard-working plus your help.
Thanks.