当前位置: 首页>>代码示例>>C++>>正文


C++ QDir::setCurrent方法代码示例

本文整理汇总了C++中QDir::setCurrent方法的典型用法代码示例。如果您正苦于以下问题:C++ QDir::setCurrent方法的具体用法?C++ QDir::setCurrent怎么用?C++ QDir::setCurrent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDir的用法示例。


在下文中一共展示了QDir::setCurrent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fromDir

void HHCObject::fromDir(int level,QString dir,QString temp){
    QDir dirModel;
    dirModel.setCurrent(dir);
    QStringList list = dirModel.entryList();
    if(list.contains("index.html",Qt::CaseInsensitive)){
        QFileInfo fileInfo(dir+"/index.html");
        QString absDir = temp.length()>0?temp+"/index.html":"index.html";
        treeModel->addModelData(level, "index.html",absDir);
    }else if(list.contains("index.htm",Qt::CaseInsensitive)){
        QFileInfo fileInfo(dir+"/index.htm");
        QString absDir = temp.length()>0?temp+"/index.htm":"index.htm";
        treeModel->addModelData(level, "index.htm",absDir);
    }
    foreach(QString fileName,list){        
        if(fileName.compare(".")==0||fileName.compare("..")==0||fileName.compare("index.htm")==0||fileName.compare("index.html")==0){
            continue;
        }
        if(!(fileName.endsWith(".htm",Qt::CaseInsensitive)||fileName.endsWith(".html",Qt::CaseInsensitive))){
            continue;
        }
        QFileInfo fileInfo(dir+"/"+fileName);
        QString absDir = temp.length()>0?temp+"/"+fileName:fileName;
        treeModel->addModelData(level, fileName,absDir);
        if(fileInfo.isDir()){
            level++;
            fromDir(level*4,dir+"/"+fileName,absDir);
            level--;
        }
    }
    save();
}
开发者ID:jagens,项目名称:chmcreator,代码行数:31,代码来源:hhcobject.cpp

示例2: QImage

void CCCITT4Client::OnFilesListItemClicked(QListWidgetItem *pItem)
{
    QImage *pImage;
    QString sFilename;
    QDir oDir;
    QMessageBox msgBox;

    oDir.setCurrent(ui->lineEditPath->text());

    sFilename = oDir.absoluteFilePath(pItem->text());

    this->ui->graphicsView->Scene->clear();

    pImage = new QImage(sFilename);
    if(pImage->isNull())
    {
        msgBox.setText(QString("Can't' open the file: %1").arg(sFilename));
        msgBox.exec();

        /* Update the file list because it seems to be corrupt */
        UpdateFileList();

        return;
    }

    this->ui->graphicsView->Scene->addItem(new QGraphicsPixmapItem(QPixmap::fromImage(*pImage)));
    this->show();

    /* Move the splitter to enhance the image viewer. */
    setVerticalSpitter(0, 80);
}
开发者ID:freecores,项目名称:bw_tiff_compression,代码行数:31,代码来源:CCITT4Client.cpp

示例3: updateNote

void BinaryWidget::updateNote()
{
    NoteWidget::updateNote();
    if(note->getPath() != path->text())
    {
        QString p = path->text();
        if(SettingsDialog::binaryCopy()){
            QDir d;
            d.setCurrent(NotesManager::getInstance()->getPath());
            d.mkdir("files");
            QDir b(d.absoluteFilePath("files"));
            if(p.indexOf("http://") == 0){ // download from internet with a dialog
                tmp_dest = b.absoluteFilePath(p.split("/").last());
                download(p);
            }
            else if(p != "" && !p.contains(d.absolutePath())){
                QString new_p =  b.absoluteFilePath(QFileInfo(p).fileName());
                QFile(p).copy(new_p);
                path->setText(new_p);
            }
        }
        NotesManager::getInstance()->getHistory()->addAndExec(
                    new ModifyBinaryPath(note,path->text()));
        updateBinaryWidget();
        note->setModified(true);
        NotesManager::getInstance()->setNoteModified();
    }
    if(note->getDescription() != description->toPlainText()){
        NotesManager::getInstance()->getHistory()->addAndExec(
                    new ModifyBinaryDescription(note,description->toPlainText()));
        note->setModified(true);
        NotesManager::getInstance()->setNoteModified();
    }
}
开发者ID:mdamien,项目名称:NotesManager,代码行数:34,代码来源:binarywidget.cpp

示例4: readError

/* read in saved IQ error data
 */
bool Spectrum::readError()
{
    QDir       directory;
    directory.setCurrent(userDirectory);
    QByteArray fname = "iq" + QByteArray::number(nrig) + ".dat";
    QFile      file(fname);
    if (!file.open(QIODevice::ReadOnly)) {
        return(false);
    }
    QDataStream in(&file);
    for (int i = 0; i < sizeIQ; i++) {
        calibSigList[i].n       = 0;
        calibSigList[i].zsum[0] = 0.;
        calibSigList[i].zsum[1] = 0.;
    }
    while (!in.atEnd()) {
        int       i;
        long long n;
        double    x, y;
        in >> i;
        in >> n;
        in >> x >> y;
        if (i >= 0 && i < sizeIQ) {
            calibSigList[i].n       = n;
            calibSigList[i].zsum[0] = x;
            calibSigList[i].zsum[1] = y;
            calibSigList[i].z[0]    = calibSigList[i].zsum[0] / calibSigList[i].n;
            calibSigList[i].z[1]    = calibSigList[i].zsum[1] / calibSigList[i].n;
        }
    }
    file.close();
    return(true);
}
开发者ID:no3m,项目名称:so2sdr,代码行数:35,代码来源:spectrum.cpp

示例5: setCurrentFileName

//! set file name
void TextEdit::setCurrentFileName(const QString &curPath)
{
	path = curPath + "/help/";
	QDir dir;
	dir.mkpath(path);
	textEdit->document()->setModified(false);
	dir.setCurrent(path);
}
开发者ID:ferustigris,项目名称:code-generator,代码行数:9,代码来源:textedit.cpp

示例6: resourcesPath

QString Config::resourcesPath()
{
#ifdef Q_OS_LINUX
    QDir resourcesDir;
    resourcesDir.setCurrent("/usr/share/qstamina");
    if( !resourcesDir.exists() )
        resourcesDir.setCurrent(QApplication::applicationDirPath());
    return resourcesDir.absolutePath();
#endif
#ifdef Q_OS_MACX
    return QApplication::applicationDirPath()+"/../Resources";
#endif
#ifdef Q_OS_WIN
    return QApplication::applicationDirPath();
#endif
    return QString();
}
开发者ID:DragonZX,项目名称:qstamina,代码行数:17,代码来源:config.cpp

示例7: removeMakefile

bool TestCompiler::removeMakefile( const QString &workPath )
{
    QDir D;
    D.setCurrent( workPath );
    if ( D.exists( "Makefile" ) )
        return D.remove( "Makefile" );
    else
        return true;
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:9,代码来源:testcompiler.cpp

示例8: writeNotes

/*!
   append note to file

   @todo File write error not handled
 */
void NoteDialog::writeNotes()
{
    QDir  directory;
    directory.setCurrent(noteDir);
    QFile file(noteFile);
    if (file.open(QIODevice::Append | QIODevice::Text)) {
        file.write(NoteLineEdit->text().toAscii().data());
        file.write("\n");
        file.close();
    }
}
开发者ID:EQ4,项目名称:so2sdr,代码行数:16,代码来源:notedialog.cpp

示例9: setDefaultDestinationFolderPath

void AMExportController::setDefaultDestinationFolderPath()
{
	QDir exportDir;
	if(!AMUserSettings::remoteDataFolder.isEmpty())
		exportDir.setCurrent(AMUserSettings::remoteDataFolder);
	else
		exportDir.setCurrent(AMUserSettings::userDataFolder);
	exportDir.cdUp();

	if(!exportDir.entryList(QDir::AllDirs).contains("exportData")){
		if(!exportDir.mkdir("exportData")){

			AMErrorMon::alert(this, AMSCANACTION_CANT_CREATE_EXPORT_FOLDER, "Could not create the auto-export folder.");
			return;
		}
	}

	exportDir.cd("exportData");

	setDestinationFolderPath(exportDir.absolutePath());
}
开发者ID:acquaman,项目名称:acquaman,代码行数:21,代码来源:AMExportController.cpp

示例10: make

bool TestCompiler::make( const QString &workPath, const QString &target )
{
    QDir D;
    D.setCurrent( workPath );

    QString cmdline = makeCmd_;
    if ( cmdline.contains("nmake", Qt::CaseInsensitive) )
        cmdline.append(" /NOLOGO");
    if ( !target.isEmpty() )
        cmdline += " " + target;

    return runCommand( cmdline );
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:13,代码来源:testcompiler.cpp

示例11: _set_temp_env

/**
 * @brief Copies model binary to the temporary folder.
 * @param temp_path     System temporary folder.
 * @return              0 if success.
 */
int BinaryHandler::_set_temp_env(const QString& temp_path)
{
    QDir qdir;
    qdir.setCurrent(temp_path);

    // Set up a bin directory where to move the model binaries.
    if (!qdir.exists("bin")) {
        qdir.mkdir("bin");
    }
    QString temp_bin_path = temp_path + "/bin";
    qdir.setCurrent(temp_bin_path);

    // Assuming the model binaries reside under ../Resources/bin/ relative
    // to the app. dir.
    QDir resources(QCoreApplication::applicationDirPath());
    resources.cd(RESOURCES);
    resources.cd("bin");

    if (DEBUG_MODE) {
        fprintf(stderr, "Model resources directory: %s\n",
                resources.path().toStdString().c_str());
        fprintf(stderr, "Application directory: %s\n",
                QCoreApplication::applicationDirPath().toStdString().c_str());
        fprintf(stderr, "Current directory: '%s'\n",
                qdir.currentPath().toStdString().c_str());
    }

    QStringList files = resources.entryList(QDir::Files);
    for (auto& f : files) {
        auto dest = temp_bin_path+"/"+f;
        if (QFile::exists(dest)) {
            QFile::remove(dest);
        }
        QFile::copy(resources.path()+"/"+f, dest);
    }

    return 0;
}
开发者ID:tjhakkin,项目名称:MorphoMaker,代码行数:43,代码来源:binaryhandler.cpp

示例12: init_model

/**
 * @brief Initialize binary model.
 * @param temp_path     System temporary folder.
 * @param max_cores     Maximum number of CPU cores (not used).
 * @param tlife         Toothlife object for results.
 * @param num_iter      Number of iterations.
 * @param step_size     Step size.
 * @param id            Unique run ID.
 * @return              0 if success, else -1.
 */
int BinaryHandler::init_model(const QString& temp_path, const int max_cores,
                              ToothLife& tlife, const int num_iter,
                              const int step_size, const int id)
{
    (void)max_cores;
    _binary = QString(modelBin.c_str());
    _id = id;
    _toothLife = &tlife;
    systemTempPath = temp_path;

    _set_temp_env(temp_path);

    QDir qdir;
    qdir.setCurrent(temp_path);
    QString run_folder = QString::number(_id);
    qdir.mkdir(run_folder);
    qdir.setCurrent(run_folder);

    QString parfile;
    QTextStream str;
    str.setString(&parfile);
    str << temp_path << "/" << run_folder << "/mpar_" << _id << ".txt";
    int rv = morphomaker::Export_parameters( parameters, parfile.toStdString(),
                                             _input_style );
    if (rv) {
        return -1;
    }
    stepSize = step_size;
    nIter = num_iter;

    // Can't send the parameter file with the full path to the binary,
    // as some programs have difficulties with long arguments.
    parfile = "";
    str << "mpar_" << _id << ".txt";
    _set_bin_settings( parfile, num_iter, step_size );

    return 0;
}
开发者ID:tjhakkin,项目名称:MorphoMaker,代码行数:48,代码来源:binaryhandler.cpp

示例13: loadAlbums

void Controller::loadAlbums()
{
    QDir dir;
    dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
    dir.setSorting(QDir::Name);
    dir.setCurrent(m_pParser->getDirectory());

    QFileInfoList list = dir.entryInfoList();
    for(int i = 0; i < list.count(); ++i)
    {
         QFileInfo fileInfo = list.at(i);
         m_pParser->setFile(fileInfo.baseName());
         m_listAlbums.insert(fileInfo.baseName(),new Album(m_pParser->getAlbumFromFile(fileInfo.baseName())));
    }
}
开发者ID:KyryloBR,项目名称:PictureSubmarine,代码行数:15,代码来源:controller.cpp

示例14: makeClean

bool TestCompiler::makeClean( const QString &workPath )
{
    QDir D;
    if (!D.exists(workPath)) {
        testOutput_.append( "Directory '" + workPath + "' doesn't exist" );
        return false;
    }

    D.setCurrent(workPath);
    QFileInfo Fi( workPath + "/Makefile");
    if (Fi.exists())
        // Run make clean
        return runCommand( makeCmd_ + " clean" );

    return true;
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:16,代码来源:testcompiler.cpp

示例15: readImages

void MainWindow::readImages(const QString& dirname)
{
   m_loadDialog = new LoadDialog(this);
   m_loadDialog->show();
   QDir dir;
   dir.setCurrent(dirname);
   QList<QString> filenames(dir.entryList(QDir::Files, QDir::Name));
   m_loadWatcher = new QFutureWatcher<QList<ProcessedImage> >(this);
   connect(m_loadWatcher, SIGNAL(progressValueChanged(int)),
           m_loadDialog, SLOT(update(int)));
   connect(m_loadWatcher, SIGNAL(progressRangeChanged(int, int)),
           m_loadDialog, SLOT(updateRange(int, int)));
   connect(m_loadWatcher, SIGNAL(finished()), this, SLOT(finishedReadImages()));
   m_loadWatcher->setFuture(QtConcurrent::mappedReduced(filenames, processImage,
                                                        buildImageList));
}
开发者ID:upstreammuse,项目名称:image-compare,代码行数:16,代码来源:mainwindow.cpp


注:本文中的QDir::setCurrent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。