Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QString name=filename.path();
- name+="/res";
- name+="/data.txt";
- *file_name=name;
- QFile file(*file_name);
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text)){
- ui->label->setText("База данных не загружена");
- ui->label->setVisible(true);
- }
- else{
- ui->label->setText("База данных загружена");
- ui->label->setVisible(true);
- ui->pushButton_5->setVisible(false);
- ui->pushButton->setEnabled(true);
- ui->pushButton_2->setEnabled(true);
- ui->pushButton->setStyleSheet("background: rgb(163,20,44);color:white");
- ui->pushButton_2->setStyleSheet("background: rgb(163,20,44);color:white");
- QString str;
- while(!file.atEnd())
- {
- //читаем строку
- QString str = file.readLine();
- //Делим строку на слова разделенные |
- QStringList lst = str.split("|");
- pers->insert(lst.at(0),lst.at(1));
- }
- file.close();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement