13 #include <QtGui/QHeaderView>
14 #include <QtGui/QTableWidget>
15 #include <QtGui/QTableWidgetItem>
16 #include <QtGui/QPushButton>
17 #include <QtGui/QLayout>
18 #include <QtGui/QHBoxLayout>
19 #include <QtGui/QVBoxLayout>
20 #include <QtGui/QButtonGroup>
36 QVBoxLayout* pLayout =
new QVBoxLayout(
this);
37 this->
mpTable =
new QTableWidget(
this);
38 pLayout->addWidget(this->
mpTable);
40 this->
mpTable->setColumnCount(2);
42 QHeaderView *header = this->
mpTable->horizontalHeader();
43 this->
mpTable->setHorizontalHeaderLabels(QStringList() <<
"Metabolite" <<
"Concentration");
46 QTableWidgetItem* pItem =
new QTableWidgetItem(
"*** no time series load ***");
47 this->
mpTable->setItem(0, 0, pItem);
48 pItem =
new QTableWidgetItem(
"NaN");
49 this->
mpTable->setItem(0, 1, pItem);
50 this->
mpTable->item(0, 0)->setFlags(this->
mpTable->item(0, 0)->flags() & ~Qt::ItemIsEditable);
51 QHBoxLayout *hLayout =
new QHBoxLayout();
56 pLayout->addLayout(hLayout);
60 resize(QSize(202, 153).expandedTo(minimumSizeHint()));
69 QTableWidgetItem * pCheckItem =
new QTableWidgetItem(
FROM_UTF8(s));
71 pCheckItem->setFlags((pCheckItem->flags() & ~Qt::ItemIsEditable) | Qt::ItemIsUserCheckable);
72 this->
mpTable->setItem(row, 0, pCheckItem);
73 pCheckItem->setCheckState(Qt::Checked);
74 pCheckItem =
new QTableWidgetItem(QString::number(val));
75 this->
mpTable->setItem(row, 1, pCheckItem);
82 if (this->
mpTable->item(row, 1) == NULL)
84 this->
mpTable->setItem(row, 1,
new QTableWidgetItem(QString::number(val)));
88 this->
mpTable->item(row, 1)->setText(QString::number(val));
104 for (i = 0; i < this->
mpTable->rowCount(); i++)
106 QTableWidgetItem *pCell = this->
mpTable->item(i, 0);
107 assert(pCell != NULL);
109 if (pCell->flags() & Qt::ItemIsUserCheckable)
112 pCell->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
139 this->
mIndexMap.insert(std::pair<int, std::string>
148 std::map<int, std::string>::const_iterator itIndexObj = this->
mIndexMap.find(row);
152 s = (*itIndexObj).second;
160 QTableWidgetItem *pCell = this->
mpTable->item(row, 0);
161 assert(pCell != NULL);
162 return pCell->checkState() == Qt::Checked;
177 this->
mpTable->setRowCount(rows);
182 this->
mpTable->setColumnCount(columns);
187 return this->
mpTable->rowCount();
192 return this->
mpTable->verticalHeader();
std::string getKeyForRow(int row) const
QHeaderView * verticalHeader()
void setValue(int row, C_FLOAT64 val)
QPushButton * mpUncheckAllButton
bool getValueForRow(int row) const
CQCurrentValueTable(QWidget *parent=0)
void valueChanged(int row)
void removeItemInAnimation(std::string s)
void slotCheckAllClicked()
void slotUncheckAllClicked()
void setAllBoxesChecked(bool checked=true)
std::map< int, std::string > mIndexMap
void setRowInTable(int row, std::string key, std::string s, C_FLOAT64 val)
void tableValueChanged(int row, int column)
void setAllBoxesUnchecked()
void setNumRows(int rows)
void setKeyIndex(std::string key, int row)
void addItemInAnimation(std::string s)
QPushButton * mpCheckAllButton
void setNumCols(int columns)
void updateRowInTable(int row, C_FLOAT64 val)