1.Add the folowing to pro file:
OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build
RCC_DIR=build
DESTDIR = bin
and the binaries won't mess up your sorce code directory
2. Make the following modifications in the main.cpp:
#include <QtGui/QApplication>
#include <QtCore/QTextCodec>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"
);
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"
);
QCoreApplication::setOrganizationName("MM"
;
QCoreApplication::setApplicationName("Mikrotik data miner"
;
QCoreApplication::setApplicationVersion("0.1"
;
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
Why?
The QTextCodec trick is neccessary because the sourcecode is UTF-8 encoded, and if I want to put a string from the code to somewhere I would need to use QString::fromUtf8(). If you do not believe check a generated ui_*.h file.
Always give set the name to your application and the application domain. This is useful when you are using QSettings, you do not need to give constructor arguments when creating a settings object. The settings object constructed in this way always use a separate data area specified by the platform. (.config/QCodeApplication::applicationDomain/QCoreApplication:applicationName.ini on Linux and registry on Windows)