Model for DlgSettingsCurveList and CmdSettingsCurveList.
More...
#include <CurveNameList.h>
|
| CurveNameList () |
| Default constructor. More...
|
|
virtual int | columnCount (const QModelIndex &parent) const |
| One column. More...
|
|
bool | containsCurveNameCurrent (const QString &curveName) const |
| Return true if specified curve name is already in the list. More...
|
|
QString | currentCurvesAsString () const |
| For debugging we dump the curve names. More...
|
|
QString | currentCurveToOriginalCurve (const QString ¤tCurve) const |
| Return the original curve for the specified current curve. More...
|
|
unsigned int | currentCurveToPointCount (const QString ¤tCurve) const |
| Return the point count for the specified current curve. More...
|
|
virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
| Override normal flags with additional editing flags. More...
|
|
void | insertRow (int row, const QString &curveCurrent, const QString &curveOriginal, unsigned int pointCount) |
| Create a new entry at the specified row. More...
|
|
virtual QStandardItem * | item (int row, int column=0) const |
| Retrieve data from model. More...
|
|
unsigned int | numPointsForSelectedCurves (const QList< unsigned int > &rowsSelected) const |
| Return the number of points associated with the selected curves, as specified by their row numbers. More...
|
|
virtual bool | removeRows (int row, int count, const QModelIndex &parent) |
| Remove one row. More...
|
|
void | reset () |
| Clear all information. More...
|
|
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
| One row per curve name. More...
|
|
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role) |
| Store data for one curve name. More...
|
|
virtual void | setItem (int row, int column, QStandardItem *item) |
| Store one curve name data. More...
|
|
virtual Qt::DropActions | supportedDropActions () const |
| Allow dragging for reordering. More...
|
|
Model for DlgSettingsCurveList and CmdSettingsCurveList.
This is displayed as a QListView, with visible first column showing current curve name. Second column is hidden with curve name at the start of editing, or empty if none.
Definition at line 27 of file CurveNameList.h.
◆ CurveNameList()
CurveNameList::CurveNameList |
( |
| ) |
|
◆ columnCount()
int CurveNameList::columnCount |
( |
const QModelIndex & |
parent | ) |
const |
|
virtual |
◆ containsCurveNameCurrent()
bool CurveNameList::containsCurveNameCurrent |
( |
const QString & |
curveName | ) |
const |
Return true if specified curve name is already in the list.
Definition at line 28 of file CurveNameList.cpp.
33 CurrentCurveToOriginalCurve::const_iterator itr;
34 for (itr = m_currentCurveToOriginalCurve.begin (); itr != m_currentCurveToOriginalCurve.end (); ++itr) {
36 if (itr.key () == curveName) {
#define LOG4CPP_INFO_S(logger)
log4cpp::Category * mainCat
◆ currentCurvesAsString()
QString CurveNameList::currentCurvesAsString |
( |
| ) |
const |
For debugging we dump the curve names.
Definition at line 44 of file CurveNameList.cpp.
49 QTextStream str (&out);
51 for (
int row = 0; row <
rowCount (); row++) {
54 QString curveOriginal;
55 unsigned int points = 0;
56 if (m_currentCurveToOriginalCurve.contains (curveCurrent)) {
57 curveOriginal = m_currentCurveToOriginalCurve [curveCurrent];
58 if (m_originalCurveToPointCount.contains (curveOriginal)) {
60 points = m_originalCurveToPointCount [curveOriginal];
64 str <<
"\n current=" << curveCurrent.toLatin1().data()
65 <<
" original=" << curveOriginal
66 <<
" points=" << points;
#define LOG4CPP_INFO_S(logger)
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
One row per curve name.
log4cpp::Category * mainCat
◆ currentCurveToOriginalCurve()
QString CurveNameList::currentCurveToOriginalCurve |
( |
const QString & |
currentCurve | ) |
const |
Return the original curve for the specified current curve.
Definition at line 72 of file CurveNameList.cpp.
74 return m_currentCurveToOriginalCurve [currentCurve];
◆ currentCurveToPointCount()
unsigned int CurveNameList::currentCurveToPointCount |
( |
const QString & |
currentCurve | ) |
const |
Return the point count for the specified current curve.
Definition at line 77 of file CurveNameList.cpp.
79 QString originalCurve = m_currentCurveToOriginalCurve [currentCurve];
81 return m_originalCurveToPointCount [originalCurve];
◆ flags()
Qt::ItemFlags CurveNameList::flags |
( |
const QModelIndex & |
index | ) |
const |
|
virtual |
Override normal flags with additional editing flags.
Definition at line 122 of file CurveNameList.cpp.
124 if (index.isValid ()) {
128 return (QStandardItemModel::flags (index) |
129 Qt::ItemIsDragEnabled |
131 Qt::ItemIsSelectable |
132 Qt::ItemIsEditable) & ~Qt::ItemIsDropEnabled;
137 return QStandardItemModel::flags (index) |
138 Qt::ItemIsDropEnabled;
◆ insertRow()
void CurveNameList::insertRow |
( |
int |
row, |
|
|
const QString & |
curveCurrent, |
|
|
const QString & |
curveOriginal, |
|
|
unsigned int |
pointCount |
|
) |
| |
Create a new entry at the specified row.
Definition at line 143 of file CurveNameList.cpp.
150 <<
" curveCurrent=" << curveCurrent.toLatin1().data()
151 <<
" curveOriginal=" << curveOriginal.toLatin1().data()
152 <<
" points=" << pointCount;
154 QStandardItem *
item =
new QStandardItem (curveCurrent);
155 QStandardItemModel::insertRow (row,
item);
158 beginInsertRows (QModelIndex (),
162 m_currentCurveToOriginalCurve [curveCurrent] = curveOriginal;
163 m_originalCurveToPointCount [curveOriginal] = pointCount;
log4cpp::Category * mainCat
virtual QStandardItem * item(int row, int column=0) const
Retrieve data from model.
#define LOG4CPP_DEBUG_S(logger)
◆ item()
QStandardItem * CurveNameList::item |
( |
int |
row, |
|
|
int |
column = 0 |
|
) |
| const |
|
virtual |
Retrieve data from model.
Definition at line 168 of file CurveNameList.cpp.
175 return QStandardItemModel::item (row, column);
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
One row per curve name.
log4cpp::Category * mainCat
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
#define LOG4CPP_DEBUG_S(logger)
◆ numPointsForSelectedCurves()
unsigned int CurveNameList::numPointsForSelectedCurves |
( |
const QList< unsigned int > & |
rowsSelected | ) |
const |
Return the number of points associated with the selected curves, as specified by their row numbers.
Definition at line 178 of file CurveNameList.cpp.
181 for (
int i = 0; i < rowsSelected.count(); i++) {
182 int row = signed (rowsSelected [i]);
185 QString currentCurve = data (idx).toString ();
186 if (m_currentCurveToOriginalCurve.contains (currentCurve)) {
188 QString originalCurve = m_currentCurveToOriginalCurve [currentCurve];
189 if (m_originalCurveToPointCount.contains (originalCurve)) {
191 numPoints += m_originalCurveToPointCount [originalCurve];
196 return unsigned (numPoints);
◆ removeRows()
bool CurveNameList::removeRows |
( |
int |
row, |
|
|
int |
count, |
|
|
const QModelIndex & |
parent |
|
) |
| |
|
virtual |
Remove one row.
Definition at line 199 of file CurveNameList.cpp.
205 bool skip = (count != 1 || row < 0 || row >
rowCount () || parent.isValid());
207 QString before, after;
214 beginRemoveRows (QModelIndex (),
219 for (
int rowRemove = row; rowRemove < row + count; rowRemove++) {
220 QStandardItemModel::removeRows (row,
232 <<
" count=" << count
233 <<
" isRoot=" << (parent.isValid () ?
"no" :
"yes")
234 <<
" skip=" << (skip ?
"yes" :
"no")
235 <<
" before=" << before.toLatin1().data()
236 <<
" after=" << after.toLatin1().data();
QString currentCurvesAsString() const
For debugging we dump the curve names.
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
One row per curve name.
log4cpp::Category * mainCat
#define LOG4CPP_DEBUG_S(logger)
◆ reset()
void CurveNameList::reset |
( |
| ) |
|
Clear all information.
Definition at line 240 of file CurveNameList.cpp.
245 m_currentCurveToOriginalCurve.clear();
246 m_originalCurveToPointCount.clear();
#define LOG4CPP_INFO_S(logger)
log4cpp::Category * mainCat
◆ rowCount()
int CurveNameList::rowCount |
( |
const QModelIndex & |
parent = QModelIndex() | ) |
const |
|
virtual |
One row per curve name.
Definition at line 249 of file CurveNameList.cpp.
251 int count = QStandardItemModel::rowCount ();
◆ setData()
bool CurveNameList::setData |
( |
const QModelIndex & |
index, |
|
|
const QVariant & |
value, |
|
|
int |
role |
|
) |
| |
|
virtual |
Store data for one curve name.
Definition at line 259 of file CurveNameList.cpp.
264 <<
" row=" << index.row()
265 <<
" value=" << value.toString().toLatin1().data()
269 if (role == Qt::EditRole) {
272 if (curveNameIsAcceptable (value.toString(),
279 QString curveCurrentOld = data (idxOld).toString ();
280 QString curveCurrentNew = value.toString ();
283 QString curveOriginal;
284 if (m_currentCurveToOriginalCurve.contains (curveCurrentOld)) {
287 curveOriginal = m_currentCurveToOriginalCurve [curveCurrentOld];
290 m_currentCurveToOriginalCurve.remove (curveCurrentOld);
293 m_currentCurveToOriginalCurve [curveCurrentNew] = curveOriginal;
296 success = QStandardItemModel::setData (index,
308 success = QStandardItemModel::setData (index,
QString roleAsString(int role)
log4cpp::Category * mainCat
#define LOG4CPP_DEBUG_S(logger)
◆ setItem()
void CurveNameList::setItem |
( |
int |
row, |
|
|
int |
column, |
|
|
QStandardItem * |
item |
|
) |
| |
|
virtual |
Store one curve name data.
Definition at line 316 of file CurveNameList.cpp.
326 QStandardItemModel::setItem (row,
334 <<
" before=" << before.toLatin1().data()
335 <<
" after=" << after.toLatin1().data();
QString currentCurvesAsString() const
For debugging we dump the curve names.
log4cpp::Category * mainCat
virtual QStandardItem * item(int row, int column=0) const
Retrieve data from model.
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
#define LOG4CPP_DEBUG_S(logger)
◆ supportedDropActions()
Qt::DropActions CurveNameList::supportedDropActions |
( |
| ) |
const |
|
virtual |
Allow dragging for reordering.
Definition at line 338 of file CurveNameList.cpp.
340 return Qt::MoveAction;
The documentation for this class was generated from the following files: