UtilsWidgets.cpp
Go to the documentation of this file.
1 #include "UtilsWidgets.h"
2 
3 // TerraLib
11 
12 
13 // Qt
14 #include <QApplication>
15 #include <QDialog>
16 #include <QFrame>
17 #include <QGridLayout>
18 
19 
21 {
22  int argc = 1;
23 
24  //crate application
25  QApplication app(argc, 0);
26  QString title("Testing Utils Widgets");
27 
28  //create dummy dialog
29  QDialog d(NULL);
30  d.setWindowTitle(title);
31 
32  QGridLayout* layout = new QGridLayout(&d);
33 
34  //add DoubleListWidget
36  layout->addWidget(dlW, 0, 0);
37 
38  dlW->setLeftLabel("Input Values");
39  dlW->setRightLabel("Output Values");
40 
41  std::vector<std::string> inputValues;
42  inputValues.push_back("TerraView");
43  inputValues.push_back("TerraLib");
44  inputValues.push_back("INPE");
45 
46  dlW->setInputValues(inputValues);
47 
48  //add line separator
49  QFrame* line = new QFrame(&d);
50  line->setFrameShape(QFrame::VLine);
51  line->setFrameShadow(QFrame::Sunken);
52  layout->addWidget(line, 0, 1);
53 
54  //add ListWidget
56  layout->addWidget(lW, 0, 2);
57 
58  lW->setLabel("Values");
59 
60  //add ListWidget
62  layout->addWidget(ptW, 1, 0, 1, 3);
63 
64  //add ColorPickerToolButton
66  cp->setFixedSize(70, 24);
67  layout->addWidget(cp, 2, 0);
68 
69  //add HorizontalSliderWidget
71  layout->addWidget(hs, 2, 1, 1, 2);
72 
73  // Qwt scale widget and stuff
75  c.addColor(te::color::RGBAColor(255, 255, 0, TE_OPAQUE), 0.33);
76  c.addColor(te::color::RGBAColor(0 ,0, 255, TE_OPAQUE), 0.66);
77 
79  layout->addWidget(cm, 3, 0, 1, 3);
80 
81  cm->setHeight(20);
82  cm->setColorBar(&c);
83 
84  d.exec();
85 }
void setRightLabel(const QString &value)
void setLeftLabel(const QString &value)
void UtilsWidgets()
It shows a set of common widgets usefull to be used in a set of UI.
void setHeight(int value)
Sets the height of colobar.
void setLabel(std::string value)
Definition: ListWidget.cpp:69
#define TE_OPAQUE
For an RGBA color this is the value of the alpha-channel for totally opaque.
unsigned int line
void setInputValues(std::vector< std::string > values)
Custom tool button used to pick a color.
static te::dt::DateTime d(2010, 8, 9, 15, 58, 39)
The concept of color bar.
void addColor(const RGBAColor &color, const double &pos)
It adds a color in the color bar.
A helper class for 32-bit RGBA (Red-Green-Blue-Alpha channel) color.
Definition: RGBAColor.h:57
It models the concept of color bar.
void setColorBar(te::color::ColorBar *cb)
It sets the color bar.
Custom widget used to pick a color.