QElectroTech  0.70
diagramprintdialog.h
Go to the documentation of this file.
1 /*
2  Copyright 2006-2019 The QElectroTech Team
3  This file is part of QElectroTech.
4 
5  QElectroTech is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 2 of the License, or
8  (at your option) any later version.
9 
10  QElectroTech is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef DIAGRAM_PRINT_DIALOG_H
19 #define DIAGRAM_PRINT_DIALOG_H
20 #include <QtWidgets>
21 
22 #include "qetproject.h"
23 #include "diagram.h"
24 #include "exportproperties.h"
25 
26 class QPrinter;
27 
32 class DiagramPrintDialog : public QWidget
33 {
34 
35 
36  Q_OBJECT
37  // Constructors, destructor
38  public:
39  DiagramPrintDialog(QETProject *, QWidget * = nullptr);
40  ~DiagramPrintDialog() override;
41  private:
43 
44  // methods
45  public:
46  void setFileName(const QString &);
47  QString fileName() const;
48  void setDocName(const QString &);
49  QString docName() const;
50  QRect diagramRect(Diagram *, const ExportProperties &) const;
51  int pagesCount(Diagram *, const ExportProperties &, bool = false) const;
52  int horizontalPagesCount(Diagram *, const ExportProperties &, bool = false) const;
53  int verticalPagesCount(Diagram *, const ExportProperties &, bool = false) const;
54  void exec();
55 
56  private:
57  void buildPrintTypeDialog();
58  void buildDialog();
62  QString settingsSectionName(const QPrinter *);
63 
64  private slots:
65  void print(const QList<Diagram *> &, bool, const ExportProperties&);
66  void printDiagram(Diagram *, bool, const ExportProperties &, QPainter *, QPrinter * = nullptr);
67  void updatePrintTypeDialog();
68  void acceptPrintTypeDialog();
70 
71  // attributes
72  private:
74  QPrinter *printer_;
75  QString doc_name_;
76  QString file_name_;
77 
78  QDialog *dialog_;
80  QGridLayout *glayout0_;
81  QVBoxLayout *vlayout0_;
82  QHBoxLayout *hlayout0_;
83  QLabel *printer_icon_;
84  QLabel *pdf_icon_;
85  QButtonGroup *printtype_choice_;
86  QRadioButton *printer_choice_;
87  QRadioButton *pdf_choice_;
88  QLineEdit *filepath_field_;
89  QPushButton *browse_button_;
90  QDialogButtonBox *buttons_;
92 };
93 #endif
DiagramPrintDialog(QETProject *, QWidget *=nullptr)
QColor backup_diagram_background_color
void printDiagram(Diagram *, bool, const ExportProperties &, QPainter *, QPrinter *=nullptr)
QString settingsSectionName(const QPrinter *)
QDialogButtonBox * buttons_
void saveReloadDiagramParameters(Diagram *, const ExportProperties &, bool)
QRadioButton * pdf_choice_
void print(const QList< Diagram *> &, bool, const ExportProperties &)
int horizontalPagesCount(Diagram *, const ExportProperties &, bool=false) const
QRect diagramRect(Diagram *, const ExportProperties &) const
QPushButton * browse_button_
int pagesCount(Diagram *, const ExportProperties &, bool=false) const
QRadioButton * printer_choice_
QString docName() const
QGridLayout * glayout0_
QButtonGroup * printtype_choice_
int verticalPagesCount(Diagram *, const ExportProperties &, bool=false) const
QString fileName() const
QHBoxLayout * hlayout0_
QVBoxLayout * vlayout0_
QLineEdit * filepath_field_
void setFileName(const QString &)
void setDocName(const QString &)