KIO

kimagefilepreview.h
1 /*
2  This file is part of the KDE project.
3  SPDX-FileCopyrightText: 2001 Martin R. Jones <[email protected]>
4  SPDX-FileCopyrightText: 2001 Carsten Pfeiffer <[email protected]>
5  SPDX-FileCopyrightText: 2008 Rafael Fernández López <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.0-only
8 */
9 
10 #ifndef KIMAGEFILEPREVIEW_H
11 #define KIMAGEFILEPREVIEW_H
12 
13 #include <QPixmap>
14 #include <QUrl>
15 #include <kpreviewwidgetbase.h>
16 
17 #include <memory>
18 
19 class KFileItem;
20 class KJob;
21 class KImageFilePreviewPrivate;
22 
23 namespace KIO
24 {
25 class PreviewJob;
26 }
27 
28 /**
29  * @class KImageFilePreview kimagefilepreview.h <KImageFilePreview>
30  *
31  * Image preview widget for the file dialog.
32  */
33 class KIOFILEWIDGETS_EXPORT KImageFilePreview : public KPreviewWidgetBase
34 {
35  Q_OBJECT
36 
37 public:
38  /**
39  * Creates a new image file preview.
40  *
41  * @param parent The parent widget.
42  */
43  explicit KImageFilePreview(QWidget *parent = nullptr);
44 
45  /**
46  * Destroys the image file preview.
47  */
48  ~KImageFilePreview() override;
49 
50  /**
51  * Returns the size hint for this widget.
52  */
53  QSize sizeHint() const override;
54 
55 public Q_SLOTS:
56  /**
57  * Shows a preview for the given @p url.
58  */
59  void showPreview(const QUrl &url) override;
60 
61  /**
62  * Clears the preview.
63  */
64  void clearPreview() override;
65 
66 protected Q_SLOTS:
67  void showPreview();
68  void showPreview(const QUrl &url, bool force);
69 
70  virtual void gotPreview(const KFileItem &, const QPixmap &);
71 
72 protected:
73  void resizeEvent(QResizeEvent *event) override;
74  virtual KIO::PreviewJob *createJob(const QUrl &url, int width, int height);
75 
76 private:
77  std::unique_ptr<KImageFilePreviewPrivate> const d;
78 
80 };
81 
82 #endif // KIMAGEFILEPREVIEW_H
Abstract baseclass for all preview widgets.
Q_SLOTSQ_SLOTS
virtual void resizeEvent(QResizeEvent *event)
virtual void clearPreview()=0
Reimplement this to clear the preview.
virtual void showPreview(const QUrl &url)=0
This slot is called every time the user selects another file in the file dialog.
KIO Job to get a thumbnail picture.
Definition: previewjob.h:30
A namespace for KIO globals.
Q_DISABLE_COPY(Class)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:00:36 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.