本文整理汇总了C++中AnsiString::LoadFile方法的典型用法代码示例。如果您正苦于以下问题:C++ AnsiString::LoadFile方法的具体用法?C++ AnsiString::LoadFile怎么用?C++ AnsiString::LoadFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnsiString
的用法示例。
在下文中一共展示了AnsiString::LoadFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
ConnectDialog::ConnectDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::ConnectDialog) {
ui->setupUi(this);
setWindowIcon(QIcon(QString::fromUtf8(":/resources/conceptclienticon.png")));
ui->label->setBuddy(ui->addressEdit);
QStringList wordList;
AnsiString history;
#ifdef _WIN32
h_path = getenv("LOCALAPPDATA");
if (!h_path.Length())
h_path = getenv("APPDATA");
mkdir(h_path + "/ConceptClient-private");
h_path += (char *)"/ConceptClient-history.dat";
#else
h_path = getenv("HOME");
mkdir(h_path + "/.ConceptClient-private", 0777L);
h_path += (char *)"/.ConceptClient-history";
#endif
history.LoadFile(h_path.c_str());
this->history = history;
AnsiString sep = "\n";
int len_sep = sep.Length();
int pos = history.Pos(sep);
int index = 0;
int start = 0;
while (pos > 0) {
if (pos > 1) {
history.c_str()[pos - 1] = 0;
wordList << history.c_str();
}
AnsiString temp = history;
history = temp.c_str() + pos + len_sep - 1;
pos = history.Pos(sep);
}
QCompleter *completer = new QCompleter(wordList);
completer->setCaseSensitivity(Qt::CaseInsensitive);
ui->addressEdit->setCompleter(completer);
ui->addressEdit->setText(QString::fromUtf8("concept://"));
ui->addressEdit->addAction(QIcon(QString::fromUtf8(":/resources/gtk-index.png")), QLineEdit::LeadingPosition);
QAction *action = ui->addressEdit->addAction(QIcon(QString::fromUtf8(":/resources/gtk-delete.png")), QLineEdit::TrailingPosition);
QStyle *l_style = QApplication::style();
ui->OkButton->setIcon(l_style->standardIcon(QStyle::SP_DialogOkButton));
ui->CancelButton->setIcon(l_style->standardIcon(QStyle::SP_DialogCancelButton));
QObject::connect(action, SIGNAL(triggered()), this, SLOT(clearHistory()));
}