File indexing completed on 2024-04-14 14:20:24

0001 /*
0002  *  This file is part of the KDE libraries
0003  *  Copyright (c) 2007 Alex Merry <alex.merry@kdemail.net>
0004  *
0005  *  This library is free software; you can redistribute it and/or
0006  *  modify it under the terms of the GNU Library General Public
0007  *  License as published by the Free Software Foundation; either
0008  *  version 2 of the License, or (at your option) any later version.
0009  *
0010  *  This library is distributed in the hope that it will be useful,
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  *  Library General Public License for more details.
0014  *
0015  *  You should have received a copy of the GNU Library General Public License
0016  *  along with this library; see the file COPYING.LIB.  If not, write to
0017  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  *  Boston, MA 02110-1301, USA.
0019  **/
0020 
0021 #ifndef KPRINTPREVIEW_H
0022 #define KPRINTPREVIEW_H
0023 
0024 #include <kdelibs4support_export.h>
0025 
0026 #include <QDialog>
0027 #include <QPrinter>
0028 
0029 class KPrintPreviewPrivate;
0030 
0031 /**
0032  * KPrintPreview provides a print preview dialog.
0033  *
0034  * Use it like this:
0035  *
0036  * @code
0037  * QPrinter printer;
0038  * KPrintPreview preview(&printer);
0039  * doPrint(printer); // draws to the QPrinter
0040  * preview.exec();
0041  * @endcode
0042  *
0043  * @deprecated since 5.0, use QPrintPreviewDialog instead
0044  */
0045 class KDELIBS4SUPPORT_EXPORT KPrintPreview : public QDialog
0046 {
0047     Q_OBJECT
0048 
0049 public:
0050     /**
0051      * Create a KPrintPreview object.
0052      *
0053      * This will change the settings on the QPrinter, so you
0054      * should not re-use the QPrinter object for printing
0055      * normally.
0056      *
0057      * @param printer pointer to a QPrinter to configure for
0058      *                print preview
0059      * @param parent  pointer to the parent widget for the dialog
0060      */
0061     KDELIBS4SUPPORT_DEPRECATED explicit KPrintPreview(QPrinter *printer, QWidget *parent = nullptr);
0062     ~KPrintPreview() override;
0063 
0064     /**
0065      * Returns true if the print preview system is available
0066      * @since KDE 4.5
0067      */
0068     static bool isAvailable();
0069 
0070 protected:
0071     void showEvent(QShowEvent *event) override;
0072 
0073 private:
0074     KPrintPreviewPrivate *const d;
0075 };
0076 
0077 #endif // KPRINTPREVIEW_H
0078