本文整理汇总了C++中QDir::currentPath方法的典型用法代码示例。如果您正苦于以下问题:C++ QDir::currentPath方法的具体用法?C++ QDir::currentPath怎么用?C++ QDir::currentPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDir
的用法示例。
在下文中一共展示了QDir::currentPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fileShareContentChanged
void NfcSharing::fileShareContentChanged(QString paths) {
NfcShareFilesContent request;
QList<QUrl> urls;
QDir dir;
QStringList list = paths.split(",");
qDebug() << "XXXX Current Path" << dir.currentPath() << endl;
qDebug() << "XXXX Home Path" << dir.homePath() << endl;
qDebug() << "XXXX Temp Path" << dir.tempPath() << endl;
QString publicPath(dir.currentPath().append("/app/public/"));
for (int i = 0; i < list.size(); ++i) {
QUrl url(QString("file://").append(publicPath).append(list.at(i)));
urls.append(url);
QFileInfo fi(url.toLocalFile());
qDebug() << "XXXX To Local File" << url.toLocalFile() << endl;
qDebug() << "XXXX File String" << list.at(i) << endl;
qDebug() << "XXXX File URL" << url << endl;
qDebug() << "XXXX Absolute File Path" << fi.absoluteFilePath() << endl;
qDebug() << "XXXX Absolute Path" << fi.absolutePath() << endl;
}
request.setFileUrls(urls);
NfcShareSetContentError::Type rc = _nfcShareManager->setShareContent(request);
qDebug() << "XXXX File setShareContent rc=" << rc << endl;
}
示例2: recorverCadFile
bool recorverCadFile()
{
QDir lsDir;
//QString cadPath = lsDir.homePath();
//cadPath.append("/AppData/Roaming/Autodesk/AutoCAD 2010/R18.0/chs/Support");
QString cadPath = getCADPath("RoamableRootFolder",CURRENT_USER);
cadPath.append("/Support");
lsDir.setPath(cadPath);
//filepath == "C:\Users\Username\AppData\Roaming\Autodesk\AutoCAD 2010\R18.0\chs\Support"
QString filepath = lsDir.filePath("acad.CUIX");
//filepath == "C:\Users\Username\AppData\Roaming\Autodesk\AutoCAD 2010\R18.0\chs\Support\hd.txt"
//获取当前程序(.exe)所在的路径
QString CurrentPath = lsDir.currentPath();
QString fromDir = CurrentPath;
fromDir.append("/Datas/CAD/acad.CUIX");
//文件来自:当前程序所在位置+"/Datas/JL/hd.txt"
QString toDir = filepath;
if(!copyFileToPath(fromDir,toDir,true)) return false;
filepath = lsDir.filePath("acad.mnr");
CurrentPath = lsDir.currentPath();
fromDir = CurrentPath;
fromDir.append("/Datas/CAD/acad.mnr");
toDir = filepath;
return copyFileToPath(fromDir,toDir,true);
}
示例3: mouseReleaseEvent
void EditSelectPlugin::mouseReleaseEvent(QMouseEvent * event, MeshModel &m, GLArea * gla)
{
qDebug()<<"mouseReleaseEvent";
gla->update();
prev=cur;
cur=event->pos();
isDragging = false;
//output current selected faces and verts
QDir dir;
//ÉèÖÃÊä³öÎļþ
std::string ofs=dir.currentPath().toStdString();
ofs.append("/selected_faces.txt");
ofstream oo(ofs.c_str());
CMeshO& cm=m.cm;
for (int i = 0; i < cm.fn; i++) {
if(cm.face[i].IsS()){
// oo<<i+1<<endl; //we output the index+1, so it can be directly used in matlab
oo<<i<<endl; //we want to use it directly in meshlab now!
qDebug()<<i;
}
}
oo.close();
ofs=dir.currentPath().toStdString();
ofs.append("/selected_verts.txt");
oo.open(ofs.c_str());
for (int i = 0; i < cm.vn; i++) {
if(cm.vert[i].IsS()){
oo<<i<<endl; //we want to use it directly in meshlab now!
qDebug()<<i;
}
}
oo.close();
}
示例4: on_pushButton_clicked
void RongHe::on_pushButton_clicked()
{
QString path;
QDir dir;
path=dir.currentPath();
// QStringList files = QFileDialog::getOpenFileNames(
// this,
// "Select one or more files to open",
// "/home",
// tr("All Files (*);;HDF5 Files (*.h5)"));
QDir::setCurrent(path+"\\SST");
QProcess::startDetached("InverseDistance.exe",QStringList());
QDir::setCurrent(path);
/*//测试Demo窗体,解注释即可查看效果
Demo *demoDlg = new Demo() ;
QDesktopWidget* desktop = QApplication::desktop();
int x,y;
x=(desktop->width() - demoDlg->width())/2;
y=(desktop->height() - demoDlg->height())/2-20;
demoDlg->setGeometry(x,y,1,429);
demoDlg->setModal(true);
demoDlg->show();
*/
}
示例5: send
void postoperation::send() //连接到服务器,执行发送
{
ui->pbsendfile->setEnabled(false);
bytesWritten = 0;
//初始化已发送字节为0
QDir dir;
QString path = dir.currentPath();
path += "/setting";
QDir dir2(path);
QString settingname;
if(dir2.exists())
{
dir2.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir2.setSorting(QDir::Size | QDir::Reversed);
QFileInfoList list = dir2.entryInfoList();
QFileInfo fileInfo = list.at(0);
settingname = fileInfo.fileName();
qDebug()<<settingname;
}
QString filename = path + "/" +settingname;
QFile file(filename);
if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
{
QMessageBox::information(this,tr("提示"),tr("无法打开文件"),QMessageBox::Ok);
qDebug()<<"Can't open the file!"<<endl;
}
QTextStream in(&file);
QString ipaddress;
ipaddress = in.readLine();
qDebug()<<ipaddress;
tcpClient->connectToHost(QHostAddress(ipaddress),6111);//连接
}
示例6: Display
void Forecast::on_pushButton_2_clicked()
{
// Open multi image.
QString path;
QDir dir;
path=dir.currentPath();
QStringList files = QFileDialog::getOpenFileNames(
this,
"Select one or more files to open",
path,
"Images (*.png *.png *.jpg *.bmp)");
if(files.count()>0) {
files.sort();
//displayYuBao(files);
Display *fc = new Display();
fc->init(files);
QDesktopWidget* desktop = QApplication::desktop();
int x,y;
x=(desktop->width() - fc->width())/2;
y=(desktop->height() - fc->height())/2-20;
fc->setGeometry(x,y,fc->width(),fc->height());
fc->setModal(true);
fc->show();
mw->m_display_windows_list.append(fc);
}
}
示例7: on_pushButton_clicked
void Forecast::on_pushButton_clicked()
{
QString path;
QDir dir;
path=dir.currentPath();
//Show file select Dialog.
if(select_window!=NULL) {
delete select_window;
}
select_window = new SelectFile();
select_window->init(SWWYL);
QDesktopWidget* desktop = QApplication::desktop();
int x,y;
x=(desktop->width() - select_window->width())/2;
y=(desktop->height() - select_window->height())/2;
select_window->setGeometry(x,y,1,429);
// select_window->setModal(true);
select_window->show();
// MPlayer 播放视频
// QProcess::execute("C:\\MPlayer_Windows\\mplayer\\MPlayer.exe "+path+"\\yubao\\wenyanliu\\nwp_3dvar.mp4");
// QProcess::execute("C:\\wmplayer\\wmplayer.exe "+path+"\\yubao\\wenyanliu\\nwp_3dvar.mp4");
}
示例8: onNewFrame
void Dialog::onNewFrame(QImage qImg, vector<Rect_<int> > faces)
{
//QList<QImage>::iterator it = qImg.begin();
QSize labelSize = QSize(ui->label->geometry().width(),ui->label->geometry().height());
//qDebug() << labelSize << "\n";
if(qImg.isNull())
{
qDebug() << "qImg is null\n";
}
else
{
if(faces.size() > 0 && is_detect){
// Get current working path
emit SetProcessFlag(false);
QString path;
QDir dir;
path=dir.currentPath();
QDateTime date_time = QDateTime::currentDateTime();
QString str = date_time.toString("yyyyMMddhhmmss");
QString fileName = path+"/FaceImages/"+str+".png";
qImg.save(fileName,"png");
is_detect = false;
mts.doWrite("FaceDetect#"+this->receiverName+"#doFaceDetect#"+fileName);
emit closeCamera();
//this->showMinimized();
move(1920,1080);
}
if(!is_detect){
qImg.fill(QColor(0,0,0,0));
}
ui->label->setPixmap(QPixmap::fromImage(qImg).scaled(labelSize,Qt::KeepAspectRatio, Qt::FastTransformation));
}
}
示例9:
cacic_hardware::cacic_hardware()
{
QDir dir;
logManager = QLogger::QLoggerManager::getInstance();
logManager->addDestination(dir.currentPath() + "/Logs/cacicLog.log","Gercols (hardware)",QLogger::InfoLevel);
logManager->addDestination(dir.currentPath() + "/Logs/cacicLog.log","Gercols (hardware)",QLogger::ErrorLevel);
}
示例10: fl_procPC_adjust_preference
void fl_procPC_adjust_preference()
{
atlasConfig cfginfo;
// QString fileName = "atlas_config.txt";
// QString fileName = "/Users/longf/work/v3d_internal/long_fuhui/atlas_builder/pointcloud_atlas_builder_plugin/atlas_config.txt";
QDir curdir;
// v3d_msg(curdir.currentPath());
//
// printf("%s", curdir.currentPath().toStdString().c_str());
// QString fileName = curdir.currentPath() + "/plugins/atlas_builder/atlas_config.txt";
QString fileName = curdir.currentPath() + V3DFOLDER;
if (!loadPointCloudAtlasConfigFile(qPrintable(fileName.trimmed()), cfginfo))
{
v3d_msg("Fail to load the configuration file atlas_config.txt");
return;
}
fl_func_procIO_adjust_preference(fileName, cfginfo);
}
示例11: QWidget
BaiduMap::BaiduMap(QWidget *parent) :
QWidget(parent),
ui(new Ui::BaiduMap)
{
ui->setupUi(this);
mWebView = ui->webView;
QDir dir;
mWebView->load(QUrl(QString("file:///"+dir.currentPath()+"/BaiduMap.html")));
}
示例12:
void RongHe::on_pushButton_3_clicked()
{
QString path;
QDir dir;
path=dir.currentPath();
QDir::setCurrent(path+"\\rain");
QProcess::execute("rain.exe");
QDir::setCurrent(path);
}
示例13: QSettings
CCfgFile::CCfgFile()
{
QString strPath;
QDir dir;
strPath = dir.currentPath();
m_setting = new QSettings(strPath + CONFIG_FILE_NAME, QSettings::IniFormat);
ReadFile();
VerifyData();
}
示例14: densePointCloudReconstruction
//===============================================densePointCloudReconstruction============================================//
bool TextureGenrator::densePointCloudReconstruction(){
int start = 0;
int end = 0;
m_parent->textEditConsole->append("正在进行稠密点云重建,请稍候...");
//run PMVS for dense reconstruction
QString path = "TempData" + tr(".nvm.cmvs/00/");
start = clock();
// find all the files
QDir dir;
dir.setPath(path);
dir.setFilter(QDir::Files | QDir::NoSymLinks | QDir::NoDotAndDotDot);
QStringList filter;
filter<<"option-*";
QFileInfoList fileList = dir.entryInfoList(filter);
int nOpts = fileList.size();
m_parent->progressBar->setRange(0,nOpts);
m_parent->progressBar->setValue(0);
for(int i=0; i< nOpts; i++){
// option files
QString optFile = fileList.at(i).filePath();
QStringList fields= optFile.split("/");
// commad line arguments
QString cmdArgu = path +" " + fields.takeLast();
m_parent->textEditConsole->append( QString("%1 th reconstruction ").arg(i));
m_parent->textEditConsole->append( dir.currentPath()+ "/" + optFile);
if(!shellExecute("pmvs2.exe", cmdArgu.toStdString().c_str()))return false;
m_parent->progressBar->setValue(i+1);
QApplication::processEvents();
}
end = clock();
m_parent->textEditConsole->append(QString("稠密重建完成,用时 %1 s\n").arg((double)(end-start)/CLOCKS_PER_SEC));
m_parent->textEditConsole->append("重建结果保存在 " + dir.currentPath()+ "/" + path);
update();
return true;
}
示例15: QObject
Sqldb::Sqldb(QObject *parent) :
QObject(parent)
{
db=QSqlDatabase::addDatabase("QSQLITE");
QDir dir;
QString path=QString("%1/database.db").arg(dir.currentPath());
qDebug()<<path;
db.setDatabaseName(path);
if(!db.open())
{
QMessageBox::critical(NULL,tr("Tips"),tr("connect error"));
}
}