Privacy policyContactsAbout siteOpinionsGitHubDonate
© EVILEG 2015-2018
Recommend hosting
TIMEWEB
Oct. 26, 2018, 9:35 p.m.

Qt

Qt5, QJsonArray, QJsonObject, QJsonDocument, JSON, Qt

Consider a small example of the formation of a JSON document from, for example, the text and the title of this text.

For example, the text has:

  • Title - First Title
  • Content - First Content

And so on

We will add this text to QJsonObject, which we will add to the QJsonArray text array. The array of objects will be in the general working QJsonObject, which we will save to a file.

We will do all this through a graphical interface in which we have:

  • QLineEdit - titleLineEdit - contains the title of the text to add
  • QTextEdit - contentTextEdit - contains the contents of the text to add
  • QTextEdit - jsonDocumentTextEdit - JSON document preview
  • QPushButton - addButton - button to add new text in JSON
  • QPushButton - clearButton - button to remove all texts from the current QJsonObject
  • QPushButton - saveButton - button to save JSON document to file
  • QPushButton - loadButton - button to read JSON from file

In this case, we will be able to read the JSON file and add additional texts to the read file.

The application will look like this.

June 6, 2018, 8:07 p.m.

Qt

Сериализация, Qt, JSON

В первой части серии статей , автор рассмотрел проблему настройки и объединения сообщений и уменьшения их нагрузки в рамках телеметрических датчиков.

Эта часть посвящена полезной нагрузке от сообщений и её оптимизации.

Jan. 2, 2016, 3:33 p.m.

Qt

JSON, QJsonArray, QJsonDocument, QJsonObject, QJsonValue, QNetworkAccessManager

In the process of writing programs EColor appeared a problem in which it was necessary in some way to notify the user that a new version of the program. The solution to this problem was the presence of JSON file on the site. With QNetworkAccessManager get a JSON file and produce his analysis, thanks to the class library Qt: QJsonDocument , QJsonObject , QJsonArray . In the case of the program on the website EColor contains JSON file with the name of the program, the full version in string form and three entities to the major part of the version, minor and patch version. When parsing the file is compared with the current version of the program that is on the website. If the site is lined with a newer version, the program will notify the user.

v
Jan. 17, 2019, 11:51 a.m.
vitalir12

C ++ - Test 004. Pointers, Arrays and Loops

  • Result:20points,
  • Rating points-10
v
Jan. 17, 2019, 11:49 a.m.
vitalir12

C++ - Test 002. Constants

  • Result:50points,
  • Rating points-4
v
Jan. 17, 2019, 11:13 a.m.
vitalir12

C++ - Тест 003. Условия и циклы

  • Result:28points,
  • Rating points-10
Last comments
I
Jan. 16, 2019, 8:06 a.m.
IscanderChe

Заработало. Забыл model->select(); вписать.
I
Jan. 16, 2019, 8:02 a.m.
IscanderChe

Всё равно пусто, хотя строка с данными в базу добавляется.
Jan. 16, 2019, 7:51 a.m.
Евгений Легоцкой

потому, что нужно сохранять информацию для всех остальных ролей и столбцов через вызов переопределённого метода. Да к тому же вы ещё и зациклили вызов метода data. QVariant MySqlTableModel:...
I
Jan. 16, 2019, 7:43 a.m.
IscanderChe

Сделал вот так. В tableView ничего нет, кроме заголовка. QVariant MySqlTableModel::data(const QModelIndex &index, int role) const{ if (role == Qt::DisplayRole) { QTime ...
Now discuss on the forum
Jan. 18, 2019, 11:26 a.m.
nayk1982

Для Desktop делал так: void pause(int ms){ QTimer timer; timer.setInterval( qBound(1, ms, 3600000) ); timer.setSingleShot(true); QEventLoop loop; QObject::connect(&...
Jan. 17, 2019, 12:01 p.m.
Алексей Внуков

у меня просто есть отдельное поле с чекбоксамими какие колонки нужно отображать CheckBox { id: checkBox text: qsTr("some text") checked: true onC...
Jan. 15, 2019, 4:53 p.m.
Михаиллл

Спасибо, заработало.Но выдало обычный текст без форатирования HTML.Придется искать дальше
Jan. 15, 2019, 12:52 p.m.
BlinCT

Я же вам выше написал CLion умеет работать с ремоут машинами. И Qt так же собирает.
Join us in social networks

For registered users on the site there is a minimum amount of advertising