Opening projects and getting started
-
@JonB said in Opening projects and getting started:
The question has not been answered. I wrote down the steps one line at a time, posted, and that post was essentially ignored.
After the project is initially created, what steps are needed to use Qt Creator facilities and create the new file quadratic.ui? The dialog is to be such that standard controls, push buttons, text edits, etc, can be dragged and dropped onto it and used in the code.I have searched and have not found the solution. If someone can provide a better search phrase I will use it.
-
@Bryan-Kelly said in Opening projects and getting started:
Qt Creator facilities and create the new file quadratic.ui? The dialog is to be such that standard controls, push buttons, text edits, etc, can be dragged and dropped onto it and used in the code.
Maybe rephrase the above.
In general, forums and this one is no exception, posts gets boggled down in (personal views) , expressions and terminology.You can build application using main window.
You can the add a dialog to it.You can "drag and drop " widget ( user interlace "object" )
into the dialogue DURING construction / coding using the dialog_X.ui file- utilizing QtDesigner tool.This is the way I read / interpret your post
you want the user to be able to "drag and drop" such widget ( from where he get is ?) during RUN TIME.
Is that correct (assumption) ?
-
@AnneRanch said in Opening projects and getting started:
You can the add a dialog to it.
And that is the key phrase.
What are the steps to add the dialog? Let's call the dialog quadratic. To clarify, after adding the dialog I am "expecting" that within "Header Files" there will be the file: quadratic.h Within Source files there will be quadratic.cpp and quadratic.ui (Those names seem logical to me and the exact name is not a requirement.)
When file quadratic.ui is opened for editing, I can drag controls into it, such as push button and line edit. the behavior should be the same as what I find for mainwindow.ui.
This is all during application construction time, not during run time. Then I can add buttons in mainwindow.cpp so that during run time I can open the new dialog and populate fields within the dialog, using appropriate procedures of course.
That one step, adding the dialog, is now the heart of this thread.
-
@Bryan-Kelly said in Opening projects and getting started:
I wrote down the steps one line at a time, posted, and that post was essentially ignored.
And you was told several times already what you need to select to create a dialog (File->New File->Qt->Qt Designer Form Class), instead you wrote:
File -> New File -> C/C++ -> C++ Class -> Choose
As already explained here - this creates a plain C++ class, not a widget/dialog. Why don't you follow advises?
-
@Bryan-Kelly said in Opening projects and getting started:
The question has not been answered. I wrote down the steps one line at a time, posted, and that post was essentially ignored.
You wrote your steps. Far from ignoring you I actually quoted from your own steps, verbatim:
a. File -> New File -> C/C++ -> C++ Class -> Choose
b. In dialog C++ Class, Name it.
See that in the steps you wrote? So how come I quoted your step and what you needed to correct it if I was ignoring you? And then I told you this is wrong. I quoted from @sierdzio who wrote you need to pick:
File->New File->Qt->Qt Designer Form Class.
I also suggested if you go into Creator's help at this point I would have though it would explain the various new item choices available from File -> New File -> C/C++. So you would know which one to pick:
Pick the right new item type to add to the project. Not a plain C++ class, rather a Qt widget.
So, instead of saying your post/question has been ignored why don't you actually follow or respond to my responses? It is simply you who are doing the ignoring. You do not have keep repeating what it is you want to achieve, we all understand that. We know why you are getting it wrong by picking a new "C++ class" as the item, and we have told you that is not the right one to pick, you need to pick the one which offers to create a new Qt widget, which will give you the "surface" where you pick things and drag them onto it to design your widget/dialog.
Note that I use Creator 6. You are using Creator 12. That isa different version from mine. So my screenshots may not match exactly what you see, but hopefully they will be close. Unless you only want screenshots from somebody using the exact same version of Creator as you have.
From Creator, menu File > New File or Project...,
On the left you have C/C++ highlighted and C++ Class selected to the right. The info panel at the right tells you this will add a C++ header and source file to your project. That is what you are picking. This is wrong for what you want. If you pick it you will get the plain C++ class you have had so far. This is not what you want. It is wrong. If you continue with that you will not get what you want. You have to change your choice to the one you need. If you choose to ignore this you will not solve your issue. You have to do something else.
Move your mouse with your hand. In the left hand area move it to the item which says Qt. You want something Qt-specific for designing widgets, so that is what you need to pick.
Now have a look at the choices in the middle. Any of them look possible? What about Qt Designer Form, since you want to create something in Qt Designer and if you read earlier you have been told repeatedly to pick this. Click on Qt Designer Form with your mouse. Then move your mouse to the Choose... button in the bottom right of this dialog and press the mouse to click.
From then on as you work through the wizard hopefully you can make your own choices for what you want. Take the time to look at the choices before you pick one.
Is that enough for you, or still not clear enough? Do you still think I am ignoring your question? Did we not say from the outset that you needed a new Designer form? In all the years I have been here nobody has had any trouble picking a new Designer form to add or asked about it.
-
OK, you "experts"
...cut it out...
The way you are getting into "advices" is too familiar to me.
Stick with technology and STOP the innuendos.
You can help and be more constrictive by skipping the lecturing, unless you have background in teaching.I would actually like to see a Qt published example of the task the OP is trying to do - main application ( main window) with dialog as sub window.
Unfortunately I have not found one yet.
What the OP is trying REALLY needs a solid foundation, mainly because his vision of manipulating the dialog and communicating between main and dialoog , is the VISIBLE part of the iceberg and without good knowledge what " lays hidden in water part ", it does not look much fun to code.
PS
I am using "simple terminal" Qt example , it has similar layout (main window with dialogs ) , but I would not recommend that as first Qt project.PPS
OP - take a look at thishttps://stackoverflow.com/questions/50329211/qt-open-dialog-from-main-window
-
@AnneRanch
The OP is asking how to design a dialog in Creator/Designer, not how to open one once he has it per your link. That requires him to pick Qt Designer Form as the item to create, not the C++ Class he has been picking so far. We have told him this, and my last post shows him it in pictures. Cannot be clearer or more helpful than that. -
@AnneRanch It's OK. I just believe/hope that if the OP looks at the pictures I have posted they will be able to get into the Designer correctly as they want to.
-
@Bryan-Kelly My (final) advise depends if you are planing to USE Qt in the future.
I would actually start my Qt coding using " (simple) terminal" example. .
It is scarcely documented and not very intuitive.
BUT
it puts more "bells and whistles " into code and than it may get frustrating to follow.
BUT
it is main with dialogs !It is a "template / skeleton " of the application, it is all there , and it actually includes "connect" - and that is you goal.
Then you have (two) ways - build each part of the project piece by piece - main, dialog, communication etc
or
reuse what somebody already have done and trace each build part flow and modify it for your purpose.
-
@AnneRanch AnneRanch Suggested using a simple terminal example. I am moving towards the point of thinking that despite my opinion, presumption?, there is no method to utilize drag and drop to create multiple dialogs. If that turns out to be the case I will be rather disappointed in Qt.
I am also confident that I am using Qt Creator 12.0.2 and Qt 6.6.0, that no one else in this conversation is using this version, and this creates a problem. Here are some dialog screen captures and maybe it will lead someone to help me find the right path forward.When creating a project, the above is the first screen. The option of the top left of the left panel, then the top item of the center panel seem to be a clear best choice. From here through to the initial project creation I see no option that I perceive as having a bearing on my core question. So I complete the project creation naming it three_dialog_05, the fifth time I have tried this. After the project has been created, the most appropriate screen capture is below.
This is before writing any of my code. This is where I expect/hope to find the ability to add a new dialog. Note file mainwindow.ui. When opened, the user has the ability to drag and drop controls onto the dialog. My first goal is to find a way to get Qt Creator to create a file named, for example, quadratic.ui. When that file is opened by Qt Creator, it will provide the ability to drag and drop controls onto the new dialog.
With the express purpose of keeping this simple: Is there a way to do this in Qt Creator 12.0.2, or in any version of Qt Creator?
I am torn between: A) writing another post taking one of the paths suggested by other replies and B) stopping here to limit the thread to a single question and if the question is NO, then working one of the other paths.
I am going with simplicity, stopping here, and waiting for, essentially, a Yes or No answer.
To each of you, thank you again for your time and patience. -
@Bryan-Kelly said in Opening projects and getting started:
This is where I expect/hope to find the ability to add a new dialog.
It was actually already explained here.
But I will repeat: go to File/New File or Project..., select Qt on the left side, then select Qt Designer Form, in next step you can select a Dialog as template. Don't know how else to explain this. Maybe you should follow the suggestions? -
@jsulm
As you know, I have already said exactly this (as have others), and quoted exactly where in OP's steps they went wrong and what they should have done. To which OP's reply to me wasThe question has not been answered. I wrote down the steps one line at a time, posted, and that post was essentially ignored.
So quoting from their post counts as ignoring them. Even shown a picture of exactly what it looks like, what the OP has erroneously picked and what they should actually pick. All they have to do is follow exactly their steps where they picked "new C++ class" and change it to "new Qt Designer Form" which is what they want. So it's not clear what we can say any more that the OP will try, instead of keep saying that Creator/Designer does not allow them to design with drag & drop onto a form.
-
@jsulm said in Opening projects and getting started:
@Bryan-Kelly said in Opening projects and getting started:
This is where I expect/hope to find the ability to add a new dialog.
It was actually already explained here.
But I will repeat: go to File/New File or Project..., select Qt on the left side, then select Qt Designer Form, in next step you can select a Dialog as template. Don't know how else to explain this. Maybe you should follow the suggestions?Yes, that worked out well. I have no excuse for not recognizing the right method much earlier in this conversation.
So again, to each respondent, thank you for your time and patience. -
@Bryan-Kelly here is no method to utilize drag and drop to create multiple dialogs.
Excuse my English - but - are you in effect saying DRAG AND DROP TO CREATE / DUPLICATE DIALOG PROJECT?
I am not nitpicking on your statement,
but
there is a difference between that and "drag and drop" objects in SAME dialog.Actually even (opening) projects - plural - is little misleading.
-
@Bryan-Kelly as you are starting with Qt, i would advise you to use qt books.Inside you can better learn qt features.Some are:
9781786467126-MASTERING_QT_5
[Trolltech]Qt4 Examples And Tutorials
c-gui-programming-with-qt-4-2ndedition
AdvancedProgramming wit Qt
Hands-On-GUI-Programming-with-CPP-and-Qt5
Foundations of Qt Development
Qt5 cadaques.Some may be old , but you will learn a lot from them.
-
@AnneRanch The intent was something on the order of: Begin with a just created project, use the defaults. Open mainwindow.ui. This opens a tool dialog of controls to drop on the dialog. Somewhere in that tool dialog is, or more correctly, I suggest there be, a tool called "dialog" Drag and drop this somewhere, maybe outside the currently existing dialog to create a new dialog. Go from there.
Yes, that presents some problems, but, that is the basic concept I was searching for. The provided answer was good and does the job.
I slightly modify the earlier given instructions to:
File -> New File -> Qt Designer Form Class (rather than Qt Designer Form)
This provides not just a dialog but a dialog with an associated class for the stuff to be done within the dialog.@Ronel_qtmaster Thanks for the list of books. I am working on selecting and ordering one. I will probably go Amazon to get a Kindle version, but, will look and try to find a PDF of one rather than Kindle. Kindle is OK but has some drawbacks, the biggest of which is Kindle does not have smooth scrolling. It only moves a complete page at a time which is often quite inconvenient.
-
@Ronel_qtmaster I purchased the Kindle version of Mastering Qt 5. The first goal is a series of Line Edit controls to entering and displaying numbers. A search for qlineedit in the book yields 7 results. All of them are example within lines of code. None of them are explanations on using the tool, QLineEdit.
Searches for text such as
how to use qlineedit for numbers c++
returns some examples, but no discussions on how to use it. To state in other words, a page, or several on the topic of QLineEdit and various ways to use it. Of course, the same is hoped for regarding other tools.An example: I can right click on a line edit tool then click "go to slot" This generates a function names on_le_step_a_returnPressed(). The actual function appears to be returnPressed(). How can I determine or discover all the available functions without having to create and test each one?
Using QLineEdit as an example, are there any web sites or books that list various tools such as this and how to use them?
-
@Bryan-Kelly
I am afraid your questions/requests are just too specific. The books are what they are, and they cover what they cover. I don't think you will find anything which goes into detail on e.g. every widget type, but good luck if you find what you are looking for.That apart, for the case of "how to use qlineedit for numbers" the answer is: don't! Use a dedicated
QSpinBox
for integers andQDoubleSpinBox
for floating point ones. -
@JonB said in Opening projects and getting started:
@Bryan-Kelly
I am afraid your questions/requests are just too specificSeems to me, noted specificity is a major reason forums such as this exist. Sometimes people just cannot find the exact syntax for what is needed, even when the general concept is known.
I now know how to create those dialogs and it is simple and logical.
Thanks for your time and patience.
-