C++ (Qt) if (destFile.open(QIODevice::WriteOnly | QIODevice::Text)) { QTextStream stream(&destFile1); stream.setCodec("UTF-16LE"); bom ( stream ); stream << "New" + text + "_v1.0\"\n"; stream << "Content"; stream.flush(); destFile.close(); }
C++ (Qt) = new QComboBox(); newComboBox->addItem("abbr1"); newComboBox->addItem("abbr2");
C++ (Qt) QString text = newComboBox->currentText();
C++ (Qt)typedef QMap <QString, QString> TMap;TMap theMap; // заполняем мапуtheMap["abbr1"] = "abbreviation1";theMap["abbr2"] = "abbreviation2"; // находим полное имя по ключу (shortName)QString shortName = "abbr1";QString fullName = theMap.value(shortName, ""); // fullName = "abbreviation1"// или пустая строка если ключа нет
C++ (Qt)QHash<QString, QString> hash; hash.insert("abbr1", "abbreviation1");hash.insert("abbr2", "abbreviation2"); QString text = newComboBox->currentText(); QString text2 = hash[text];