Seems their download options have changed recently, there used to be a thing called QtSDK something which jad everything you need.
After a little curiousity, I started searching Qt, and I ended up going here. There is a link on this page which appears to offer the QtSDK: http://qt-project.org/
As mentioned in my previous post, I am curious, so here is what I intend to do. I sincerely hope to not have the difficulties that you have encountered, but I intend to attempt an install of MinGW and QtCreator on a Win. XP Pro. Ver. 2002 Ser. Pk. 3 OS. I will document my steps with links and images locally as I go along. If I am successful, I will then upload the links and images of the steps and procedures that I made. Additionally, if I am successful, you will have an additional mind to tap into, just in case you get into a jamb with your programming.
Sorry, yes, I noticed this morning that Creator won't offer you the option of creating an Application until after it has that "kits" thing set up. No idea why.
I suggest,
1) Cancel out of the creating a new project for now.
2) Get into the kits set up by selecting:
"Tools" (from the menu bar) -> "Options" and then "Build and Run".
In that dialog you can set the compiler path, qt version etc as follows:
We need to select a compiler for this project(s) so under the "Compilers" tab hit the "Add" button and "MinGW" from the selection box it shows.
Now set the "compiler path" by browsing to C:\MinGW\bin\mingw32-c++.exe
We need to select a Qt libs version to use for this project(s) so under the "Qt Versions" tab hit the "Add" button.
In the file navigation box select C:\Qt\4.8.3\bin\qmake.exe
We need a "kit" so under the "Kits" tab hit the "Add" button.
Enter a name for you kit, e.g "MinGWKit"
Enter a device type of "Desktop"
The "Device" should read "Run Locally"
The Sysroot can be blank.
Set "Compiler" to "Mingw"
Set "Qt version" to "Qt 4.8.3(4.8.3)"
Hit OK.
3) Now you should be able to create that new project:
Select: "File" -> "New File or Project".
In the resulting dialog select "Application" and "Qt Gui Application" and then hit "Choose".
Enter the name of your project and its location and hit next.
You should now have an out line of GUI app in the source windows.
Hit the big green triangle to compile and run the project. This should result in an empty window being displayed.
For the stable v4 the big download is only the libraries package. Qt Creator is a bit further down the page and the compiler (mingw) is totally separate. The compiler is not a Qt product after all.
For the beta of v5 it looks like Creator is included in the big beta download. From Dr_A's recounting it looks like the compiler is not in their either.
See my previous instructions for how it all hangs together.
I attempted to download MinGW several times, and it stated that the files were corrupted. When I finally did get a valid install, everything proceeded as expected during the installation. Upon completion of the installation, the only program I could find in the start menu and the program files was an unistall. So from the start menu I click it, and it uninstalled the short cut and who knows what else it removed, but it was not a complete uninstall, which is not good. Then I attempted another install and kept getting the corrupt file message over and over again.
You can't expect mingw to plant itself in the start menu as it is a command line tool.
Odd about the corrupt file business. Seems you were not able to get very far then.
Ok, that is half of this solved - we can write code. But I want a GUI IDE. I don't know what the syntax is for a button. In .net there are two tabs that you flip between many times while writing a program - the 'code' tab and the 'what it looks like' tab. Some of the other GUIs work the same way (there is a nice Pascal one in Ubuntu that is even simpler than the .net version).
So - Qt Creator seems to be the code part. And Qt designer seems to be the form designer.
IMO, placement of UI controls by dragging and dropping is way overrated. Before I discovered Perl/Tk, which requires UIs to be "designed" in code, I used Visual BASIC 4.0. The problem was always that accurate placement was an exercise in hand/eye coordination and sketchy grid-snapping. The process almost never succeeded in getting things to line up correctly. With Perl/Tk, everything is specified programmatically, and the pack function makes nice-looking, accurately-aligned layouts drop-dead simple -- all without having to know the controls' absolute coordinates.
Qt Creator is a code and design editor. It's all in there.
In the left pane where your files are listed you will see a "forms" directory. In there are the user interface design files with names *.ui. You should habe something like "MainWindow.ui". Click on that and it will open the designer view. In there you will see how to drag and drop buttons and other widgets onto your window and change properties of the widgets.
When you have your form laid out hit run and it should compile and run the thing.
Then you can get back to code editing to add the code to your widgets.
Having said that I think its worth following some tutorial that takes you through building the whole thing in code so that you get a feel for how Qt hangs together. Especially its "signals" and "slots" mechanism for connecting widgets to your code.
I have never used absolute coordinates in my Qt GUIs.
Qt has this covered with similar packing, aligning aids. It can all be done drag and drop.
But as I said its good to get start off with just coding the layouts by hand and connecting up widgets to your code. Then you appreciate what the various GUI editor features are doing for you. Like the "signals and slots" editor.
@PhiPi, yes I agree with that. I tend to stick one or two widgets on a screen to get a feel for whatever the syntax is (which is different for every language), but once I have worked out how they work, I tend to write more in code. Another advantage of writing it more in code is that you can print out a listing, eg to a forum like this, and others can run it without having to include a long description of 'put a text box here, a button there'.
A perfect example is below. In vb.net this would need to be two files, and it might need more files than that.
@heater, that free book is brilliant, because ultimately I wanted to reduce a GUI to code like below. The reason for this is to experiment with doing the same thing with the propeller.
Ok, jumping right in, here is the demo program for a slider bar and a box with numbers in it. Compiles and runs perfectly
#include <QApplication>
#include <QHBoxLayout>
#include <QSlider>
#include <QSpinBox>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QWidget *window = new QWidget;
window->setWindowTitle("Enter Your Age");
QSpinBox *spinBox = new QSpinBox;
QSlider *slider = new QSlider(Qt::Horizontal);
spinBox->setRange(0, 130);
slider->setRange(0, 130);
QObject::connect(spinBox, SIGNAL(valueChanged(int)),
slider, SLOT(setValue(int)));
QObject::connect(slider, SIGNAL(valueChanged(int)),
spinBox, SLOT(setValue(int)));
spinBox->setValue(35);
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(spinBox);
layout->addWidget(slider);
window->setLayout(layout);
window->show();
return app.exec();
}
So, for a propeller, the 'connections' are going to be to either a mouse driver. Or on a touchscreen, to the SPI driver that is detecting the finger position and whether the screen is being touched or not.
I'm excited by this, because those low level drivers already exist in Spin. So it ought to be possible to port those over to C++ code, and include them as replacement objects for the Qt ones. Things like the 'slider' widget need to be replaced with a Propeller 'slider' widget. This ought to be very simple for the programmer, instead of declaring "#include <QSlider>" at the beginning of the code, change it to "#include <PSlider>".
Yep, you seem to be heading all the same road with Qt as I did a while back.
Next you need to figure out how to connect those signals from widgets into "slot" methods in your own classes so that your program can actually do something with them.
I'm all for the "do it in code" way as well.
Not much chance of keeping to a single file. When you get to your own application code you will need files for it's classes and their headers. If you get into deriving classes from existing Qt classes then it is essential to have them in their own files. If you use the GUI designer then you will have those *.ui files which describe the layout in XML.
Not sure I see how you are going to get any of this running on a Prop. Qt is huge.
Those 'connections' in your code are not really from mouse or keyboard. They are from instances of widget class to instances of some other class.
Imagine you have class A that can emit signals on some event.
Then you have class B that can consume those kind of signals, it has "slot" methods.
Normally in C++ this is not so easy to do. In order for A to call a method in B it will need to know what B is and have a pointer to it so that it can call that "slot" method. Then what if you want the signal from A to go to many places, perhaps all different classes. And what if you want B to accept signals from many sources on that "slot" method?
The Qt signals and slots system sorts all this out. In Qt A and B don't need to know anything about each other. Or even how many A's or B's are involved in this signal, there may not even be a B listening at all.
As long as A emits a signal suitable for a slot in B your application can connect them up any how it likes.
You can use signals and slot to and from your own classes, they just have to be derived from QObject.
OK perhaps you can forget all that searching for Qt books and tutorials. I just had a quick poke around in the QtCreator that comes with my Debain install of Qt v4.8.
I mean wow, go to the "help" menu and select "contents", there opens a scene with a contents list down the right hand side. Click on the last entry "Qt reference documentation" and there you get a page of all good stuff, Including how to get started and tutorials. Furthe rdown that page is a to all classes, functions and modules.
The documentation in there is vast.
Did I mention, you might want to steer away from any links to QtQuick or QML stuff. that's all very new. Might be fun if you want to use JavaScript (Not Java) for developing UIs on phones and tabs.
I am all for learming something new, but come on.... Hardcoding the locations of controls for a GUI.... I would much rather let the software do it for me, like so
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
"\r\n"
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
"#ifdef _WIN32\r\n"
"LANGUAGE 9, 1\r\n"
"#pragma code_page(1252)\r\n"
"#endif //_WIN32\r\n"
"#include ""res\\Gemestimate.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
"#include ""afxres.rc"" // Standard components\r\n"
"#include ""afxprint.rc"" // printing/print preview resources\r\n"
"#include ""afxolecl.rc"" // OLE container resources\r\n"
"#endif\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDR_MAINFRAME ICON DISCARDABLE "res\\Gemestimate.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_GEMESTIMATE DIALOG DISCARDABLE 0, 0, 420, 265
STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Gemestimate"
FONT 8, "MS Sans Serif"
BEGIN
GROUPBOX "Contact Information",IDC_STATIC,7,7,200,145
LTEXT "First Name:",IDC_STATIC,14,20,36,8,NOT WS_GROUP
LTEXT "Middle Initial:",IDC_STATIC,86,20,41,8,NOT WS_GROUP
LTEXT "Last Name:",IDC_STATIC,132,20,36,8,NOT WS_GROUP
EDITTEXT IDC_FIRST_NAME,14,30,68,12,ES_AUTOHSCROLL
EDITTEXT IDC_MIDDLE_INITIAL,86,30,42,12,ES_AUTOHSCROLL
EDITTEXT IDC_LAST_NAME,132,30,68,12,ES_AUTOHSCROLL
LTEXT "Company Name:",IDC_STATIC,14,47,52,8,NOT WS_GROUP
EDITTEXT IDC_COMPANY_NAME,14,56,186,12,ES_AUTOHSCROLL
LTEXT "Street Address 1:",IDC_STATIC,14,73,54,8,NOT WS_GROUP
EDITTEXT IDC_STREET_ADDRESS_1,14,82,186,12,ES_AUTOHSCROLL
LTEXT "Street Address 2:",IDC_STATIC,14,98,54,8,NOT WS_GROUP
EDITTEXT IDC_STREET_ADDRESS_2,14,106,186,12,ES_AUTOHSCROLL
LTEXT "City:",IDC_STATIC,14,124,14,8,NOT WS_GROUP
LTEXT "State:",IDC_STATIC,70,124,18,8,NOT WS_GROUP
LTEXT "Zip:",IDC_STATIC,120,124,13,8,NOT WS_GROUP
LTEXT "Phone:",IDC_STATIC,150,124,22,8,NOT WS_GROUP
EDITTEXT IDC_CITY,14,132,52,12,ES_AUTOHSCROLL
EDITTEXT IDC_STATE,70,133,45,12,ES_AUTOHSCROLL
EDITTEXT IDC_ZIP_CODE,120,133,25,12,ES_AUTOHSCROLL
EDITTEXT IDC_PHONE,150,133,51,12,ES_AUTOHSCROLL
GROUPBOX "Building Information",IDC_STATIC,213,7,200,145
LTEXT "Type Of Sno-Gem Installation:*",IDC_STATIC,220,20,98,8,
NOT WS_GROUP
COMBOBOX IDC_TYPE_OF_SNO_GEM,220,30,186,158,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Building Width:*",IDC_STATIC,220,47,51,8,NOT WS_GROUP
LTEXT "Building Length:*",IDC_STATIC,316,47,54,8,NOT WS_GROUP
EDITTEXT IDC_BUILDING_WIDTH,220,56,91,12,ES_AUTOHSCROLL
EDITTEXT IDC_BUILDING_LENGTH,316,56,90,12,ES_AUTOHSCROLL
LTEXT "Eave Width Side Wall:*",IDC_STATIC,220,73,75,8,NOT
WS_GROUP
LTEXT "Eave Width Gable End:*",IDC_STATIC,316,73,78,8,NOT
WS_GROUP
EDITTEXT IDC_EAVE_WIDTH_SIDE_WALL,220,82,91,12,ES_AUTOHSCROLL
EDITTEXT IDC_EAVE_WIDTH_GABLE_END,316,82,90,12,ES_AUTOHSCROLL
LTEXT "Horizontal Spacing:*",IDC_STATIC,220,98,65,8,NOT
WS_GROUP
LTEXT "Max. Width Of Base:",IDC_STATIC,316,98,65,8,NOT
WS_GROUP
EDITTEXT IDC_HORIZONTAL_SPACING,220,106,91,12,ES_AUTOHSCROLL
EDITTEXT IDC_MAX_BASE_WIDTH,316,106,90,12,ES_AUTOHSCROLL
LTEXT "Roofing Rise:*",IDC_STATIC,220,124,46,8,NOT WS_GROUP
LTEXT "Side(s):*",IDC_STATIC,348,124,27,8,NOT WS_GROUP
COMBOBOX IDC_ROOFING_RISE,220,132,59,119,CBS_DROPDOWNLIST |
WS_VSCROLL | WS_TABSTOP
LTEXT "Project Description:",IDC_STATIC,7,157,62,8
LTEXT "Project Start Deadline:",IDC_STATIC,333,157,71,8,NOT
WS_GROUP
EDITTEXT IDC_PROJECT_DESCRIPTION,7,166,320,43,ES_MULTILINE |
WS_VSCROLL
LISTBOX IDC_START_DEADLINE,333,166,80,43,LBS_NOINTEGRALHEIGHT |
WS_VSCROLL | WS_TABSTOP
CONTROL 141,IDC_STATIC,"Static",SS_BITMAP,7,216,318,43
PUSHBUTTON "Create Proposal",IDC_CREATE_PROPOSAL,333,216,80,13
PUSHBUTTON "Clear Contents",IDC_CLEAR_CONTENTS,333,231,80,13
PUSHBUTTON "Exit Program",IDCANCEL,333,246,80,13
LTEXT "Rate:*",IDC_STATIC,283,124,36,8
COMBOBOX IDC_RATE,283,132,59,94,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
COMBOBOX IDC_SIDES,348,132,59,127,CBS_DROPDOWNLIST | WS_VSCROLL |
WS_TABSTOP
END
IDD_NUMBER DIALOG DISCARDABLE 0, 0, 92, 58
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Number"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,20,37,50,14
LTEXT "Enter A Starting Number:",IDC_STATIC,7,7,78,8
EDITTEXT IDC_NUMBER_EDIT,7,17,78,12,ES_AUTOHSCROLL
END
#ifndef _MAC
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,1
PRODUCTVERSION 1,0,0,1
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", "\0"
VALUE "FileDescription", "Gemestimate MFC Application\0"
VALUE "FileVersion", "1, 0, 0, 1\0"
VALUE "InternalName", "Gemestimate\0"
VALUE "LegalCopyright", "Copyright (C) 2004\0"
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "Gemestimate.EXE\0"
VALUE "ProductName", "Gemestimate Application\0"
VALUE "ProductVersion", "1, 0, 0, 1\0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // !_MAC
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_GEMESTIMATE, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 413
TOPMARGIN, 7
BOTTOMMARGIN, 259
END
IDD_NUMBER, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 85
TOPMARGIN, 7
BOTTOMMARGIN, 51
END
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_DECIMAL_EQUIV BITMAP DISCARDABLE "res\\DecEquiv.bmp"
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE 9, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\Gemestimate.rc2" // non-Microsoft Visual C++ edited resources
#include "afxres.rc" // Standard components
#include "afxprint.rc" // printing/print preview resources
#include "afxolecl.rc" // OLE container resources
#endif
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
EDIT: Furthermore, resource scripts can be edited, if you desire tweeking.
Hard code or soft code a GUI probably does not matter. I guess for me what I want is to get hold of the source code and then be able to drop in a different object that has been written for the propeller.
I ran the entire spin program for the touchscreen calculator through Spin2cpp and it produced some very plausible C++ code with no errors in the conversion process. I already have low level spin code to draw buttons and things, and with Spin2Cpp I now have low level C++ code. So I don't think it is impossible at all.
But I have run into a small snag getting it to compile on Qt. So I went back to the Qt demo program and that won't compile either (the one I had working a few hours ago was on a different computer).
See attached screen shots - one is with a straight compile, and one is in debug mode.
re
Normally in C++ this is not so easy to do. In order for A to call a method in B it will need to know what B is and have a pointer to it so that it can call that "slot" method. Then what if you want the signal from A to go to many places, perhaps all different classes. And what if you want B to accept signals from many sources on that "slot" method?
I wonder if you could solve this by writing a Spin program with its attached PASM driver to load into a cog and handle interfacing. Convert with Spin2cpp if needed. So - create some Qt looking classes that handle all the data interfacing. Behind the scenes, a cog is doing the transfers via hub locations. For instance, a cog is reading the touchscreen periodically and just putting the x and y location in a known hub location. From the Qt side, read those locations from C code. Those bits of code can be disconnected - that is where we can use the parallel nature of the propeller to do things that are harder with other micros.
This is a fragment of code to run my GUI calculator program on the touchscreen, translated from Spin to C. It doesn't run as yet, but we are getting some nifty autocompletion of class methods which is going to be a quantum leap in object use compared with Spin. The code below draws the calculator picture on the screen, then looks for keypresses in different x and y positions and translates that to button presses. It is a bit crude and a better solution would be to create a Button class and then copy that multiple times.
I am all for learming something new, but come on.... Hardcoding the locations of controls for a GUI..
No one hard codes locations for controls in Qt. As I said a while back. Now writing the code by hand instead of letting the GUI designer generate it is another matter. Some prefer to do that.
No idea whats causing your crash there.
Is that really the same source as on your other machine?
Do you have the same compiler set up?
Try using "clean all" then "run qmake" and then build again.
Thanks for your patience. I uninstalled and then reinstalled Qt. Still getting the same error when trying to compile the demo program.
Two things worth noting. First is that even though I completely erased the c:\qt directory, the settings for the kits and the compiler were automatically there on the second install. So somewhere it is saving some settings.
Second issue - in tools/options/build and run, in the autodetect area it is bringing up the version 5.0.0 beta. I can't delete this because the remove button is grayed out when I highlight this.
I wonder if it is remembering the old 5.0.0 install we did and somehow this is upsetting the compilation? If so, where would Qt be saving these things, as uninstalling is clearly not deleting all the files.
Personally, I use python, as for GUIs, perhaps Glade (pyQT)? or wxPython. I can't say much more beyond that because I hard code most my GUIs. You can also do GUIs in Netbeans (using Java).
Have a look in that Tools->Options and select the "Qt Versions" tab.
In there it should have an entry for Qt 4.8.3.
If not, select the "manual" item and hit the "Add" button. Then you will have to browse to c:\Qt\4.83\bin and select qmake. Then open.
You should now see Qt4.8.3 listed in the Qt versions window.
For now if the is a Qt 5 listed in there then just select and Remove it to avoid confusion.
Now go to that "Kits" tab and check you have "Qt 4.8" as the "Qt Version". Also your compiler should be there MinGW.
OK out of the options dialog.
With your project open go to the "Build" menu and hit "Clean All" then "Rebuild All" then "Run"
If this does not work I am at a loss as you are on Windows. I have no idea where Qt keeps settings there. I was already worried that the Qt5 install will have confused things for you.
Now go to that "Kits" tab and check you have "Qt 4.8" as the "Qt Version". Also your compiler should be there MinGW.
OK out of the options dialog.
With your project open go to the "Build" menu and hit "Clean All" then "Rebuild All" then "Run"
Ok, did all that. Unfortunately the error is still the same - it won't compile.
If not, select the "manual" item and hit the "Add" button. Then you will have to browse to c:\Qt\4.83\bin and select qmake. Then open.
You should now see Qt4.8.3 listed in the Qt versions window.
For now if the is a Qt 5 listed in there then just select and Remove it to avoid confusion.
That is the part I can't do. See attached. The version 5 has an alert next to it, and it is highlighted, and you can't click on the Remove button as it is grayed out. I suspect it has an alert because the directory/file is no longer there. But where is it storing the data that is telling it that file is there, given I have uninstalled Qt, deleted the entire c:\Qt directory, and then reinstalled Qt?
And I guess there is the possibility this version 5 thing is a red herring, and the compilation error is some other problem?
Ok, sending windows search looking for all files containing the text qmake.exe. I am hoping it will be a .ini file somewhere...
Addit - found the .inf file in "C:\Documents and Settings\Administrator\Application Data\QtProject". The uninstall doesn't delete this folder. Killed the file manually. Now reinstalling...
... and adding the kits and qt version and compiler...
... and the compile error is still there.
So I'm out of ideas.
Maybe the problem is Mingw? Is it worth trying another compiler?
Comments
After a little curiousity, I started searching Qt, and I ended up going here. There is a link on this page which appears to offer the QtSDK:
http://qt-project.org/
As mentioned in my previous post, I am curious, so here is what I intend to do. I sincerely hope to not have the difficulties that you have encountered, but I intend to attempt an install of MinGW and QtCreator on a Win. XP Pro. Ver. 2002 Ser. Pk. 3 OS. I will document my steps with links and images locally as I go along. If I am successful, I will then upload the links and images of the steps and procedures that I made. Additionally, if I am successful, you will have an additional mind to tap into, just in case you get into a jamb with your programming.
Bruce
Sorry, yes, I noticed this morning that Creator won't offer you the option of creating an Application until after it has that "kits" thing set up. No idea why.
I suggest,
1) Cancel out of the creating a new project for now.
2) Get into the kits set up by selecting:
"Tools" (from the menu bar) -> "Options" and then "Build and Run".
In that dialog you can set the compiler path, qt version etc as follows:
We need to select a compiler for this project(s) so under the "Compilers" tab hit the "Add" button and "MinGW" from the selection box it shows.
Now set the "compiler path" by browsing to C:\MinGW\bin\mingw32-c++.exe
We need to select a Qt libs version to use for this project(s) so under the "Qt Versions" tab hit the "Add" button.
In the file navigation box select C:\Qt\4.8.3\bin\qmake.exe
We need a "kit" so under the "Kits" tab hit the "Add" button.
Enter a name for you kit, e.g "MinGWKit"
Enter a device type of "Desktop"
The "Device" should read "Run Locally"
The Sysroot can be blank.
Set "Compiler" to "Mingw"
Set "Qt version" to "Qt 4.8.3(4.8.3)"
Hit OK.
3) Now you should be able to create that new project:
Select: "File" -> "New File or Project".
In the resulting dialog select "Application" and "Qt Gui Application" and then hit "Choose".
Enter the name of your project and its location and hit next.
You should now have an out line of GUI app in the source windows.
Hit the big green triangle to compile and run the project. This should result in an empty window being displayed.
Yes. It in fact only appears to offer an SDK.
For the stable v4 the big download is only the libraries package. Qt Creator is a bit further down the page and the compiler (mingw) is totally separate. The compiler is not a Qt product after all.
For the beta of v5 it looks like Creator is included in the big beta download. From Dr_A's recounting it looks like the compiler is not in their either.
See my previous instructions for how it all hangs together.
After about an hour of trying to document and attempt what should be a simple install, I am abandoning this effort
I do hope the Qt guys get this SDK straightened out again soon,
LOL... Actually it was a series of things.
I attempted to download MinGW several times, and it stated that the files were corrupted. When I finally did get a valid install, everything proceeded as expected during the installation. Upon completion of the installation, the only program I could find in the start menu and the program files was an unistall. So from the start menu I click it, and it uninstalled the short cut and who knows what else it removed, but it was not a complete uninstall, which is not good. Then I attempted another install and kept getting the corrupt file message over and over again.
Bruce
Odd about the corrupt file business. Seems you were not able to get very far then.
Please refer to image below, this shortcut was not present:
Only an hour? I'm up to 6.5 hours
But with heater's help I think I can get there. I'll follow through the steps on post #127 when I get home.
LOL Yea I know, I feel like a whimp, but I felt like I should stop trying before dumping 7 hours into it
Followed the steps to add the kits and the compiler.
Woot!! I compiled this demo code and it gave me a blank form on the screen.
Ok, that is half of this solved - we can write code. But I want a GUI IDE. I don't know what the syntax is for a button. In .net there are two tabs that you flip between many times while writing a program - the 'code' tab and the 'what it looks like' tab. Some of the other GUIs work the same way (there is a nice Pascal one in Ubuntu that is even simpler than the .net version).
So - Qt Creator seems to be the code part. And Qt designer seems to be the form designer.
How do you use these together to build a program?
-Phil
Qt Creator is a code and design editor. It's all in there.
In the left pane where your files are listed you will see a "forms" directory. In there are the user interface design files with names *.ui. You should habe something like "MainWindow.ui". Click on that and it will open the designer view. In there you will see how to drag and drop buttons and other widgets onto your window and change properties of the widgets.
When you have your form laid out hit run and it should compile and run the thing.
Then you can get back to code editing to add the code to your widgets.
Having said that I think its worth following some tutorial that takes you through building the whole thing in code so that you get a feel for how Qt hangs together. Especially its "signals" and "slots" mechanism for connecting widgets to your code.
Here is a free Qt book http://www.cuteqt.com/blog/wp-content/uploads/2009/06/c-gui-programming-with-qt-4-2ndedition.pdf
Here is a not so free Qt book http://www.qtrac.eu/aqpbook.html
Here is the Qt getting started page. The entry to a huge maze. You might want to ignore all references to QML just for now.
I have never used absolute coordinates in my Qt GUIs.
Qt has this covered with similar packing, aligning aids. It can all be done drag and drop.
But as I said its good to get start off with just coding the layouts by hand and connecting up widgets to your code. Then you appreciate what the various GUI editor features are doing for you. Like the "signals and slots" editor.
This is a nice starter http://zetcode.com/gui/qt4/
or this http://disc-lib.googlecode.com/files/qt_tutorial.pdf
and there is a bunch of videos on you tube.
A perfect example is below. In vb.net this would need to be two files, and it might need more files than that.
@heater, that free book is brilliant, because ultimately I wanted to reduce a GUI to code like below. The reason for this is to experiment with doing the same thing with the propeller.
Ok, jumping right in, here is the demo program for a slider bar and a box with numbers in it. Compiles and runs perfectly
So, for a propeller, the 'connections' are going to be to either a mouse driver. Or on a touchscreen, to the SPI driver that is detecting the finger position and whether the screen is being touched or not.
I'm excited by this, because those low level drivers already exist in Spin. So it ought to be possible to port those over to C++ code, and include them as replacement objects for the Qt ones. Things like the 'slider' widget need to be replaced with a Propeller 'slider' widget. This ought to be very simple for the programmer, instead of declaring "#include <QSlider>" at the beginning of the code, change it to "#include <PSlider>".
Next you need to figure out how to connect those signals from widgets into "slot" methods in your own classes so that your program can actually do something with them.
I'm all for the "do it in code" way as well.
Not much chance of keeping to a single file. When you get to your own application code you will need files for it's classes and their headers. If you get into deriving classes from existing Qt classes then it is essential to have them in their own files. If you use the GUI designer then you will have those *.ui files which describe the layout in XML.
Not sure I see how you are going to get any of this running on a Prop. Qt is huge.
Imagine you have class A that can emit signals on some event.
Then you have class B that can consume those kind of signals, it has "slot" methods.
Normally in C++ this is not so easy to do. In order for A to call a method in B it will need to know what B is and have a pointer to it so that it can call that "slot" method. Then what if you want the signal from A to go to many places, perhaps all different classes. And what if you want B to accept signals from many sources on that "slot" method?
The Qt signals and slots system sorts all this out. In Qt A and B don't need to know anything about each other. Or even how many A's or B's are involved in this signal, there may not even be a B listening at all.
As long as A emits a signal suitable for a slot in B your application can connect them up any how it likes.
You can use signals and slot to and from your own classes, they just have to be derived from QObject.
OK perhaps you can forget all that searching for Qt books and tutorials. I just had a quick poke around in the QtCreator that comes with my Debain install of Qt v4.8.
I mean wow, go to the "help" menu and select "contents", there opens a scene with a contents list down the right hand side. Click on the last entry "Qt reference documentation" and there you get a page of all good stuff, Including how to get started and tutorials. Furthe rdown that page is a to all classes, functions and modules.
The documentation in there is vast.
Did I mention, you might want to steer away from any links to QtQuick or QML stuff. that's all very new. Might be fun if you want to use JavaScript (Not Java) for developing UIs on phones and tabs.
I am all for learming something new, but come on.... Hardcoding the locations of controls for a GUI.... I would much rather let the software do it for me, like so
EDIT: Furthermore, resource scripts can be edited, if you desire tweeking.
I ran the entire spin program for the touchscreen calculator through Spin2cpp and it produced some very plausible C++ code with no errors in the conversion process. I already have low level spin code to draw buttons and things, and with Spin2Cpp I now have low level C++ code. So I don't think it is impossible at all.
But I have run into a small snag getting it to compile on Qt. So I went back to the Qt demo program and that won't compile either (the one I had working a few hours ago was on a different computer).
See attached screen shots - one is with a straight compile, and one is in debug mode.
re
I wonder if you could solve this by writing a Spin program with its attached PASM driver to load into a cog and handle interfacing. Convert with Spin2cpp if needed. So - create some Qt looking classes that handle all the data interfacing. Behind the scenes, a cog is doing the transfers via hub locations. For instance, a cog is reading the touchscreen periodically and just putting the x and y location in a known hub location. From the Qt side, read those locations from C code. Those bits of code can be disconnected - that is where we can use the parallel nature of the propeller to do things that are harder with other micros.
This is a fragment of code to run my GUI calculator program on the touchscreen, translated from Spin to C. It doesn't run as yet, but we are getting some nifty autocompletion of class methods which is going to be a quantum leap in object use compared with Spin. The code below draws the calculator picture on the screen, then looks for keypresses in different x and y positions and translates that to button presses. It is a bit crude and a better solution would be to create a Button class and then copy that multiple times.
No one hard codes locations for controls in Qt. As I said a while back. Now writing the code by hand instead of letting the GUI designer generate it is another matter. Some prefer to do that.
Is that really the same source as on your other machine?
Do you have the same compiler set up?
Try using "clean all" then "run qmake" and then build again.
Thanks for your patience. I uninstalled and then reinstalled Qt. Still getting the same error when trying to compile the demo program.
Two things worth noting. First is that even though I completely erased the c:\qt directory, the settings for the kits and the compiler were automatically there on the second install. So somewhere it is saving some settings.
Second issue - in tools/options/build and run, in the autodetect area it is bringing up the version 5.0.0 beta. I can't delete this because the remove button is grayed out when I highlight this.
I wonder if it is remembering the old 5.0.0 install we did and somehow this is upsetting the compilation? If so, where would Qt be saving these things, as uninstalling is clearly not deleting all the files.
Have a look in that Tools->Options and select the "Qt Versions" tab.
In there it should have an entry for Qt 4.8.3.
If not, select the "manual" item and hit the "Add" button. Then you will have to browse to c:\Qt\4.83\bin and select qmake. Then open.
You should now see Qt4.8.3 listed in the Qt versions window.
For now if the is a Qt 5 listed in there then just select and Remove it to avoid confusion.
Now go to that "Kits" tab and check you have "Qt 4.8" as the "Qt Version". Also your compiler should be there MinGW.
OK out of the options dialog.
With your project open go to the "Build" menu and hit "Clean All" then "Rebuild All" then "Run"
If this does not work I am at a loss as you are on Windows. I have no idea where Qt keeps settings there. I was already worried that the Qt5 install will have confused things for you.
Ok, did all that. Unfortunately the error is still the same - it won't compile.
That is the part I can't do. See attached. The version 5 has an alert next to it, and it is highlighted, and you can't click on the Remove button as it is grayed out. I suspect it has an alert because the directory/file is no longer there. But where is it storing the data that is telling it that file is there, given I have uninstalled Qt, deleted the entire c:\Qt directory, and then reinstalled Qt?
And I guess there is the possibility this version 5 thing is a red herring, and the compilation error is some other problem?
Ok, sending windows search looking for all files containing the text qmake.exe. I am hoping it will be a .ini file somewhere...
Addit - found the .inf file in "C:\Documents and Settings\Administrator\Application Data\QtProject". The uninstall doesn't delete this folder. Killed the file manually. Now reinstalling...
... and adding the kits and qt version and compiler...
... and the compile error is still there.
So I'm out of ideas.
Maybe the problem is Mingw? Is it worth trying another compiler?