Хранилища Subversion qb

Редакция

Содержимое файла | Последнее изменение | Открыть журнал | RSS

Редакция Автор № строки Строка
5 diffor 1
/*
2
 * Table View Print & Preview dialog
3
 * Copyright (C) 2004-2008 by Gordos Kund / QnD Co Bt.
4
 *
5
 * This library is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU Lesser General Public
7
 * License as published by the Free Software Foundation; either
8
 * version 2.1 of the License, or (at your option) any later version.
9
 *
10
 * This library 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 GNU
13
 * Lesser General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU Lesser General Public
16
 * License along with this library; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
 * Please contact gordos.kund@gmail.com with any questions on this license.
19
 */
20
 
21
#ifndef TDPREVIEWDIALOG_H
22
#define TDPREVIEWDIALOG_H
23
    #include <QtGui/QDialog>
24
    #include <ui_tdpreviewdialog.h>
25
    #include <QtGui/QTableView> //checked
26
    #include <QtGui/QPrinter> //checked
27
    #include <QtGui/QTextLength> //checked
28
    #include <QtGui/QFileDialog> //checked
29
    #include <QtGui/QGraphicsView> //checked
30
 
31
/*! \class TDPreviewDialog
32
 *  \brief TDPreviewDialog dialog
33
 *  \author Kund Gordos
34
 *  \version 0.12
35
 *  \date     2008
36
 */
37
 
38
class QGraphicsScene;
39
class QAbstractItemModel;
40
 
41
// Text preview widget
42
class TDPreviewDialog : public QDialog
43
{
44
        Q_OBJECT
45
        Q_ENUMS (Grids)
46
public:
47
        enum Grids {
48
                NoGrid=0x0,
49
                NormalGrid=0x1,
50
                AlternateColor=0x2,
51
                AlternateWithGrid=0x3
52
        };
53
 
54
        TDPreviewDialog(QTableView *p_tableView, QPrinter * p_printer,  QWidget *parent=0);
55
        virtual ~TDPreviewDialog();
56
        virtual void setHeaderText(const QString &text);
57
        virtual void setGridMode(Grids);
58
        virtual void print();
59
        virtual int exec();
60
        virtual void exportPdf(const QString &filename);
61
 
62
private slots:
63
        virtual void on_setupToolButton_clicked();
64
        virtual void on_zoomInToolButton_clicked();
65
        virtual void on_zoomOutToolButton_clicked();
66
        virtual void on_pageSpinBox_valueChanged(int value);
67
 
68
private:
69
        Ui_TDPreviewDialog ui;
70
        virtual void setupPage();
71
        virtual void paintPage(int pagenum);
72
        virtual void setupSpinBox();
73
        QGraphicsView *view;
74
        QTableView *tableView;
75
        QPrinter *printer;
76
        TDPreviewDialog::Grids gridMode;
77
        int lines;
78
        int pages;
79
        int leftMargin;
80
        int rightMargin;
81
        int topMargin;
82
        int bottomMargin;
83
        int spacing;
84
        int headerSize;
85
        int footerSize;
86
        int sceneZoomFactor;
87
        double columnZoomFactor;
88
        double rowHeight;
89
        double columnMultiplier;
90
        QString headerText;
91
        QString footerText;
92
        QVector<QTextLength> colSizes;
93
        QAbstractItemModel *model;
94
        QGraphicsScene pageScene;
95
        QFont titleFont;
96
        QFont headerFont;
97
        QFont font;
98
        QFontMetrics *titleFmt;
99
        QFontMetrics *headerFmt;
100
        QFontMetrics *fmt;
101
        QString headerStdText;
102
};
103
 
104
#endif