2

Сколько вообще символов в QString вставить?

Я смотрю, там есть какой то лимит, или я незнаю. Короче, часть символов просто режется при выводе, или обработке при этом размер показывается тот же, что и число символов с тем, что размер фиксируется разный. Почему?

Я конечно подсчитал кол-во символов (1019) но может это от системы зависит, я не знаю.

QString la =  "and the qMin() and qMax() functions, that return the minimum or maximum of two ... QString, QByteArray, and QVariant are three classes that have many things in ... C++ natively provides two kinds of strings: traditional C-style ' / 0'-terminated ... The length() function returns the size of the entire string, including embeddedand the qMin() and qMax() functions, that return the minimum or maximum of two ... QString, QByteArray, and QVariant are three classes that have many things in ... C++ natively provides two kinds of strings: traditional C-style ' / 0'-terminated ... The length() function returns the size of the entire string, including embeddedand the qMin() and qMax() functions, that return the minimum or maximum of two ... QString, QByteArray, and QVariant are three classes that have many things in ... C++ natively provides two kinds of strings: traditional C-style ' / 0'-terminated ... The length() function returns the size of the entire string, including embeddedand the qMin() and qMax() functions, that return the minimum or maximum of two ... QString, QByteArray, and QVariant are three classes that have many things in ... C++ natively provides two kinds of strings: traditional C-style ' / 0'-terminated ... The length() function returns the size of the entire string, including embedded";
qDebug() <<"la size=" <<la.length();
qDebug() <<"la=" <<la;

la += "Madoka Magika is my favorite anime";
qDebug() << "la2 size=" << la.length();
qDebug() << "la2=" << la;

Вывод:

la size= 1316
la= "and the qMin() and qMax() functions, that return the minimum or maximum of two ... QString, QByteArray, and QVariant are three classes that have many things in ... C++ natively provides two kinds of strings: traditional C-style ' / 0'-terminated ... The length() function returns the size of the entire string, including embeddedand the qMin() and qMax() functions, that return the minimum or maximum of two ... QString, QByteArray, and QVariant are three classes that have many things in ... C++ natively provides two kinds of strings: traditional C-style ' / 0'-terminated ... The length() function returns the size of the entire string, including embeddedand the qMin() and qMax() functions, that return the minimum or maximum of two ... QString, QByteArray, and QVariant are three classes that have many things in ... C++ natively provides two kinds of strings: traditional C-style ' / 0'-terminated ... The length() function returns the size of the entire string, including embeddedand the qMin() and qMax() functiÉè&
la2 size= 1350
la2= "and the qMin() and qMax() functions, that return the minimum or maximum of two ... QString, QByteArray, and QVariant are three classes that have many things in ... C++ natively provides two kinds of strings: traditional C-style ' / 0'-terminated ... The length() function returns the size of the entire string, including embeddedand the qMin() and qMax() functions, that return the minimum or maximum of two ... QString, QByteArray, and QVariant are three classes that have many things in ... C++ natively provides two kinds of strings: traditional C-style ' / 0'-terminated ... The length() function returns the size of the entire string, including embeddedand the qMin() and qMax() functions, that return the minimum or maximum of two ... QString, QByteArray, and QVariant are three classes that have many things in ... C++ natively provides two kinds of strings: traditional C-style ' / 0'-terminated ... The length() function returns the size of the entire string, including embeddedand the qMin() and qMax() functÕê$ 
3
  • qDebug() имеет ограничение на вывод символов, но там лимит должен быть явно больше 1500 знаков.
    – evilnw
    22 мая 2017 в 9:38
  • Возможно, длинную строку режет компилятор, ломая при этом кодировку. Попробуйте разбить строку на две части, а потом сложить. Сомнительно, что проблема в QString. Тут есть похожее упоминание: msdn.microsoft.com/ru-ru/library/sx08afx2.aspx
    – Ariox
    23 мая 2017 в 18:02
  • да нету там лимита, мегабайты спокойно влазят 19 фев 2020 в 6:43

1 ответ 1

2

Возможно, длинную строку режет компилятор, ломая при этом кодировку. Попробуйте разбить строку на две части, а потом сложить. Сомнительно, что проблема в QString. Тут есть похожее упоминание: msdn.microsoft.com/ru-ru/library/sx08afx2.aspx
– Виктор Смирнов 23 май в 18:02

В принципе думаю мне тут написали правильный ответ, проблема у меня была только в дебаг режиме. Когда я запустил программу не в режиме отладки, то все нормально выводилось в консоль.

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.