Rev 198 | Rev 200 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 198 | Rev 199 | ||
---|---|---|---|
Line 55... | Line 55... | ||
55 | 55 | ||
56 | }
|
56 | }
|
57 | 57 | ||
58 | void FileForm::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ñîõðàíèòü ôàéë" |
58 | void FileForm::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Ñîõðàíèòü ôàéë" |
59 | 59 | ||
60 | QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), |
- | |
61 | "",
|
- | |
62 | tr("All Files (*.*);;Image Files (*.png *.jpg *.bmp);;Text files (*.txt);;XML files (*.xml)")); |
- | |
63 | - | ||
64 | QByteArray data_tmp;
|
60 | QByteArray data_tmp;
|
65 | QFile file;
|
61 | QFile file;
|
- | 62 | QDataStream out(&Data,QIODevice::ReadOnly); |
|
- | 63 | QString fileName;
|
|
- | 64 | out >> fileName; |
|
- | 65 | fileName = QFileDialog::getSaveFileName(this, tr("Save File"), |
|
- | 66 | fileName, |
|
- | 67 | tr("All Files (*.*);;Image Files (*.png *.jpg *.bmp);;Text files (*.txt);;XML files (*.xml)")); |
|
- | 68 | ||
- | 69 | ||
66 | int i; |
70 | int i; |
67 | i++; |
71 | i++; |
68 | if (fileName.isEmpty()) return; |
72 | if (fileName.isEmpty()) return; |
69 | if (Data.isEmpty()) return; |
73 | if (Data.isEmpty()) return; |
70 | 74 | ||
71 | file.setFileName(fileName); |
75 | file.setFileName(fileName); |
72 | if (!file.open(QIODevice::WriteOnly)) return; |
76 | if (!file.open(QIODevice::WriteOnly)) return; |
73 | 77 | ||
74 | 78 | ||
75 | // Data = file.readAll();
|
79 | // Data = file.readAll();
|
76 | QDataStream out(&Data,QIODevice::ReadOnly); |
- | |
- | 80 | ||
77 | // out.device()->reset();
|
81 | // out.device()->reset();
|
78 | out >> fileName; |
- | |
79 | 82 | ||
80 | file.setFileName(fileName); |
- | |
81 | if (!file.open(QIODevice::ReadWrite)) return; |
- | |
- | 83 | ||
- | 84 | ||
82 | data_tmp.clear(); |
85 | data_tmp.clear(); |
83 | out >> data_tmp; |
86 | out >> data_tmp; |
84 | int count; |
87 | int count; |
85 | count = file.write(data_tmp); |
88 | count = file.write(data_tmp); |
86 | 89 | int size; |
|
- | 90 | size = file.size(); |
|
87 | file.close(); |
91 | file.close(); |
88 | 92 | ||
89 | 93 | ||
90 | 94 | ||
91 | }
|
95 | }
|