
29.03.2022, 00:41
|
|
Новичок
Регистрация: 29.03.2022
Сообщений: 1
С нами:
2174037
Репутация:
1
|
|
Блок кода с ошибкой:
Код:
void
QtLauncher
::
saveConfig
(
)
{
QFile
config
(
QCoreApplication
::
applicationDirPath
(
)
+
"/config.cfg"
)
;
config
.
open
(
QIODevice
::
ReadOnly
)
;
QByteArray buffer
=
config
.
readAll
(
)
;
config
.
close
(
)
;
config
.
open
(
QIODevice
::
ReadWrite
|
QIODevice
::
Truncate
)
;
int
index
;
if
(
(
index
=
buffer
.
indexOf
(
QString
(
"game_id="
)
)
)
!=
-
1
)
{
char
str
[
32
]
;
sprintf_s
(
str
,
sizeof
(
str
)
,
"game_id=%i"
,
game_id
)
;
buffer
.
replace
(
index
,
buffer
.
indexOf
(
"\n"
,
index
)
,
str
)
;
}
if
(
(
index
=
buffer
.
indexOf
(
QString
(
"username="
)
)
)
!=
-
1
)
{
char
str
[
256
]
;
sprintf_s
(
str
,
sizeof
(
str
)
,
"username=%s,%s,%s,%s"
,
game_username
[
0
]
.
toStdString
(
)
.
c_str
(
)
,
game_username
[
1
]
.
toStdString
(
)
.
c_str
(
)
,
game_username
[
2
]
.
toStdString
(
)
.
c_str
(
)
,
game_username
[
3
]
.
toStdString
(
)
.
c_str
(
)
)
;
buffer
.
replace
(
index
,
buffer
.
indexOf
(
"\n"
,
index
)
-
index
,
str
)
;
}
if
(
(
index
=
buffer
.
indexOf
(
QString
(
"game_path="
)
)
)
!=
-
1
)
{
char
str
[
256
]
;
sprintf_s
(
str
,
sizeof
(
str
)
,
"game_path=%s,%s,%s,%s"
,
game_path
[
0
]
.
toStdString
(
)
.
c_str
(
)
,
game_path
[
1
]
.
toStdString
(
)
.
c_str
(
)
,
game_path
[
2
]
.
toStdString
(
)
.
c_str
(
)
,
game_path
[
3
]
.
toStdString
(
)
.
c_str
(
)
)
;
buffer
.
replace
(
index
,
buffer
.
size
(
)
-
index
,
str
)
;
}
config
.
write
(
buffer
)
;
config
.
close
(
)
;
}
Вот блок с кодом. Почему то после компиляции выдает ошибку:
Ошибка:
Код:
D:\mp-launcher\launcher.cpp:288: ошибка: no matching function for call to 'QByteArray::indexOf(QString)'
launcher.cpp: In member function 'void QtLauncher::saveConfig()':
launcher.cpp:288:31: error: no matching function for call to 'QByteArray::indexOf(QString)'
288 | if((index = buffer.indexOf(QString("game_id="))) != -1)
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
Я не представляю как это пофиксить, никак вообще ни в какую. Проект не мой, потому не понимаю особо что к чему, мне дали на компиляцию. Помогите пожалуйста.
Работаю на QT Creator 6.0.1, qt 6.2.3 установлена, mingw, компилятор qmake.
|
|
|
|
|
Здесь присутствуют: 1 (пользователей: 0 , гостей: 1)
|
|
|
|