git-svn-id: svn://db.shs.com.ru/libs@127 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2016-09-28 12:24:52 +00:00
parent b6e96da478
commit 9e1a99b598
16 changed files with 249 additions and 31 deletions

View File

@@ -128,7 +128,7 @@ void CDKItemModel::buildItem(CDKItem *it, CDSection & r) {
void CDKItemModel::internalRebuild() {
qDebug() << "[CDKItemModel]" << "internalRebuild()";
//qDebug() << "[CDKItemModel]" << "internalRebuild()";
if (root) delete root;
root = new CDKItem(0, CDKItem::ItemCDSection, 0);
CDSection & r = K.root();
@@ -162,7 +162,11 @@ CDKItem::~CDKItem() {
QVariant CDKItem::data(int column, int role) const {
if (role == Qt::BackgroundRole) {
switch (type_) {
case ItemCDType: return QBrush(QColor(255, 250, 230));
case ItemCDType: {
CDType & t = K.section(buildPath())[index_];
if (t.errorString().isEmpty()) return QBrush(QColor(255, 250, 230));
else return QBrush(QColor(255, 128, 128));
}
case ItemCDSection: return QBrush(QColor(230, 250, 230));
}
}
@@ -171,6 +175,10 @@ QVariant CDKItem::data(int column, int role) const {
if (t.type() == "b") return t.toBool() ? Qt::Checked : Qt::Unchecked;
else QVariant();
}
if (role == Qt::ToolTipRole && type_ == ItemCDType) {
CDType & t = K.section(buildPath())[index_];
return PI2QString(t.errorString());
}
if (role != Qt::DisplayRole && role != Qt::EditRole) return QVariant();
PIDeque<int> path = buildPath();
CDSection & rs = K.section(path);
@@ -221,7 +229,7 @@ QVariant CDKItem::value(CDType t, int role) const {
bool CDKItem::setData(int column, const QVariant &value) {
if ((column == 3 || column == 4) && type_ == ItemCDType) {
K.section(buildPath())[index_].setFormula(Q2PIString(value.toString()));
K.section(buildPath())[index_].setValue(Q2PIString(value.toString()));
return true;
}
return false;