LocalImageWidget.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of the TerraLib - a Framework for building GIS enabled applications.
4 
5  TerraLib is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraLib 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 Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with TerraLib. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@terralib.org>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/se/LocalImageWidget.h
22 
23  \brief A widget used to build an external graphic element that references a local image. e.g. a SVG file, a PNG file, etc.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_SE_INTERNAL_LOCALIMAGEWIDGET_H
27 #define __TERRALIB_QT_WIDGETS_SE_INTERNAL_LOCALIMAGEWIDGET_H
28 
29 // TerraLib
30 #include "../Config.h"
31 
32 // Qt
33 #include <QWidget>
34 
35 // STL
36 #include <memory>
37 #include <string>
38 
39 // Forward declaraion
40 namespace Ui { class LocalImageWidgetForm; }
41 
42 namespace te
43 {
44 // Forward declarations
45  namespace se
46  {
47  class ExternalGraphic;
48  }
49 
50  namespace qt
51  {
52  namespace widgets
53  {
54  /*!
55  \class LocalImageWidget
56 
57  \brief A widget used to build an external graphic element that references a local image. e.g. a SVG file, a PNG file, etc.
58  */
59  class TEQTWIDGETSEXPORT LocalImageWidget : public QWidget
60  {
61  Q_OBJECT
62 
63  public:
64 
65  /** @name Initializer Methods
66  * Methods related to instantiation and destruction.
67  */
68  //@{
69 
70  /*! \brief Constructs a local image widget which is a child of parent, with widget flags set to f. */
71  LocalImageWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
72 
73  /*! \brief Destructor. */
75 
76  //@}
77 
78  public:
79 
80  /*!
81  \brief Sets an external graphic element to this widget.
82 
83  \param eg A valid external graphic element.
84 
85  \note The widget will NOT take the ownership of the given external graphic.
86  \note The widget form will be update based on given external graphic parameters.
87  */
88  void setExternalGraphic(const te::se::ExternalGraphic* eg);
89 
90  /*!
91  \brief Gets the configured external graphic element.
92 
93  \return The configured external graphic element.
94 
95  \note The caller will take the ownership of the returned external graphic.
96  */
97  te::se::ExternalGraphic* getExternalGraphic() const;
98 
99  protected:
100 
101  /*! \brief Updates the widget form based on internal external graphic element. */
102  void updateUi();
103 
104  protected slots:
105 
106  void onBrowsePushButtonPressed();
107 
108  signals:
109 
110  /*!
111  \brief This signal is emitted when the internal external graphic element is changed.
112 
113  \param size The size of selected image.
114  */
115  void externalGraphicChanged(const QSize& size);
116 
117  private:
118 
119  std::auto_ptr<Ui::LocalImageWidgetForm> m_ui; //!< Widget form.
120  te::se::ExternalGraphic* m_eg; //!< External graphic element that will be configured by this widget.
121  QString m_filter; //!< String to filter the supported image formats by Qt.
122  };
123 
124  } // end namespace widgets
125  } // end namespace qt
126 } // end namespace te
127 
128 #endif // __TERRALIB_QT_WIDGETS_SE_INTERNAL_LOCALIMAGEWIDGET_H
The ExternalGraphic allows a reference to be made to an external graphic file with a Web URL or to in...
A widget used to build an external graphic element that references a local image. e...
URI C++ Library.
std::auto_ptr< Ui::LocalImageWidgetForm > m_ui
Widget form.
te::se::ExternalGraphic * m_eg
External graphic element that will be configured by this widget.
QString m_filter
String to filter the supported image formats by Qt.
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:63