3 #include "BandSpinBox.h" 15 list.push_back(QString::number(1));
35 disconnect(
this, 0, 0, 0);
41 .findGroup(
"Dimensions");
46 for(
int i = 1; i <=
p_bands; i++) {
47 list.push_back(QString::number(i));
49 p_map[
"BandNumber"] = list;
52 if(pvl.
findObject(
"IsisCube").hasGroup(
"BandBin")) {
54 .findGroup(
"BandBin");
55 for(
int i = 0; i < bandBin.
keywords(); i++) {
57 if(bandBin[i].size() ==
p_bands) {
58 for(
int j = 0; j < bandBin[i].size(); j++) {
59 list.push_back(QString(bandBin[i][j]));
61 QString bandBinName = bandBin[i].
name();
62 p_map[bandBinName] = list;
94 if(
p_map.contains(key)) {
116 if((key < 0) || (key >= (
int)
p_map.size())) {
134 if((val < 1) || (val >
p_bands)) {
135 std::cout <<
"BandSpinBox: Bad index in textFromValue" << std::endl;
136 return QString(
"Error");
143 std::cout <<
"BandSpinBox: Bad value for p_lastKey in textFromValue" << std::endl;
144 return QString(
"Error");
163 std::cout <<
"BandSpinBox: Bad text in valueFromText" << std::endl;
175 QFontMetrics fm(font());
178 for(
int i = minimum(); i <= maximum(); i++) {
179 w = qMax(w, fm.width(((
BandSpinBox *)
this)->textFromValue(i)));
182 QSize s = QSpinBox::sizeHint();
183 int neww = s.width() + w;
194 s.setWidth(neww + 5);
216 if(count == 0)
return QValidator::Invalid;
217 if(count > 0 && exact)
return QValidator::Acceptable;
218 return QValidator::Intermediate;
int keywords() const
Returns the number of keywords contained in the PvlContainer.
QValidator::State validate(QString &input, int &pos) const
returns how valid the value from the spin box is.
QStringList p_keys
List of all the keys.
PvlObjectIterator findObject(const QString &name, PvlObjectIterator beg, PvlObjectIterator end)
Find the index of object with a specified name, between two indexes.
void setKey(QString key)
Sets the key to the provided key.
This error is for when a programmer made an API call that was illegal.
QString textFromValue(int val) const
Gets the text using p_map.
void setBandBin(Pvl &pvl, const QString &key="BandNumber")
Sets the band bin.
int valueFromText(const QString &text) const
gets the value (int) using p_map.
QSize sizeHint() const
returns a size hint for the spin box
QString name() const
Returns the container name.
Contains multiple PvlContainers.
#define _FILEINFO_
Macro for the filename and line number.
Container for cube-like labels.
BandSpinBox(QWidget *parent=0)
BandSpinBox constructor.
QString p_lastKey
The last key.
QStringList BandBinKeys()
returns the list of keys.
Namespace for ISIS/Bullet specific routines.
QMap< QString, QStringList > p_map
The maps the last key to all the keys.
int p_bands
Number of bands.