8 #include <QtGui/QHeaderView>
9 #include <QtGui/QClipboard>
10 #include <QtGui/QKeyEvent>
36 mpProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
39 mpTblParameterSets->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
40 mpTblParameterSets->verticalHeader()->hide();
41 mpTblParameterSets->sortByColumn(
COL_ROW_NUMBER, Qt::AscendingOrder);
49 this, SLOT(
dataChanged(
const QModelIndex&,
const QModelIndex&)));
50 connect(mpLEFilter, SIGNAL(textChanged(
const QString &)),
72 if (mpTblParameterSets->hasFocus())
80 const QItemSelectionModel * pSelectionModel = mpTblParameterSets->selectionModel();
82 QModelIndexList mappedSelRows;
85 for (i = 0; i < imax; i++)
87 if (pSelectionModel->isRowSelected((
int) i, QModelIndex()))
93 if (mappedSelRows.empty())
103 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
105 if (ret == QMessageBox::Yes)
144 if (mpTblParameterSets->selectionModel() != NULL)
146 disconnect(mpTblParameterSets->selectionModel(), SIGNAL(selectionChanged(
const QItemSelection&,
const QItemSelection&)),
154 mpTblParameterSets->setModel(NULL);
156 connect(mpTblParameterSets->selectionModel(), SIGNAL(selectionChanged(
const QItemSelection&,
const QItemSelection&)),
159 mpTblParameterSets->resizeColumnsToContents();
169 bool selected =
false;
171 QModelIndexList selRows = mpTblParameterSets->selectionModel()->selectedRows();
173 if (selRows.size() == 0)
177 if (selRows.size() == 1)
188 mpBtnDelete->setEnabled(selected);
191 mpBtnClear->setEnabled(
true);
193 mpBtnClear->setEnabled(
false);
197 const QItemSelection&
C_UNUSED(deselected))
203 const QModelIndex&
C_UNUSED(bottomRight))
205 mpTblParameterSets->resizeColumnsToContents();
212 QModelIndex index =
mpProxyModel->mapToSource(proxyIndex);
227 std::string key =
static_cast< CModel *
>(
mpObject)->getModelParameterSets()[index.row()]->
getKey();
235 if (ev->key() == Qt::Key_Delete)
237 else if (ev->key() == Qt::Key_C && (ev->modifiers() & Qt::ControlModifier))
239 QModelIndexList selRows = mpTblParameterSets->selectionModel()->selectedRows(0);
245 QModelIndexList::const_iterator i;
247 for (i = selRows.begin(); i != selRows.end(); ++i)
251 if (!mpTblParameterSets->isColumnHidden(x))
263 QApplication::clipboard()->setText(str);
269 QRegExp regExp(mpLEFilter->text() +
"|New Report", Qt::CaseInsensitive, QRegExp::RegExp);
void switchToOtherWidget(const size_t &id, const std::string &key)
virtual bool isDefaultRow(const QModelIndex &i) const
void setListOfModelParameterSets(CCopasiVectorN< CModelParameterSet > *pListOfModelParameterSets)
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
const std::string & getKey() const
static CKeyFactory * getKeyFactory()
bool removeRows(QModelIndexList rows, const QModelIndex &index=QModelIndex())
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)