I try to add two QStrings into one. I've read a lot about:
QString NAME = QString + QString
but this doesn't helps me here. Thats how my code look so far:
test.h
#ifndef TEST_H
#define TEST_H
#include <QString>
#include <QFile>
#include <QDir>
class Test
{
public:
void createProject(QString* p, QString*n);
};
#endif // TEST_H
test.cpp
#include "test.h"
#include <QFile>
#include <QString>
#include <QDir>
void Test::createProject(QString *p, QString *n)
{
QString result = p + n;
QDir dir(result);
if (dir.exists())
{
// ok
}
else
{
printf("Error!\n");
}
}
(ignore the code about checking if the directory exists, btw I use Qt 4.8.6)
So now when I try to compile, I get this error:
test.cpp: In member function 'void Test::createProject(QString*, QString*)': test.cpp:8:21: error: invalid operands of types 'QString*' and 'QString*' to binary 'operator+'
QString result = p + n;
How can I make this work? Also using += instead of + doesn't works here.
~ Jan