本文整理汇总了C++中QTextStream函数的典型用法代码示例。如果您正苦于以下问题:C++ QTextStream函数的具体用法?C++ QTextStream怎么用?C++ QTextStream使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了QTextStream函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: regex
void SearchWidget::accept()
{
if(ui->checkBox_regex->isChecked()) {
QRegExp regex(ui->comboBox_search->currentText(),
ui->checkBox_caseSensitive->isChecked() ? Qt::CaseSensitive: Qt::CaseInsensitive,
QRegExp::RegExp2);
if(!regex.isValid()) {
QString message;
QTextStream(&message)
<< tr("The pattern \"")
<< ui->comboBox_search->currentText()
<< tr("\" is invalid.");
QMessageBox::critical(this, YApplication::displayAppName(), message);
ui->comboBox_search->setFocus();
return;
}
}
SearchCriteria sc(
ui->comboBox_search->currentText(),
ui->checkBox_caseSensitive->isChecked(),
ui->checkBox_regex->isChecked());
SearchInfo::instance().acceptNewSearch(sc);
QDialog::accept();
}
开发者ID:MrMontag,项目名称:yata,代码行数:24,代码来源:SearchWidget.cpp
示例2: processAnswer
void HardwareHiqsdr :: processAnswer (QStringList list)
{
if (list[0] == "*getserial?") {
// try to set the serial
qDebug() << Q_FUNC_INFO<<list[2];
// change the title bar
QString x;
x.clear();
QTextStream(&x) << windowTitle() << " - SN: " << list[2];
setWindowTitle(x) ;
}
if (list[0] == "*getpreselector?") {
// try to set the serial
qDebug() << Q_FUNC_INFO << list [1] << list[2] << list[3] ;
// change the preselector buttons
int x = list[1].toInt() ;
if (x >= 0 && x < 16) {
psel[x]->setText(list[3]);
}
}
if (list[0] == "getpreampstatus?") {
// try to set the serial
qDebug() << Q_FUNC_INFO << list [1] << list[2] << list[3] ;
// change the preamp button
int x = list[1].toInt() ;
if (x >= 0 && x <= 1) {
preampVal = x;
preamp->setChecked((preampVal == 1) ? true : false);
}
}
}
开发者ID:wmoore,项目名称:ghpsdr3-ng,代码行数:36,代码来源:HardwareHiqsdr.cpp
示例3: QDir
// search local database for discID
bool Dbase::Search(Cddb::Matches& res, const Cddb::discid_t discID)
{
res.matches.empty();
if (CacheGet(res, discID))
return true;
QFileInfoList list = QDir(GetDB()).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
for (QFileInfoList::const_iterator it = list.begin(); it != list.end(); ++it)
{
QString genre = it->baseName();
QFileInfoList ids = QDir(it->canonicalFilePath()).entryInfoList(QDir::Files);
for (QFileInfoList::const_iterator it2 = ids.begin(); it2 != ids.end(); ++it2)
{
if (it2->baseName().toUInt(0,16) == discID)
{
QFile file(it2->canonicalFilePath());
if (file.open(QIODevice::ReadOnly | QIODevice::Text))
{
Cddb::Album a = QTextStream(&file).readAll();
a.discGenre = genre;
a.discID = discID;
LOG(VB_MEDIA, LOG_INFO, QString("LocalCDDB found %1 in ").
arg(discID,0,16) + genre + " : " +
a.artist + " / " + a.title);
CachePut(a);
res.matches.push_back(Cddb::Match(genre,discID,a.artist,a.title));
}
}
}
}
return res.matches.size() > 0;
}
开发者ID:ChristopherNeufeld,项目名称:mythtv,代码行数:37,代码来源:cddb.cpp
示例4: luaCoreFile
luabind::object LuaEngine::loadClassAPI(const QString &path)
{
if(loadedFiles.contains(path))
{
return loadedFiles[path];
}
QFile luaCoreFile(path);
if(!luaCoreFile.open(QIODevice::ReadOnly)){
qWarning() << "Failed to load up \"" << path << "\"! Wrong path or insufficient access?";
shutdown();
return luabind::object();
}
//Now read our code.
QString luaCoreCode = QTextStream(&luaCoreFile).readAll();
//Now load our code by lua and check for common compile errors
int errorCode = luautil_loadclass(L, luaCoreCode.toLocal8Bit().data(), luaCoreCode.length(), m_coreFile.section('/', -1).section('\\', -1).toLocal8Bit().data());
//If we get an error, then handle it
if(errorCode){
qWarning() << "Got lua error, reporting...";
m_errorReporterFunc(QString(lua_tostring(L, -1)), QString(""));
m_lateShutdown = true;
return luabind::object();
}
luabind::object tReturn(luabind::from_stack(L, -1));
if(luabind::type(tReturn) != LUA_TUSERDATA){
qWarning() << "Invalid return type of loading class";
return luabind::object();
}
loadedFiles[path]=tReturn;
return tReturn;
}
开发者ID:zigurana,项目名称:PGE-Project,代码行数:36,代码来源:lua_engine.cpp
示例5: switch
void UI::actionMedium() {
QString command;
// reset the current selection
switch(agc) {
case AGC_LONG:
widget.actionLong->setChecked(FALSE);
break;
case AGC_SLOW:
widget.actionSlow->setChecked(FALSE);
break;
case AGC_MEDIUM:
widget.actionMedium->setChecked(FALSE);
break;
case AGC_FAST:
widget.actionFast->setChecked(FALSE);
break;
}
agc=AGC_MEDIUM;
command.clear(); QTextStream(&command) << "SetAGC " << agc;
connection.sendCommand(command);
}
开发者ID:8cH9azbsFifZ,项目名称:ghpsdr3,代码行数:24,代码来源:UI.cpp
示例6: QTextStream
void Pt_MSlider::cleanup()
{
// save a shot (for debugging)
#define SCREENSHOT
#ifdef SCREENSHOT
QString kuva;
QTextStream(&kuva)
<< "view_"
<< ".png";
if (!written.contains(kuva)) {
this->pixmap->save(kuva, "png", -1);
this->written.append(kuva);
}
#endif
delete this->m_subject;
this->m_subject = 0;
delete this->painter;
this->painter = 0;
delete this->pixmap;
this->pixmap = 0;
}
开发者ID:arcean,项目名称:libmeegotouch-framework,代码行数:24,代码来源:pt_mslider.cpp
示例7: QGraphicsScene
PixelScene::PixelScene(QObject *parent) :
QGraphicsScene(parent)
{
for(int i = 0; i < windowYNumber*windowXNumber*windowHeight*windowWidth; i++)
pixels.append(new Pixel());
for(int i = 0; i < windowYNumber; i++)
{
for(int j = 0; j < windowXNumber; j++)
{
Window* w = new Window();
for(int k = 0; k < windowHeight; k++)
{
for(int l = 0; l < windowWidth; l++)
{
int x1 = j*windowWidth*pixelSize + j*gapWidth + l*pixelSize;
int x2 = j*windowWidth*pixelSize + j*gapWidth + (l+1)*pixelSize;
int y1 = i*windowHeight*pixelSize + i*gapHeight + k*pixelSize;
int y2 = i*windowHeight*pixelSize + i*gapHeight + (k+1)*pixelSize;
int index = i*windowWidth*windowHeight*windowXNumber + j*windowWidth + k*windowWidth*windowXNumber + l;
pixels[index]->rect.adjust(x1,y1,x2,y2);
pixels[index]->window = w;
pixels[index]->index = index;
w->indexes.append(index);
addItem(pixels[index]);
}
}
windows.append(w);
}
}
onlypixelswidth = pixelSize * windowWidth * windowXNumber;
onlypixelsheight = pixelSize * windowHeight * windowYNumber;
width = onlypixelswidth + gapWidth * (windowXNumber-1);
height = onlypixelsheight + gapHeight * (windowYNumber-1);
QTextStream(stdout) << "Onlypixels:" << endl;
QTextStream(stdout) << onlypixelswidth << endl;
QTextStream(stdout) << onlypixelsheight << endl;
QTextStream(stdout) << "Whole image:" << endl;
QTextStream(stdout) << width << endl;
QTextStream(stdout) << height << endl;
}
开发者ID:sophiemax,项目名称:AnimE,代码行数:41,代码来源:pixelscene.cpp
示例8: qDebug
bool Database::addAlbum(Album *newAlbum)
{
int new_id;
QString text;
// obter indice a adicionar
QSqlQuery last_id;
last_id.prepare("select ID_Album from Album order by ID_Album DESC Limit 1;");
if(last_id.exec())
{
last_id.next();
new_id = last_id.value(0).toInt();
qDebug() << "Ultimo ID=" << new_id;
new_id++; // ID do proximo elemento a adicionar
newAlbum->setIdBD(new_id);
}else{
return false;
}
// Adicionar Info à DB
QSqlQuery add_album;
text = "";
QTextStream(&text) << "insert into Album (Nome,Ano,Genero,Diretoria,Descricao) values ('";
QTextStream(&text) << newAlbum->getNome() << "','";
QTextStream(&text) << newAlbum->getAno() << "','";
QTextStream(&text) << newAlbum->getGenero() << "','";
QTextStream(&text) << newAlbum->getDiretoria() << "','";
QTextStream(&text) << newAlbum->getDescricao() << "') ;";
add_album.prepare(text);
if(!add_album.exec())
{
qDebug() << "Album Nao Adicionado";
return false;
}
return true;
}
开发者ID:ferpais,项目名称:Media-Player,代码行数:39,代码来源:database.cpp
示例9: doMagicIn
void doMagicIn(QString path, QString q, QString OPath)
{
QRegExp isMask = QRegExp("*m.gif");
isMask.setPatternSyntax(QRegExp::Wildcard);
QRegExp isBackupDir = QRegExp("*/_backup/");
isBackupDir.setPatternSyntax(QRegExp::Wildcard);
if(isBackupDir.exactMatch(path))
return; //Skip backup directories
if(isMask.exactMatch(q))
return;
QImage target;
QString imgFileM;
QStringList tmp = q.split(".", QString::SkipEmptyParts);
if(tmp.size()==2)
imgFileM = tmp[0] + "m." + tmp[1];
else
return;
//skip unexists pairs
if(!QFile(path+q).exists())
return;
if(!QFile(path+imgFileM).exists())
{
QString saveTo;
QImage image = loadQImage(path+q);
if(image.isNull()) return;
QTextStream(stdout) << QString(path+q+"\n").toUtf8().data();
saveTo = QString(OPath+(tmp[0].toLower())+".gif");
//overwrite source image (convert BMP to GIF)
if(toGif( image, saveTo ) ) //Write gif
{
QTextStream(stdout) <<"GIF-1 only\n";
}
else
{
QTextStream(stdout) <<"BMP-1 only\n";
image.save(saveTo, "BMP"); //If failed, write BMP
}
return;
}
if(!noBackUp)
{
//create backup dir
QDir backup(path+"_backup/");
if(!backup.exists())
{
QTextStream(stdout) << QString("Create backup with path %1\n").arg(path+"_backup");
if(!backup.mkdir("."))
QTextStream(stderr) << QString("WARNING! Can't create backup directory %1\n").arg(path+"_backup");
}
//create Back UP of source images
if(!QFile(path+"_backup/"+q).exists())
QFile::copy(path+q, path+"_backup/"+q);
if(!QFile(path+"_backup/"+imgFileM).exists())
QFile::copy(path+imgFileM, path+"_backup/"+imgFileM);
}
QImage image = loadQImage(path+q);
QImage mask = loadQImage(path+imgFileM);
if(mask.isNull()) //Skip null masks
return;
target = setAlphaMask(image, mask);
if(!target.isNull())
{
//Save before fix
//target.save(OPath+tmp[0]+"_before.png");
//mask.save(OPath+tmp[0]+"_mask_before.png");
QTextStream(stdout) << QString(path+q+"\n").toUtf8().data();
//fix
if(image.size()!= mask.size())
mask = mask.copy(0,0, image.width(), image.height());
mask = target.alphaChannel();
mask.invertPixels();
//Save after fix
//target.save(OPath+tmp[0]+"_after.bmp", "BMP");
QString saveTo;
saveTo = QString(OPath+(tmp[0].toLower())+".gif");
//overwrite source image (convert BMP to GIF)
if(toGif(image, saveTo ) ) //Write gif
{
//.........这里部分代码省略.........
开发者ID:hacheipe399,项目名称:PlatGEnWohl,代码行数:101,代码来源:LazyFixTool.cpp
示例10: dataFile
//.........这里部分代码省略.........
m_nLoadingTrack=0;
for( int i=0,n=tclist.count(); i<n; ++i )
{
QDomNode nd=tclist.at(i).firstChild();
while(!nd.isNull())
{
if( nd.isElement() && nd.nodeName() == "track" )
{
++m_nLoadingTrack;
if( nd.toElement().attribute("type").toInt() == Track::BBTrack )
{
n += nd.toElement().elementsByTagName("bbtrack").at(0)
.toElement().firstChildElement().childNodes().count();
}
nd=nd.nextSibling();
}
}
}
while( !node.isNull() )
{
if( node.isElement() )
{
if( node.nodeName() == "trackcontainer" )
{
( (JournallingObject *)( this ) )->restoreState( node.toElement() );
}
else if( node.nodeName() == "controllers" )
{
restoreControllerStates( node.toElement() );
}
else if( gui )
{
if( node.nodeName() == gui->getControllerRackView()->nodeName() )
{
gui->getControllerRackView()->restoreState( node.toElement() );
}
else if( node.nodeName() == gui->pianoRoll()->nodeName() )
{
gui->pianoRoll()->restoreState( node.toElement() );
}
else if( node.nodeName() == gui->automationEditor()->m_editor->nodeName() )
{
gui->automationEditor()->m_editor->restoreState( node.toElement() );
}
else if( node.nodeName() == gui->getProjectNotes()->nodeName() )
{
gui->getProjectNotes()->SerializingObject::restoreState( node.toElement() );
}
else if( node.nodeName() == m_playPos[Mode_PlaySong].m_timeLine->nodeName() )
{
m_playPos[Mode_PlaySong].m_timeLine->restoreState( node.toElement() );
}
}
}
node = node.nextSibling();
}
// quirk for fixing projects with broken positions of TCOs inside
// BB-tracks
Engine::getBBTrackContainer()->fixIncorrectPositions();
// Connect controller links to their controllers
// now that everything is loaded
ControllerConnection::finalizeConnections();
// resolve all IDs so that autoModels are automated
AutomationPattern::resolveAllIDs();
Engine::mixer()->doneChangeInModel();
ConfigManager::inst()->addRecentlyOpenedProject( fileName );
Engine::projectJournal()->setJournalling( true );
emit projectLoaded();
if ( hasErrors())
{
if ( gui )
{
QMessageBox::warning( NULL, tr("LMMS Error report"), errorSummary(),
QMessageBox::Ok );
}
else
{
QTextStream(stderr) << Engine::getSong()->errorSummary() << endl;
}
}
m_loadingProject = false;
m_modified = false;
m_loadOnLaunch = false;
if( gui && gui->mainWindow() )
{
gui->mainWindow()->resetWindowTitle();
}
}
开发者ID:RebeccaDeField,项目名称:lmms,代码行数:101,代码来源:Song.cpp
示例11: toGif
bool toGif(QImage& img, QString& path)
{
int errcode;
if(QFile(path).exists()) // Remove old file
QFile::remove(path);
GifFileType* t = EGifOpenFileName(path.toLocal8Bit().data(),true, &errcode);
if(!t){
EGifCloseFile(t, &errcode);
QTextStream(stdout) << "Can't open\n";
return false;
}
EGifSetGifVersion(t, true);
GifColorType* colorArr = new GifColorType[256];
ColorMapObject* cmo = GifMakeMapObject(256, colorArr);
bool unfinished = false;
QImage tarQImg(img.width(), img.height(), QImage::Format_Indexed8);
QVector<QRgb> table;
for(int y = 0; y < img.height(); y++){
for(int x = 0; x < img.width(); x++){
if(table.size() >= 256){
unfinished = true;
break;
}
QRgb pix;
if(!table.contains(pix = img.pixel(x,y))){
table.push_back(pix);
tarQImg.setColor(tarQImg.colorCount(), pix);
}
tarQImg.setPixel(x,y,table.indexOf(pix));
}
if(table.size() >= 256){
unfinished = true;
break;
}
}
if(unfinished){
EGifCloseFile(t, &errcode);
QTextStream(stdout) << "Unfinished\n";
return false;
}
for(int l = tarQImg.colorCount(); l < 256; l++){
tarQImg.setColor(l,0);
}
if(tarQImg.colorTable().size() != 256){
EGifCloseFile(t, &errcode);
QTextStream(stdout) << "A lot of colors\n";
return false;
}
QVector<QRgb> clTab = tarQImg.colorTable();
for(int i = 0; i < 255; i++){
QRgb rgb = clTab[i];
colorArr[i].Red = qRed(rgb);
colorArr[i].Green = qGreen(rgb);
colorArr[i].Blue = qBlue(rgb);
}
cmo->Colors = colorArr;
errcode = EGifPutScreenDesc(t, img.width(), img.height(), 256, 0, cmo);
if(errcode != GIF_OK){
EGifCloseFile(t, &errcode);
QTextStream(stdout) << "EGifPutScreenDesc error 1\n";
return false;
}
errcode = EGifPutImageDesc(t, 0, 0, img.width(), img.height(), false, 0);
if(errcode != GIF_OK){
EGifCloseFile(t, &errcode);
QTextStream(stdout) << "EGifPutImageDesc error 2\n";
return false;
}
//gen byte array
GifByteType* byteArr = tarQImg.bits();
for(int h = 0; h < tarQImg.height(); h++){
errcode = EGifPutLine(t, byteArr, tarQImg.width());
if(errcode != GIF_OK){
EGifCloseFile(t, &errcode);
QTextStream(stdout) << "EGifPutLine error 3\n";
return false;
}
byteArr += tarQImg.width();
byteArr += ((tarQImg.width() % 4)!=0 ? 4 - (tarQImg.width() % 4) : 0);
}
if(errcode != GIF_OK){
QTextStream(stdout) << "GIF error 4\n";
return false;
//.........这里部分代码省略.........
开发者ID:hacheipe399,项目名称:PlatGEnWohl,代码行数:101,代码来源:LazyFixTool.cpp
示例12: ReplaceIconResource
//.........这里部分代码省略.........
lpInitGrpIconDir->idEntries[i].nID=(WORD)*test1;
test1=test1+sizeof(WORD);
}
// memcpy( lpInitGrpIconDir->idEntries, test, cbRes-3*sizeof(WORD) );
UnlockResource((HGLOBAL)test1);
LPMEMICONDIR lpGrpIconDir=new MEMICONDIR;
lpGrpIconDir->idReserved=pIconDir->idReserved;
lpGrpIconDir->idType=pIconDir->idType;
lpGrpIconDir->idCount=pIconDir->idCount;
cbRes=3*sizeof(WORD)+lpGrpIconDir->idCount*sizeof(MEMICONDIRENTRY);
test=new BYTE[cbRes];
temp=test;
CopyMemory(test,&lpGrpIconDir->idReserved,sizeof(WORD));
test=test+sizeof(WORD);
CopyMemory(test,&lpGrpIconDir->idType,sizeof(WORD));
test=test+sizeof(WORD);
CopyMemory(test,&lpGrpIconDir->idCount,sizeof(WORD));
test=test+sizeof(WORD);
lpGrpIconDir->idEntries=new MEMICONDIRENTRY[lpGrpIconDir->idCount];
for(i=0;i<lpGrpIconDir->idCount;i++)
{
lpGrpIconDir->idEntries[i].bWidth=pIconDir->idEntries[i].bWidth;
CopyMemory(test,&lpGrpIconDir->idEntries[i].bWidth,sizeof(BYTE));
test=test+sizeof(BYTE);
lpGrpIconDir->idEntries[i].bHeight=pIconDir->idEntries[i].bHeight;
CopyMemory(test,&lpGrpIconDir->idEntries[i].bHeight,sizeof(BYTE));
test=test+sizeof(BYTE);
lpGrpIconDir->idEntries[i].bColorCount=pIconDir->idEntries[i].bColorCount;
CopyMemory(test,&lpGrpIconDir->idEntries[i].bColorCount,sizeof(BYTE));
test=test+sizeof(BYTE);
lpGrpIconDir->idEntries[i].bReserved=pIconDir->idEntries[i].bReserved;
CopyMemory(test,&lpGrpIconDir->idEntries[i].bReserved,sizeof(BYTE));
test=test+sizeof(BYTE);
lpGrpIconDir->idEntries[i].wPlanes=pIconDir->idEntries[i].wPlanes;
CopyMemory(test,&lpGrpIconDir->idEntries[i].wPlanes,sizeof(WORD));
test=test+sizeof(WORD);
lpGrpIconDir->idEntries[i].wBitCount=pIconDir->idEntries[i].wBitCount;
CopyMemory(test,&lpGrpIconDir->idEntries[i].wBitCount,sizeof(WORD));
test=test+sizeof(WORD);
lpGrpIconDir->idEntries[i].dwBytesInRes=pIconDir->idEntries[i].dwBytesInRes;
CopyMemory(test,&lpGrpIconDir->idEntries[i].dwBytesInRes,sizeof(DWORD));
test=test+sizeof(DWORD);
if(i<lpInitGrpIconDir->idCount) //nu am depasit numarul initial de RT_ICON
lpGrpIconDir->idEntries[i].nID=lpInitGrpIconDir->idEntries[i].nID;
else
{
nMaxID++;
lpGrpIconDir->idEntries[i].nID=i+1; //adaug noile ICO la sfarsitul RT_ICON-urilor
}
CopyMemory(test,&lpGrpIconDir->idEntries[i].nID,sizeof(WORD));
test=test+sizeof(WORD);
}
//offsetul de unde incep structurile ICONIMAGE
cbInitOffset=3*sizeof(WORD)+lpGrpIconDir->idCount*sizeof(ICONDIRENTRY);
cbOffset=cbInitOffset; //cbOffset=118
FreeLibrary(hUi);
HANDLE hUpdate;
// _chmod((char*)lpFileName,_S_IWRITE);
hUpdate = BeginUpdateResourceA(lpFileName, FALSE); //false sa nu stearga resursele neupdated
if(hUpdate==NULL)
{
QTextStream(stdout, QIODevice::WriteOnly) << "erreur BeginUpdateResource " << lpFileName << "\n";
res=false;
}
//aici e cu lang NEUTRAL
//res=UpdateResource(hUpdate,RT_GROUP_ICON,MAKEINTRESOURCE(6000),langId,lpGrpIconDir,cbRes);
res=UpdateResource(hUpdate,RT_GROUP_ICON,lpName,langId,temp,cbRes);
if(res==false)
QTextStream(stdout, QIODevice::WriteOnly) << "erreur UpdateResource RT_GROUP_ICON " << lpFileName << "\n";
for(i=0;i<lpGrpIconDir->idCount;i++)
{
res=UpdateResource(hUpdate,RT_ICON,MAKEINTRESOURCE(lpGrpIconDir->idEntries[i].nID),langId,pIconImage[i],lpGrpIconDir->idEntries[i].dwBytesInRes);
if(res==false)
QTextStream(stdout, QIODevice::WriteOnly) << "erreur UpdateResource RT_ICON " << lpFileName << "\n";
}
for(i=lpGrpIconDir->idCount;i<lpInitGrpIconDir->idCount;++i)
{
res=UpdateResource(hUpdate,RT_ICON,MAKEINTRESOURCE(lpInitGrpIconDir->idEntries[i].nID),langId,NULL,0);
if(res==false)
QTextStream(stdout, QIODevice::WriteOnly) << "erreur to delete resource " << lpFileName << "\n";
}
if(!EndUpdateResource(hUpdate,FALSE)) //false ->resource updates will take effect.
QTextStream(stdout, QIODevice::WriteOnly) << "eroare EndUpdateResource" << lpFileName << "\n";
// FreeResource(hGlobal);
delete[] lpGrpIconDir->idEntries;
delete lpGrpIconDir;
delete[] temp;
return res;
}
开发者ID:benjaminlong,项目名称:ResEdit,代码行数:101,代码来源:Main.cpp
示例13: QTextStream
void GroundStation::print_info_packet(Protocol::InfoPacket &packet){
QTextStream(stdout) << "Type: InfoPacket" << endl;
QTextStream(stdout) << "Points Storable: " << packet.GetStorable() << endl;
QTextStream(stdout) << "Battery State: " << packet.GetBattery() << endl;
QTextStream(stdout) << "Other : " << QString::fromStdString(packet.GetOther()) << endl;
}
开发者ID:alvinherot,项目名称:GroundStation,代码行数:6,代码来源:groundstation.cpp
示例14: QTextStream
void Database::moveAchievement(int level, int id){
QString cmd;
QTextStream(&cmd)<<"delete from achievement where level = "<<level*100+id;
query.exec(cmd);
}
开发者ID:ytl13508111107,项目名称:flowFree,代码行数:5,代码来源:database.cpp
示例15: QTextStream
void HuboInitWidget::handleJointStateButton(int id)
{
QString lineStatus;
QString toolStatus;
QTextStream(&lineStatus) << QString::fromLocal8Bit(h_param.joint[id].name) << " ";
QTextStream(&lineStatus) << QString::number(h_state.joint[id].pos) << " -- ";
QTextStream(&toolStatus) << QString::fromLocal8Bit(h_param.joint[id].name) << ":";
if(h_state.status[id].homeFlag != 6)
{
QTextStream(&lineStatus) << "H:" << h_state.status[id].homeFlag << " ";
QTextStream(&toolStatus) << "\nNot Homed";
}
else
QTextStream(&toolStatus) << "\nHomed";
if(h_state.joint[id].zeroed==1)
{
QTextStream(&lineStatus) << "Z ";
QTextStream(&toolStatus) << "\nZeroed";
}
if(h_state.status[id].jam == 1)
{
QTextStream(&lineStatus) << "JAM ";
QTextStream(&toolStatus) << "\nMechanical Jam";
}
if(h_state.status[id].pwmSaturated == 1)
{
QTextStream(&lineStatus) << "PWM ";
QTextStream(&toolStatus) << "\nPWM Saturated";
}
if(h_state.status[id].bigError == 1)
{
QTextStream(&lineStatus) << "BigE ";
QTextStream(&toolStatus) << "\nBig Error (Needs to be Reset)";
}
if(h_state.status[id].encError == 1)
{
QTextStream(&lineStatus) << "ENC ";
QTextStream(&toolStatus) << "\nEncoder Error";
}
if(h_state.status[id].driverFault == 1)
{
QTextStream(&lineStatus) << "DF ";
QTextStream(&toolStatus) << "\nDrive Fault";
}
if(h_state.status[id].posMinError == 1)
{
QTextStream(&lineStatus) << "POS< ";
QTextStream(&toolStatus) << "\nMinimum Position Error";
}
if(h_state.status[id].posMaxError == 1)
{
QTextStream(&lineStatus) << "POS> ";
QTextStream(&toolStatus) << "\nMaximum Position Error";
}
if(h_state.status[id].velError == 1)
{
QTextStream(&lineStatus) << "VEL ";
QTextStream(&toolStatus) << "\nVelocity Error";
}
if(h_state.status[id].accError == 1)
{
QTextStream(&lineStatus) << "ACC ";
QTextStream(&toolStatus) << "\nAcceleration Error";
}
if(h_state.status[id].tempError == 1)
{
QTextStream(&lineStatus) << "TMP ";
QTextStream(&toolStatus) << "\nTemperature Error";
}
stateFlags->setText(lineStatus);
stateFlags->setToolTip(toolStatus);
}
开发者ID:petevieira,项目名称:hubo_init,代码行数:74,代码来源:hubo_init_slots.cpp
示例16: QTextStream
void ImageSearchQuerySettings::addKeyValueToUrl(const QString& key, const QString& val)
{
QString urlPart;
QTextStream(&urlPart) << "&" << key << "=" << QUrl::toPercentEncoding( val );
m_searchUrl.append(urlPart);
}
开发者ID:dreamCatalyst,项目名称:main,代码行数:6,代码来源:imagesearchquerysettings.cpp
示例17: QScriptProgram
void NetworkProgram::downloadFinished(QNetworkReply* reply) {
_program = QScriptProgram(QTextStream(reply).readAll(), reply->url().toString());
reply->deleteLater();
finishedLoading(true);
emit loaded();
}
开发者ID:ey6es,项目名称:hifi,代码行数:6,代码来源:ScriptCache.cpp
示例18: main
int main(int argc, char** argv)
{
QApplication app(argc, argv);
ctkCommandLineParser parser;
// Use Unix-style argument names
parser.setArgumentPrefix("--", "-");
// Add command line argument names
parser.addArgument("help", "h", QVariant::Bool, "Print usage information and exit.");
parser.addArgument("interactive", "I", QVariant::Bool, "Enable interactive mode");
// Parse the command line arguments
bool ok = false;
QHash<QString, QVariant> parsedArgs = parser.parseArguments(QCoreApplication::arguments(), &ok);
if (!ok)
{
QTextStream(stderr, QIODevice::WriteOnly) << "Error parsing arguments: "
<< parser.errorString() << "\n";
return EXIT_FAILURE;
}
// Show a help message
if (parsedArgs.contains("help") || parsedArgs.contains("h"))
{
QTextStream(stdout, QIODevice::WriteOnly) << "ctkSimplePythonShell\n"
<< "Usage\n\n"
<< " ctkSimplePythonShell [options] [<path-to-python-script> ...]\n\n"
<< "Options\n"
<< parser.helpText();
return EXIT_SUCCESS;
}
ctkSimplePythonManager pythonManager;
ctkPythonShell shell(&pythonManager);
shell.setAttribute(Qt::WA_QuitOnClose, true);
shell.resize(600, 280);
shell.show();
shell.setProperty("isInteractive", parsedArgs.contains("interactive"));
pythonManager.addObjectToPythonMain("_ctkPythonShellInstance", &shell);
ctkTestWrappedQProperty testWrappedQProperty;
pythonManager.addObjectToPythonMain("_testWrappedQPropertyInstance", &testWrappedQProperty);
ctkTestWrappedQInvokable testWrappedQInvokable;
pythonManager.addObjectToPythonMain("_testWrappedQInvokableInstance", &testWrappedQInvokable);
ctkTestWrappedSlot testWrappedSlot;
pythonManager.addObjectToPythonMain("_testWrappedSlotInstance", &testWrappedSlot);
#ifdef CTK_WRAP_PYTHONQT_USE_VTK
ctkTestWrappedVTKQInvokable testWrappedVTKQInvokable;
pythonManager.addObjectToPythonMain("_testWrappedVTKQInvokableInstance", &testWrappedVTKQInvokable);
ctkTestWrappedVTKSlot testWrappedVTKSlot;
pythonManager.addObjectToPythonMain("_testWrappedVTKSlotInstance", &testWrappedVTKSlot);
ctkTestWrappedQListOfVTKObject testWrappedQListOfVTKObject;
pythonManager.addObjectToPythonMain("_testWrappedQListOfVTKObjectInstance", &testWrappedQListOfVTKObject);
#endif
foreach(const QString& script, parser.unparsedArguments())
{
pythonManager.executeFile(script);
}
return app.exec();
}
开发者ID:gokhanuzunbas,项目名称:CTK,代码行数:71,代码来源:ctkSimplePythonShellMain.cpp
示例19: QWidget
QWidget *GdbOptionsPage::createPage(QWidget *parent)
{
QWidget *w = new QWidget(parent);
m_ui = new GdbOptionsPageUi;
m_ui->setupUi(w);
m_group.clear();
m_group.insert(debuggerCore()->action(GdbStartupCommands),
m_ui->textEditStartupCommands);
m_group.insert(debuggerCore()->action(LoadGdbInit),
m_ui->checkBoxLoadGdbInit);
m_group.insert(debuggerCore()->action(AutoEnrichParameters),
m_ui->checkBoxAutoEnrichParameters);
m_group.insert(debuggerCore()->action(UseDynamicType),
m_ui->checkBoxUseDynamicType);
m_group.insert(debuggerCore()->action(TargetAsync),
m_ui->checkBoxTargetAsync);
m_group.insert(debuggerCore()->action(WarnOnReleaseBuilds),
m_ui->checkBoxWarnOnReleaseBuilds);
m_group.insert(debuggerCore()->action(AdjustBreakpointLocations),
m_ui->checkBoxAdjustBreakpointLocations);
m_group.insert(debuggerCore()->action(BreakOnWarning),
m_ui->checkBoxBreakOnWarning);
m_group.insert(debuggerCore()->action(BreakOnFatal),
m_ui->checkBoxBreakOnFatal);
m_group.insert(debuggerCore()->action(BreakOnAbort),
m_ui->checkBoxBreakOnAbort);
m_group.insert(debuggerCore()->action(GdbWatchdogTimeout),
m_ui->spinBoxGdbWatchdogTimeout);
m_group.insert(debuggerCore()->action(AttemptQuickStart),
m_ui->checkBoxAttemptQuickStart);
m_group.insert(debuggerCore()->action(UseMessageBoxForSignals),
m_ui->checkBoxUseMessageBoxForSignals);
m_group.insert(debuggerCore()->action(SkipKnownFrames),
m_ui->checkBoxSkipKnownFrames);
m_group.insert(debuggerCore()->action(EnableReverseDebugging),
m_ui->checkBoxEnableReverseDebugging);
m_group.insert(debuggerCore()->action(GdbWatchdogTimeout), 0);
//m_ui->groupBoxPluginDebugging->hide();
//m_ui->lineEditSelectedPluginBreakpointsPattern->
// setEnabled(debuggerCore()->action(SelectedPluginBreakpoints)->value().toBool());
//connect(m_ui->radioButtonSelectedPluginBreakpoints, SIGNAL(toggled(bool)),
// m_ui->lineEditSelectedPluginBreakpointsPattern, SLOT(setEnabled(bool)));
if (m_searchKeywords.isEmpty()) {
QLatin1Char sep(' ');
QTextStream(&m_searchKeywords)
<< sep << m_ui->groupBoxGeneral->title()
<< sep << m_ui->checkBoxLoadGdbInit->text()
<< sep << m_ui->checkBoxTargetAsync->text()
<< sep << m_ui->checkBoxWarnOnReleaseBuilds->text()
<< sep << m_ui->checkBoxUseDynamicType->text()
<< sep << m_ui->labelGdbWatchdogTimeout->text()
<< sep << m_ui->checkBoxEnableReverseDebugging->text()
<< sep << m_ui->checkBoxSkipKnownFrames->text()
<< sep << m_ui->checkBoxUseMessageBoxForSignals->text()
<< sep << m_ui->checkBoxAdjustBreakpointLocations->text()
<< sep << m_ui->checkBoxAttemptQuickStart->text()
// << sep << m_ui->groupBoxPluginDebugging->title()
// << sep << m_ui->radioButtonAllPluginBreakpoints->text()
// << sep << m_ui->radioButtonSelectedPluginBreakpoints->text()
// << sep << m_ui->labelSelectedPluginBreakpoints->text()
// << sep << m_ui->radioButtonNoPluginBreakpoints->text()
;
m_searchKeywords.remove(QLatin1Char('&'));
}
return w;
}
开发者ID:KDE,项目名称:android-qt-creator,代码行数:72,代码来源:gdboptionspage.cpp
示例20: show
bool KOfxDirectConnectDlg::init()
{
show();
QByteArray request = m_connector.statementRequest();
if (request.isEmpty()) {
hide();
return false;
}
// For debugging, dump out the request
#if 0
QFile g("request.ofx");
g.open(QIODevice::WriteOnly);
QTextStream(&g) << m_connector.url() << "\n" << QString(request);
g.close();
#endif
QDir homeDir(QDir::home());
if (homeDir.exists("ofxlog.txt")) {
d->m_fpTrace.setFileName(QString("%1/ofxlog.txt").arg(QDir::homePath()));
d->m_fpTrace.open(QIODevice::WriteOnly | QIODevice::Append);
}
if (d->m_fpTrace.isOpen()) {
QByteArray data = m_connector.url().toUtf8();
d->m_fpTrace.write("url: ", 5);
d->m_fpTrace.write(data, strlen(data));
d->m_fpTrace.write("\n", 1);
d->m_fpTrace.write("request:\n", 9);
QByteArray trcData(request); // make local copy
trcData.replace('\r', "");
d->m_fpTrace.write(trcData, trcData.size());
d->m_fpTrace.write("\n", 1);
d->m_fpTrace.write("response:\n", 10);
}
qDebug("creating job");
m_job = KIO::http_post(QUrl(m_connector.url()), request, KIO::HideProgressInfo);
// open the temp file. We come around here twice if init() is called twice
if (m_tmpfile) {
qDebug() << "Already connected, using " << m_tmpfile->fileName();
delete m_tmpfile; //delete otherwise we mem leak
}
m_tmpfile = new QTemporaryFile();
// for debugging purposes one might want to leave the temp file around
// in order to achieve this, please uncomment the next line
// m_tmpfile->setAutoRemove(false);
if (!m_tmpfile->open()) {
qWarning("Unable to open tempfile '%s' for download.", qPrintable(m_tmpfile->fileName()));
return false;
}
m_job->addMetaData("content-type", "Content-type: application/x-ofx");
connect(m_job, SIGNAL(result(KJob*)), this, SLOT(slotOfxFinished(KJob*)));
connect(m_job, SIGNAL(data(KIO::Job*,QByteArray)), this, SLOT(slotOfxData(KIO::Job*,QByteArray)));
setStatus(QString("Contacting %1...").arg(m_connector.url()));
kProgress1->setMaximum(3);
kProgress1->setValue(1);
return true;
}
开发者ID:KDE,项目名称:kmymoney,代码行数:64,代码来源:kofxdirectconnectdlg.cpp
注:本文中的QTextStream函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论