PDA

View Full Version : A few newbie questions



nigec
8th March 2013, 14:17
Hi I'm new to Qt and C++ and I'm rebuilding a application I originally did with AutoIt

I have Qt creator 5.0.1 the open source version, I'm a bit confused on how to have it static

Can you build a single exe with the needed dll's?

How do you save a text file which has line breaks rather than the text being a single line the code I used is:

void batchcreator::on_actionSave_triggered()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), QString(),
tr("Thea Files (*.ipt.thea);;xml Files (*.xml)"));

if (!fileName.isEmpty()) {
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly)) {
// error message
} else {
QTextStream stream(&file);
stream << ui->textEdit->toPlainText();
stream.flush();
file.close();
}
}

Probably a really stupid Q, feel free to take me outside and beat me lol
Is it possible to build as Mac and Linux version of a project on a Windows machine?

Deploy wizard, is that supposed to work?

thanks
Nige
PS
This is what I'm doing, this is the Autoit one, the Qt version will have a tab layout and a lot more tidy
8804

amleto
8th March 2013, 18:44
"I'm a bit confused on how to have it static. Can you build a single exe with the needed dll's?"
If you want a single exe not dependent on Qt dlls then you need to rebuild Qt statically - google for this.

"How do you save a text file which has line breaks rather than the text being a single line"
add new line character if you want to write a new line.
stream << "some stuff";
stream << '\n'

"Is it possible to build as Mac and Linux version of a project on a Windows machine?"
If you can find a cross compiler - that is outside the scope of this forum.

nigec
8th March 2013, 19:23
Trust me I've been googling lol
I downloaded QT Creator and Library as a single download, and the file structure is different to most of the static builds examples, which build should I have?

The text output is saving from a textedit box, I can give a link to the AutoIt version if it help see what I'm doing :)

I have a Linux machine gathering dust so a I should be able to compile for Linux, I just don't have the £££££££££££ to buy a Mac for a non profit project lol

thank for the help :)

amleto
8th March 2013, 20:49
you can't download a static build of qt - you will have to rebuild it for yourself.

nigec
8th March 2013, 23:09
The file structure is totally different with the build that is the current download, I've yet to find tutorial that applies to the presemt build

C:\Qt\Qt5.0.1\5.0.1\Src\qtbase is were the configure.exe is but i get:

This is the Qt for Windows Open Source Edition.

You are licensed to use this software under the terms of
the GNU Lesser General Public License (LGPL) version 2.1.

Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1).
Type 'y' to accept this license offer.
Type 'n' to decline this license offer.

Do you accept the terms of the license?
y
Running syncqt...
<srcbase> = C:/Qt/Qt5.0.1/5.0.1/Src/qtbase
<outbase> = C:/Qt/Qt5.0.1/5.0.1/Src/qtbase
Creating qmake...
execute: File or path is not found (mingw32-make)
execute: File or path is not found (mingw32-make)
Cleaning qmake failed, return code -1


Qt creator seems to work fine.
The AutoIT one is only 1 meg, with all the dll's its going to be a hell of a lot bigger
Thanks for your help,

wysota
8th March 2013, 23:54
Read the docs instead of trying to find a tutorial. Qt is not AutoIt, it will never be 1MB in size because it has lots and lots of functionality. You can strip it down to whatever you need but then again you end up looking for a tutorial which you will most probably not find because it requires reading, thinking and concious decisions instead of just blindly following instructions and pictures somebody reads in some video. Programming is about using your brains and not about following instructions.

nigec
9th March 2013, 08:38
The actual project is going well, this project has gone through various stages, the original was javascript, then Autoit, I just kept shying away from C++ because I had to think/time
I'm a beta tester for Thea Render and its a quiet spell right now and new features are being added so I need to update the tool anyway and de clutter the ui so this is a ideal time to dip my toe into the world of C++ :)

I've got hung up on trying to make QT to run static and wasted to much time I guess, I'm doing ok at the job in hand apart from the textedit to file issue, I'm obviously missing something simple

thanks for the comments, I know I really shouldn't do a crash course in programming but I tend to do better when things are in context, the actual core of this tool are fairly simple and I know the logic behind it