Create open btn
This commit is contained in:
@@ -60,6 +60,7 @@ void MainWindow::on_pushButton_clicked()
|
||||
{
|
||||
|
||||
QString ext[] = {"png", "jpeg", "jpg"};
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
|
||||
if (fileName.isEmpty()) return;
|
||||
QFile file(fileName);
|
||||
@@ -93,3 +94,18 @@ void MainWindow::on_pushButton_clicked()
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionOpen_triggered()
|
||||
{
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName(this, "Open the file");
|
||||
if(fileName.isEmpty()) return;
|
||||
QFile file(fileName);
|
||||
if(!file.open(QIODevice::ReadOnly | QFile::Text)) {
|
||||
QMessageBox::warning(this, "Warning", "Fichier non valide" + file.errorString());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user