mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22632 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
6415e84dc4
commit
c151549004
@ -93,8 +93,7 @@ void GuiIdListModel::insertRow(int const i, QString const & uiString,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QMap<int, QVariant>
|
QMap<int, QVariant> GuiIdListModel::itemData(QModelIndex const & index ) const
|
||||||
GuiIdListModel::itemData(QModelIndex const & index ) const
|
|
||||||
{
|
{
|
||||||
int const row = index.row();
|
int const row = index.row();
|
||||||
if (!rowIsValid(row))
|
if (!rowIsValid(row))
|
||||||
@ -104,10 +103,12 @@ QMap<int, QVariant>
|
|||||||
return qm;
|
return qm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following functions are currently unused but are retained here in
|
#if 0
|
||||||
case they should at some point be useful.
|
// The following functions are currently unused but are retained here in
|
||||||
|
// case they should at some point be useful.
|
||||||
|
|
||||||
QStringList GuiIdListModel::getIDStringList() const {
|
QStringList GuiIdListModel::getIDStringList() const
|
||||||
|
{
|
||||||
QStringList qsl;
|
QStringList qsl;
|
||||||
vector<OurData>::const_iterator it = userData_.begin();
|
vector<OurData>::const_iterator it = userData_.begin();
|
||||||
vector<OurData>::const_iterator end = userData_.end();
|
vector<OurData>::const_iterator end = userData_.end();
|
||||||
@ -134,8 +135,8 @@ bool GuiIdListModel::containsID(QVariant const & q) const
|
|||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
}
|
} // namespace frontend
|
||||||
}
|
} // namespace lyx
|
||||||
|
|
||||||
|
@ -39,12 +39,14 @@ namespace frontend {
|
|||||||
class GuiIdListModel : public QAbstractListModel {
|
class GuiIdListModel : public QAbstractListModel {
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
explicit GuiIdListModel() {};
|
GuiIdListModel() {}
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
// Methods overridden from QAbstractListModel
|
// Methods overridden from QAbstractListModel
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
///
|
///
|
||||||
inline int rowCount(QModelIndex const & parent = QModelIndex()) const;
|
int rowCount(QModelIndex const & parent = QModelIndex()) const
|
||||||
|
{ return userData_.size(); }
|
||||||
|
|
||||||
///
|
///
|
||||||
virtual QVariant data(QModelIndex const & index,
|
virtual QVariant data(QModelIndex const & index,
|
||||||
int role = Qt::DisplayRole) const;
|
int role = Qt::DisplayRole) const;
|
||||||
@ -53,7 +55,7 @@ public:
|
|||||||
///
|
///
|
||||||
bool removeRows(int row, int count, QModelIndex const & parent = QModelIndex());
|
bool removeRows(int row, int count, QModelIndex const & parent = QModelIndex());
|
||||||
///
|
///
|
||||||
void clear() { removeRows(0, rowCount()); };
|
void clear() { removeRows(0, rowCount()); }
|
||||||
///
|
///
|
||||||
virtual bool setData (QModelIndex const & index,
|
virtual bool setData (QModelIndex const & index,
|
||||||
const QVariant & value, int role = Qt::EditRole );
|
const QVariant & value, int role = Qt::EditRole );
|
||||||
@ -64,22 +66,22 @@ public:
|
|||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
///
|
///
|
||||||
void setUIString(QModelIndex const & index, QString const & value)
|
void setUIString(QModelIndex const & index, QString const & value)
|
||||||
{ setData(index, value); };
|
{ setData(index, value); }
|
||||||
///
|
///
|
||||||
void setUIString(int const i, QString const & value)
|
void setUIString(int const i, QString const & value)
|
||||||
{ setUIString(index(i), value); };
|
{ setUIString(index(i), value); }
|
||||||
///
|
///
|
||||||
void setIDString(QModelIndex const & index, QString const & value)
|
void setIDString(QModelIndex const & index, QString const & value)
|
||||||
{ setData(index, value, Qt::UserRole); };
|
{ setData(index, value, Qt::UserRole); }
|
||||||
///
|
///
|
||||||
void setIDString(int const i, std::string const & value)
|
void setIDString(int const i, std::string const & value)
|
||||||
{ setIDString(index(i), toqstr(value)); };
|
{ setIDString(index(i), toqstr(value)); }
|
||||||
///
|
///
|
||||||
virtual QString getIDString(QModelIndex const & index) const
|
virtual QString getIDString(QModelIndex const & index) const
|
||||||
{ return data(index, Qt::UserRole).toString(); };
|
{ return data(index, Qt::UserRole).toString(); }
|
||||||
///
|
///
|
||||||
virtual std::string getIDString(int const i) const
|
virtual std::string getIDString(int const i) const
|
||||||
{ return fromqstr(getIDString(index(i))); };
|
{ return fromqstr(getIDString(index(i))); }
|
||||||
///
|
///
|
||||||
void insertRow(int const i, QString const & uiString,
|
void insertRow(int const i, QString const & uiString,
|
||||||
std::string const & idString);
|
std::string const & idString);
|
||||||
@ -87,10 +89,10 @@ public:
|
|||||||
case they should at some point be useful.
|
case they should at some point be useful.
|
||||||
///
|
///
|
||||||
void setUIString(int const i, std::string const & value)
|
void setUIString(int const i, std::string const & value)
|
||||||
{ setUIString(index(i), value); };
|
{ setUIString(index(i), value); }
|
||||||
///
|
///
|
||||||
void setIDString(int const i, QString const & value)
|
void setIDString(int const i, QString const & value)
|
||||||
{ setIDString(index(i), value); };
|
{ setIDString(index(i), value); }
|
||||||
///
|
///
|
||||||
QStringList getIDStringList() const;
|
QStringList getIDStringList() const;
|
||||||
///
|
///
|
||||||
@ -105,6 +107,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
/// noncopyable
|
/// noncopyable
|
||||||
GuiIdListModel(GuiIdListModel const &);
|
GuiIdListModel(GuiIdListModel const &);
|
||||||
|
void operator=(GuiIdListModel const &);
|
||||||
///
|
///
|
||||||
struct OurData {
|
struct OurData {
|
||||||
QVariant uiString;
|
QVariant uiString;
|
||||||
@ -113,18 +116,13 @@ private:
|
|||||||
///
|
///
|
||||||
std::vector<OurData> userData_;
|
std::vector<OurData> userData_;
|
||||||
///
|
///
|
||||||
inline bool rowIsValid(int const i) const
|
bool rowIsValid(int const i) const
|
||||||
{
|
{
|
||||||
return i >= 0 && i <= int(userData_.size());
|
return i >= 0 && i <= int(userData_.size());
|
||||||
}
|
}
|
||||||
;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//definition is here to silence a warning
|
|
||||||
inline int GuiIdListModel::rowCount(QModelIndex const &) const
|
|
||||||
{ return userData_.size(); }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif //GUIIDLISTMODEL_H
|
#endif //GUIIDLISTMODEL_H
|
||||||
|
Loading…
Reference in New Issue
Block a user