13 #include <QtGui/QHeaderView>
14 #include <QtGui/QClipboard>
15 #include <QtGui/QKeyEvent>
42 mpProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
45 mpTblPlots->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
46 mpTblPlots->verticalHeader()->hide();
55 this, SLOT(
dataChanged(
const QModelIndex&,
const QModelIndex&)));
56 connect(mpLEFilter, SIGNAL(textChanged(
const QString &)),
75 assert(pDataModel != NULL);
86 mpTblPlots->doItemsLayout();
92 assert(pDataModel != NULL);
103 mpTblPlots->doItemsLayout();
114 if (mpTblPlots->hasFocus())
122 const QItemSelectionModel * pSelectionModel = mpTblPlots->selectionModel();
124 QModelIndexList mappedSelRows;
127 for (i = 0; i < imax; i++)
129 if (pSelectionModel->isRowSelected((
int) i, QModelIndex()))
135 if (mappedSelRows.empty())
145 QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
147 if (ret == QMessageBox::Yes)
172 if (mpTblPlots->selectionModel() != NULL)
174 disconnect(mpTblPlots->selectionModel(), SIGNAL(selectionChanged(
const QItemSelection&,
const QItemSelection&)),
180 mpTblPlots->setModel(NULL);
182 connect(mpTblPlots->selectionModel(), SIGNAL(selectionChanged(
const QItemSelection&,
const QItemSelection&)),
185 mpTblPlots->resizeColumnsToContents();
193 bool selected =
false;
195 QModelIndexList selRows = mpTblPlots->selectionModel()->selectedRows();
197 if (selRows.size() == 0)
201 if (selRows.size() == 1)
212 mpBtnDelete->setEnabled(selected);
215 mpBtnClear->setEnabled(
true);
217 mpBtnClear->setEnabled(
false);
221 const QItemSelection&
C_UNUSED(deselected))
227 const QModelIndex&
C_UNUSED(bottomRight))
229 mpTblPlots->resizeColumnsToContents();
236 QModelIndex index =
mpProxyModel->mapToSource(proxyIndex);
248 assert(pDataModel != NULL);
262 if (ev->key() == Qt::Key_Delete)
264 else if (ev->key() == Qt::Key_C &&
265 (ev->modifiers() & Qt::ControlModifier))
267 QModelIndexList selRows = mpTblPlots->selectionModel()->selectedRows(0);
273 QModelIndexList::const_iterator i;
275 for (i = selRows.begin(); i != selRows.end(); ++i)
279 if (!mpTblPlots->isColumnHidden(x))
291 QApplication::clipboard()->setText(str);
297 QRegExp regExp(mpLEFilter->text() +
"|New Plot", Qt::CaseInsensitive, QRegExp::RegExp);
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
void switchToOtherWidget(const size_t &id, const std::string &key)
virtual size_t size() const
CCopasiObject * get(const std::string &key)
void setActive(const bool &active)
bool removeRows(QModelIndexList rows, const QModelIndex &index=QModelIndex())
virtual int columnCount(const QModelIndex &parent=QModelIndex()) const
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
static CKeyFactory * getKeyFactory()
const COutputDefinitionVector * getPlotDefinitionList() const
virtual bool isDefaultRow(const QModelIndex &i) const
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)