All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GraphicDialog.cpp
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/GraphicDialog.cpp
22 
23  \brief A dialog used to build a graphic element.
24 */
25 
26 // TerraLib
27 #include "GraphicDialog.h"
28 #include "GraphicSelectorWidget.h"
29 #include "ui_GraphicDialogForm.h"
30 
31 te::qt::widgets::GraphicDialog::GraphicDialog(QWidget* parent, Qt::WindowFlags f)
32  : QDialog(parent, f),
33  m_ui(new Ui::GraphicDialogForm)
34 {
35  m_ui->setupUi(this);
36 
37  // Graphic Selector
39 
40  // Adjusting...
41  QGridLayout* layout = new QGridLayout(m_ui->m_graphicSelectorFrame);
42  layout->setSizeConstraint(QLayout::SetFixedSize);
43  layout->addWidget(m_graphicSelector);
44 }
45 
47 {
48 }
49 
50 te::se::Graphic* te::qt::widgets::GraphicDialog::getGraphic(const te::se::Graphic* initial, QWidget* parent, const QString& title)
51 {
52  GraphicDialog dlg(parent);
53 
54  if(!title.isEmpty())
55  dlg.setWindowTitle(title);
56 
57  if(initial)
58  dlg.m_graphicSelector->setGraphic(initial);
59 
60  if(dlg.exec() == QDialog::Accepted)
61  return dlg.getGraphic();
62 
63  return 0;
64 }
65 
67 {
68  m_graphicSelector->setGraphic(graphic);
69 }
70 
72 {
73  return m_graphicSelector->getGraphic();
74 }
75 
77 {
78  return m_graphicSelector->getGraphicIcon(size);
79 }
void setGraphic(const te::se::Graphic *graphic)
Sets the graphic element.
A widget used to select a graphic element.
A widget used to select a graphic element.
te::se::Graphic * getGraphic() const
Gets the configured graphic element.
A Graphic is a graphic symbol with an inherent shape, color(s), and possibly size.
Definition: Graphic.h:66
QIcon getGraphicIcon(const QSize &size)
Gets the current graphic icon.
void setGraphic(const te::se::Graphic *graphic)
Sets the graphic element.
A dialog used to build a graphic element.
A dialog used to build a graphic element. If you want to use this dialog, you can use commands like: ...
Definition: GraphicDialog.h:69
static te::se::Graphic * getGraphic(const te::se::Graphic *initial, QWidget *parent=0, const QString &title="")
Pops up a modal graphic dialog with the given window title, lets the user configure the graphic...
GraphicDialog(QWidget *parent=0, Qt::WindowFlags f=0)
Constructs a graphic dialog which is a child of parent, with widget flags set to f.
std::auto_ptr< Ui::GraphicDialogForm > m_ui
Dialog form.
GraphicSelectorWidget * m_graphicSelector
Graphic selector widget used to select the graphic.