diff --git a/Video-Datenbank.pro b/Video-Datenbank.pro index 46a9b65..d8a72b6 100644 --- a/Video-Datenbank.pro +++ b/Video-Datenbank.pro @@ -1,4 +1,4 @@ -QT += core gui sql +QT += core gui sql printsupport greaterThan(QT_MAJOR_VERSION, 4): QT += widgets diff --git a/mainwindow.cpp b/mainwindow.cpp index 2d7caf8..a38eadb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -516,6 +516,67 @@ if(Debug) qDebug() << "on_pushButton_pfad_clicked"; Dateiname = Dateiname + "." + Dateiname_tmp[i]; } ui->lineEdit_titel->setText(Dateiname); -if(Debug) qDebug() << "on_pushButton_pfad_clicked"; +if(Debug) qDebug() << "on_pushButton_pfad_clicked-Ende"; +} + +void MainWindow::on_pushButton_PDF_speichern_clicked(){ +if(Debug) qDebug() << "on_pushButton_PDF_speichern_clicked"; + if(ui->pushButton_id->text().toInt() <= 0 || ui->pushButton_id->text().toInt() > ui->pushButton_max->text().toInt()) return; + + QStringList Datei_tmp = ui->pushButton_pfad->text().split("/"); + QString Datei = Datei_tmp.at(Datei_tmp.length()-1); + QStringList Dateiname_tmp = Datei.split("."); + QString Dateiname; + for(int i=0; i Dateiname + + ui->label_bild->grab().save(Dateiname + ".png"); + + QString html; + html = " \ + \ + \ + Video-Datenbak \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +
 
  
  
  
  
  
  
  
  
  
Pfad :" + ui->pushButton_pfad->text() + "
Titel :" + ui->lineEdit_titel->text() + "
Format :" + ui->comboBox_bildformat->currentText() + "
Typ :" + ui->comboBox_filmtyp->currentText() + "
Teil :" + ui->lineEdit_teil->text() + "
Genre :" + ui->comboBox_genre->currentText() + "
Länge :" + ui->lineEdit_laenge->text() + "
Jahr :" + ui->lineEdit_jahr->text() + "
FSK :" + ui->comboBox_fsk->currentText() + "
\ +

" + ui->plainTextEdit_handlung->toPlainText() + " \ + \ + \ + "; + QTextDocument doc; + doc.setHtml(html); + QPrinter printer; + printer.setOutputFileName(Dateiname + "-Text.pdf"); + printer.setOutputFormat(QPrinter::PdfFormat); + doc.print(&printer); + printer.newPage(); + +if(Debug) qDebug() << "on_pushButton_PDF_speichern_clicked-Ende"; } diff --git a/mainwindow.h b/mainwindow.h index 65ff677..781e5f6 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -12,6 +12,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; } @@ -47,6 +48,8 @@ private slots: void on_pushButton_pfad_clicked(); + void on_pushButton_PDF_speichern_clicked(); + private: void oeffneDatenbank(); void schiesseDatenbank(); diff --git a/mainwindow.ui b/mainwindow.ui index fc507f8..ed5c937 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -174,53 +174,32 @@ - + + + + + + + + + + Pfad + + + + + + + + + + + - - - - / - - - - - - - < - - - - - - - Abspielen - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Speichern - - - @@ -234,24 +213,18 @@ - - - + + + + Qt::Horizontal + + - 75 - 23 + 40 + 20 - - - 75 - 23 - - - - - - + @@ -279,27 +252,77 @@ + + + + < + + + + + + + Speichern + + + + + + + + 75 + 23 + + + + + 75 + 23 + + + + + + + + + + + / + + + + + + + Abspielen + + + - - - - - - - - - - Pfad - - - - - - + + + + + + + + Status + + + + + + + PDF speichern + + + +