What is a good QT C++ test or challenge for a QT newbie?
-
I'm trying to learn QT C++. I know C++ well.
I want to do a simple but good project to prove that I know how to use QT and can do some of the basics.
Any ideas for a project to work on?
I'm doing this to get jobs with QT, so I guess "projects that a interviewer would want to see" would be a good start???
-
@sporefan said in What is a good QT C++ test or challenge for a QT newbie?:
QT C++
There is no such thing. Qt is a C++ framework, not a C++ modification.
Interviewer usually want to see your skills, not projects. Of course you can point to some projects you were working on, but more important are your skills. So, I would say any Qt project where you can learn Qt is a good project. There are also many different parts in Qt, like widgets, QML, multi threading, networking and so on. So, you can think about a project where many Qt modules can be used. -
@jsulm well I think of it as QT C++ because it won't compile just with any c++ compiler, it needs the QT compiler. and its doing everything different.
Anyhow I think I need a project to learn QT from, so I still need to make a project. Or a few even!
Maybe I can try porting a few simple programs I already made? Seems like a good idea.
-
@sporefan said in What is a good QT C++ test or challenge for a QT newbie?:
it needs the QT compiler
What is Qt compiler?
"and its doing everything different" - for example?
Again: Qt is just a C++ framework. Many C++ compilers can be used with Qt. There is no "Qt compiler". You should first get this right before going to an interviewer.
-
-
@sporefan
Hi
To be exact the moc is not a c++ extension but a standalone tool.Most modern compilers can build Qt and you can hook up the uic and moc tools to most toolchains to have them run as part of the building.
The signal and slot keywords are just macros using common compiler tech to work
#ifdef slots # define slots __attribute__((annotate("qt_slot"))) #endif
So there is no Qt compiler. Qt is using a plain c++ compiler and some helper tools to make it all work.
But yes Qt'ws use of extra processing tools makes it less pure c++ than other libs but In my book
it's all worth it. -
@sporefan I'm not sure whether you're joking? If you are so sure there is "Qt compiler" can you point me to it? Where can I find it? How do you explain that on Linux g++ is used as compiler for Qt projects and on Windows MinGW (Windows port of g++) or Microsoft C++ compiler?
signals and slots are not keywords, they are simple C macros.
MOC is code generator (generates C++ code). -
@jsulm to be fair to @sporefan , wether sporefan knows this or not, MOC is the acronym for Meta-Object Compiler even so no actual/techincal compiling is done
also QtCreator does make the Qt macros look like c++ Keywords which is bad design IMHO
-
@J-Hilk Yes that is true. I know that QT uses other C++ compilers, but its doing a lot of stuff ontop.
Also if you dig into some of the files, you can find this in qtmetamacros.h
// The following macros are our "extensions" to C++
// They are used, strictly speaking, only by the moc.They are saying that they have extended C++. So its not really C++ anymore. Its a variant. QT variant. That is simply going with their own language. Their own Words.
Their own words are an admission that they have extended C++.
-
@sporefan said in What is a good QT C++ test or challenge for a QT newbie?:
They are saying that they have extended C++. So its not really C++ anymore.
No it's not/they haven't. There is a reason they write
"extensions"
with the double quotes around it, it's because they aren't extensions to the C++ language. What mechanism do you think C++ has to allow itself to be "extended"?They also tell you what they add: some macros. Defining macros is done somewhere by the vast majority of C/C++ programs, it does not make them not, or their own, C/C++. It's some macros. And some templates.
You say " I know C++ well" so it would be nice if you explained. And if you do know C++ well you would recognise that Qt is not a compiler, nor a language. Qt tells you what standard C++ compilers you can choose from to work with it, and that is the compiler/linker toolchain you user.
If you want to learn about Qt, as a newbie, it would be good if you opened your mind to explanations about how things about Qt are, rather than telling people trying to answer they are incorrect. That's what I found when I was beginning anyway.
-
@JonB " What mechanism do you think C++ has to allow itself to be "extended"
I explained already. It is the MOC.
No need to be angry if your opinion differs from someone else's. Its a good idea to relax and let people feel differently about things. But I can't control or stop you from getting angry... you the only one who can do that and you might not want to change.
So its best I just leave this conversation.
BTW if you are in the mood for learning... you can learn about the concept of transcompilation.
This is where a programming language is made that "compiles" itself into another language. Normally into C++. Almost all compilers start as transcompilers actually!
So QT is kind of a transcompiler, via the MOC.
-
@sporefan said in What is a good QT C++ test or challenge for a QT newbie?:
I know C++ well.
Based on your comments below that, I have doubts :)
If you would know C++ "well", you would know how C++ projects are made nowadays. There are a lot of external libs and other things, that you might need/want to include.
Stuff like Boost, or even "add-ons" like Qt to create GUIs in C++ (Modules of Qt actually provide waaay more than just "a GUI").
Anyway, adding stuff to your C++ project (or "on top" of that) doesn't make your project language "Boost C++" or "Qt C++"MOC, UIC, QMake and other things mentioned here are tools to make Qt work as it works now.
But I can't control or stop you from getting angry
I think nobody is "angry", but, no offense, you said a lot of nonsense after claiming to "know C++ well".
I want to do a simple but good project to prove that I know how to use QT and can do some of the basics.
And to answer your initial question. There are many things you can do.
- Just try the Qt examples and play around with them. Every module has at least one example dealing with the topic and demostrating how it works and how you can use/include the basic steps in your project (e.g. Network examples, Bluetooth examples and so on...)
- Have a look at the Qt documentation, which is actually very great and helpful
- Think about it yourself... Implement some ideas of yours. Do whatever you like.
That's how most of us learned Qt.
If you get stuck -> Qt doc -> research -> ask questions
(in that order, ideally)
-
Hi,
@sporefan said in What is a good QT C++ test or challenge for a QT newbie?:
So QT is kind of a transcompiler, via the MOC.
Nope, despite the acronym, there's no transpilation happening here.
moc
is in fact a code generator. It parse your QObject based classes and generates additional C++ code to make things work. You can see for yourself by opening the corresponding files.Also,
moc
is not used unless you create QObject derived classes.Even more, you can completely remove moc if you use the verdigris project.
-
Wow, what a bunch of gatekeeping comments, let's focus on the actual question maybe?
A good one that I'm trying out myself right now is to build my own graphing program. You can get used to building a small user interface with widget controls for adjusting parameters of the graph -- axis ranges, graph margins, axis labels, data color, etc. You can have it load data in from a file, and you'll have to figure out how to implement drawing the data points to the graph window, draw the axis, handle window resizing, etc. You can take this as far as you want, and even include mouse events that highlight the data you're hovering over and display the data value, etc.
Overall, it gets you working with a lot of the basic Qt functionality, learning signals and slots, QEvents, QPainter, etc. I've found it very instructive.
-
@sporefan perhaps make your pure C++ projects again but with Qt this time, you already have those ideas which should be quite advanced (considering your own estimation of your C++ skills), and even better, see if Qt offers a way to make them better, or add more features to them, don't start fresh, build from what you already made with pure C++.