C++ (Qt) for( QList< QString >::const_iterator i = itemList.constBegin(); i != itemList.constEnd(); ++i ) text.addItem( Text::Item( 1, *i ) );
C++ (Qt) foreach (QString itm, itemList)text.addItem( Text::Item( 1, itm ) );
C++ (Qt)void MainWindow::bufferButtonSave(){ QClipboard *clipboard = QApplication::clipboard(); QString originalText = clipboard->text(); originalText.replace(QRegExp("\\W"), " "); originalText.replace(QRegExp("\\d"), " "); QTextStream fileStream( & originalText ); QString itemStr, trimmedStr; QStringList itemList; QString nnn; textory.clear(); do { // Пословно fileStream >>(itemStr); // Построчно// itemStr = fileStream.readLine(); trimmedStr = itemStr.trimmed();// Убираем пустышку if( trimmedStr.isEmpty() ) continue; QRegExp rx("\\b(" + trimmedStr + ")\\b"); int coun(0); int pos = 0; while ((pos = rx.indexIn(originalText, pos)) != -1) { ++coun; ++pos; } nnn.setNum(coun); trimmedStr = trimmedStr + nnn; itemList.prepend( trimmedStr ); } while( !fileStream.atEnd() ); textory.enableAdd( true ); foreach (QString itm, itemList)textory.addItem( Textory::Item( 1, itm ) ); textory.enableAdd( cfg.preferences.storeTextory );}
C++ (Qt) QClipboard *clipboard = QApplication::clipboard(); QString xt = clipboard->text(); QString originalText = xt.trimmed();