本文整理汇总了C++中QDir::cleanPath方法的典型用法代码示例。如果您正苦于以下问题:C++ QDir::cleanPath方法的具体用法?C++ QDir::cleanPath怎么用?C++ QDir::cleanPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDir
的用法示例。
在下文中一共展示了QDir::cleanPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openHash
void Grid::openHash()
{
cout << "Opening hash" << endl;
// if dir exists
QDir dir;
QFile *keysFile;
QString currentHashKey("");
realvec currentFeature;
int currentHashFileNumber = 0;
if(dir.exists("extractFiles") )
{
// open keys
dir.setCurrent("extractFiles");
keysFile = new QFile(dir.filePath("keys.txt"));
if(keysFile->open(QFile::ReadWrite))
{
QTextStream keysInput(keysFile);
while(!keysInput.atEnd())
{
keysInput >> currentHashKey;
keysInput >> currentHashFileNumber;
if(!currentHashKey.isNull() )
{
std::stringstream stringStream;
stringStream << "featureVec" << currentHashFileNumber << ".hsh";
cout << dir.filePath(stringStream.str().c_str()).toStdString() << endl;
currentFeature.read(dir.cleanPath(stringStream.str().c_str()).toStdString());
if(normFeatureHash->find(currentHashKey.toStdString()) == normFeatureHash->end())
{
normFeatureHash->insert( pair<std::string, realvec>(currentHashKey.toStdString(), currentFeature) );
}
}
//TODO:: Clean up pointers
}
}
示例2: main
//.........这里部分代码省略.........
case 'D':
Imod_debug = TRUE;
break;
case 'E':
windowKeys = strdup(argv[++i]);
break;
case 'm':
ImodTrans = FALSE;
break;
case 'M':
vi.li->mirrorFFT = -1;
break;
case 'Y':
li.axis = 2;
break;
case 'h':
imod_usage(argv[0]);
exit(1);
break;
case 'p':
if (argv[i][2] == 'y') {
vi.imagePyramid = 1;
break;
}
if (strlen(argv[i]) > 2)
badOption(argv[i]);
plistfname = argv[++i];
plFileNames << QDir::toNativeSeparators(curdir->cleanPath(QString(plistfname)));
break;
case 'a':
anglefname = argv[++i];
break;
case 'f':
frames = 1;
break;
case 'G':
vi.grayRGBs = 1;
break;
case '2':
vi.dim &= ~4;
break;
case 'P':
sscanf(argv[++i], "%d%*c%d", &nframex, &nframey);
break;
case 'o':
overEntered = 1;
sscanf(argv[++i], "%d%*c%d", &overx, &overy);
break;
case 'S':
sliceropen = TRUE;
break;
case 'V':
示例3: executeMessage
// This function performs the action after the delay is up. It returns
// true if the program is still to quit
bool ImodClipboard::executeMessage()
{
int returnValue, arg;
int succeeded = 1;
static int checkSum = 0;
int newCheck;
QString convName;
QDir *curdir;
ZapFuncs *zap;
int movieVal, xaxis, yaxis, zaxis, taxis;
int objNum, type, symbol, symSize, ptSize, mode, mask, interval;
bool props1;
Imod *imod;
Iobj *obj;
int symTable[] =
{ IOBJ_SYM_NONE, IOBJ_SYM_CIRCLE, IOBJ_SYM_SQUARE, IOBJ_SYM_TRIANGLE };
// Number of arguments required - for backward compatibility, going to
// model mode does not require one but should have one
int requiredArgs[] = {0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 5, 5, 0, 2, 4, 4, 3, 1, 1};
int numArgs = sMessageStrings.count();
// Loop on the actions in the list; set arg to numArgs to break loop
for (arg = 0; arg < numArgs; arg++) {
imod = App->cvi->imod;
// Get the action, then check that there are enough values for it
sMessageAction = sMessageStrings[arg].toInt();
if (sMessageAction >= 0 && sMessageAction < sizeof(requiredArgs) / sizeof(int) &&
arg + requiredArgs[sMessageAction] >= numArgs) {
imodPrintStderr("imodExecuteMessage: not enough values sent"
" with action command %d\n", sMessageAction);
succeeded = 0;
break;
}
// If still in initial load, skip the arguments (and one more if model mode message)
if (sInitialLoad) {
if (sMessageAction >= 0 && sMessageAction < sizeof(requiredArgs) / sizeof(int))
arg += requiredArgs[sMessageAction];
if (arg < numArgs - 1 && sMessageAction == MESSAGE_MODEL_MODE)
arg++;
// Stop processing after a plugin message because the length is unknown
// and stop after seeing a quit
if (sMessageAction == MESSAGE_PLUGIN_EXECUTE || sMessageAction == MESSAGE_QUIT)
arg = numArgs;
continue;
}
if (Imod_debug) {
QTime curTime = QTime::currentTime();
wprint("%02d:%02d.%03d: Executing message action %d\n",
curTime.minute(), curTime.second(), curTime.msec(), sMessageAction);
imodPrintStderr("%02d:%02d.%03d: imodHCM in executeMessage: executing message "
"action %d\n",
curTime.minute(), curTime.second(), curTime.msec(), sMessageAction);
if (imodDebug('C')) {
newCheck = imodChecksum(App->cvi->imod);
wprint("Checksum before = %d\n", newCheck);
if (checkSum && newCheck != checkSum)
wprint("\aIT CHANGED SINCE LAST TIME\n");
checkSum = newCheck;
}
}
if (ImodvClosed || !Imodv->standalone) {
switch (sMessageAction) {
case MESSAGE_OPEN_MODEL:
case MESSAGE_OPEN_KEEP_BW:
curdir = new QDir();
convName = curdir->cleanPath(sMessageStrings[++arg]);
delete curdir;
// Since this could open a dialog with an indefinite delay, just send
// the OK signal now
succeeded = -1;
sendResponse(1);
inputRaiseWindows();
// DNM 6/3/04: switch to keeping BW values in the first place
returnValue = openModel(LATIN1(convName),
sMessageAction == MESSAGE_OPEN_KEEP_BW, false);
if(returnValue == IMOD_IO_SUCCESS) {
wprint("%s loaded.\n",
LATIN1(QDir::convertSeparators(QString(Imod_filename))));
}
else if(returnValue == IMOD_IO_SAVE_ERROR) {
wprint("Error Saving Model. New model not loaded.\n");
arg = numArgs;
}
else if(returnValue == IMOD_IO_SAVE_CANCEL) {
wprint("Operation cancelled. New model not loaded.\n");
arg = numArgs;
}
//.........这里部分代码省略.........