C++ (Qt)dirComboBox3 = new QComboBox();
C++ (Qt)fPath.remove(QRegExp("/*.*_"));
C++ (Qt)int pos = str.lastIndexOf('/');if (pos >= 0) str = str.right(str.size() - pos - 1);
C++ (Qt)#ifndef MYSTR_H#define MYSTR_H #include <QString>#include <QDir> namespace MyStr { inline QString AfterLast( const QString & src, QChar ch ) { return str.mid(str.lastIndexOf(ch) + 1); } inline QString Path2FileName( const QString & path ) { return AfterLast(path, QDir::seperator()); } } // namespace #endif // MYSTR_H
C++ (Qt)using namespace MyStr;...str = AfterLast(Path2FileName(str), '_');
C++ (Qt)fPath = MyStr::AfterLast(fPath, '_')
C++ (Qt)fPath = fPath.mid(fPath.lastIndexOf('_'));
C++ (Qt)#include <QtGui> #include "mfldialog.hh" MainDialog::MainDialog( Config::Class &cfg_, QWidget *parent ) : QDialog( parent ), cfg(cfg_){...... dirComboBox3 = new QComboBox(); dirComboBox3->setInsertPolicy(QComboBox::InsertAlphabetically); QDir dir( cfg.projectTextionaryFolder ); QFileInfoList list = dir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::NoSort); for (int i = 0; i < list.size(); ++i) { QFileInfo fInfo = list.at(i); QString fPath = fInfo.filePath(); fPath.remove(QRegExp("/*.*_")); dirComboBox3->addItem(fPath); }... ... void FindDialog::findClicked(){ QString text = lineTextName->text(); QString text2 = lineTextVersion->text(); QString text3 = txtComboBox1->currentText(); QString text4 = txtComboBox2->currentText(); QString text5 = atxEdit->toPlainText(); dirComboBox3->addItem(text);...
C++ (Qt)mid(fPath.lastIndexOf('_') + 1)