mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-30 04:40:53 +00:00
Fixed: #1168 default & parent box working like a breeze
This commit is contained in:
parent
e80b6df4a2
commit
bff02807ee
3 changed files with 54 additions and 51 deletions
|
@ -73,7 +73,7 @@ void CConfiguration::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
// setup config file callback
|
// setup config file callback
|
||||||
Modules::config().setCallback("SearchPaths", CConfigCallback(this, &CConfiguration::cfcbSearchPaths));
|
Modules::config().setAndCallback("SearchPaths", CConfigCallback(this, &CConfiguration::cfcbSearchPaths));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,21 +79,18 @@ namespace NLQT
|
||||||
QBrush defaultBrush = QBrush(QColor(255,0,0,30));
|
QBrush defaultBrush = QBrush(QColor(255,0,0,30));
|
||||||
QBrush parentBrush = QBrush(QColor(0,255,0,30));
|
QBrush parentBrush = QBrush(QColor(0,255,0,30));
|
||||||
|
|
||||||
|
// if elm not existing it must be some kind of default or type value
|
||||||
|
if(!getItem(p_index)->getFormElm())
|
||||||
|
{
|
||||||
|
return defaultBrush;
|
||||||
|
}
|
||||||
|
|
||||||
|
// else it might be some parent elm
|
||||||
switch (getItem(p_index)->nodeFrom())
|
switch (getItem(p_index)->nodeFrom())
|
||||||
{
|
{
|
||||||
case NLGEORGES::UFormElm::NodeParentForm:
|
case NLGEORGES::UFormElm::NodeParentForm:
|
||||||
{
|
{
|
||||||
switch (getItem(p_index)->valueFrom())
|
return parentBrush;
|
||||||
{
|
|
||||||
case NLGEORGES::UFormElm::ValueDefaultDfn:
|
|
||||||
{
|
|
||||||
return defaultBrush;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
return parentBrush;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case NLGEORGES::UFormElm::NodeForm:
|
case NLGEORGES::UFormElm::NodeForm:
|
||||||
{
|
{
|
||||||
|
@ -103,21 +100,33 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
return parentBrush;
|
return parentBrush;
|
||||||
}
|
}
|
||||||
case NLGEORGES::UFormElm::ValueDefaultDfn:
|
|
||||||
{
|
|
||||||
return defaultBrush;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
return QVariant();
|
// parent status test kindof ugly, testing only 2 steps deep
|
||||||
}
|
// only needed for colorization as treeview default hides childs
|
||||||
}
|
// when parent is hidden
|
||||||
}
|
CFormItem *parent = getItem(p_index)->parent();
|
||||||
default:
|
if (parent)
|
||||||
{
|
{
|
||||||
return QVariant();
|
if (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)
|
||||||
}
|
{
|
||||||
}
|
return parentBrush;
|
||||||
|
}
|
||||||
|
|
||||||
|
CFormItem *parentParent = parent->parent();
|
||||||
|
if (parentParent)
|
||||||
|
{
|
||||||
|
if (parentParent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm)
|
||||||
|
{
|
||||||
|
return parentBrush;
|
||||||
|
}
|
||||||
|
} // endif parentParent
|
||||||
|
} // endif parent
|
||||||
|
} // end default
|
||||||
|
} // end switch valueFrom
|
||||||
|
} // end case nodeForm
|
||||||
|
} // end switch nodeFrom
|
||||||
|
return QVariant();
|
||||||
}
|
}
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
{
|
{
|
||||||
|
@ -136,7 +145,6 @@ namespace NLQT
|
||||||
}
|
}
|
||||||
else if(value.contains(".tga") || value.contains(".png"))
|
else if(value.contains(".tga") || value.contains(".png"))
|
||||||
{
|
{
|
||||||
qDebug() << p_index << p_role;
|
|
||||||
QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str();
|
QString path = NLMISC::CPath::lookup(value.toStdString(),false).c_str();
|
||||||
return QIcon(":/images/pqrticles.png");
|
return QIcon(":/images/pqrticles.png");
|
||||||
}
|
}
|
||||||
|
@ -282,8 +290,7 @@ namespace NLQT
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint num = 0;
|
uint num = 0;
|
||||||
UFormElm::TWhereIsNode *whereN = new UFormElm::TWhereIsNode;
|
|
||||||
UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue;
|
|
||||||
|
|
||||||
if (root->isStruct())
|
if (root->isStruct())
|
||||||
{
|
{
|
||||||
|
@ -292,6 +299,8 @@ namespace NLQT
|
||||||
root->getStructSize(structSize);
|
root->getStructSize(structSize);
|
||||||
while (num < structSize)
|
while (num < structSize)
|
||||||
{
|
{
|
||||||
|
UFormElm::TWhereIsNode *whereN = new UFormElm::TWhereIsNode;
|
||||||
|
UFormElm::TWhereIsValue *whereV = new UFormElm::TWhereIsValue;
|
||||||
// Append a new item to the current parent's list of children.
|
// Append a new item to the current parent's list of children.
|
||||||
std::string elmName;
|
std::string elmName;
|
||||||
if(root->getStructNodeName(num, elmName))
|
if(root->getStructNodeName(num, elmName))
|
||||||
|
@ -400,7 +409,6 @@ namespace NLQT
|
||||||
elmtType.append("_noValue");
|
elmtType.append("_noValue");
|
||||||
}
|
}
|
||||||
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType;
|
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType;
|
||||||
qDebug() << columnData;
|
|
||||||
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
|
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
|
||||||
//if (parents.last()->childCount() > 0) {
|
//if (parents.last()->childCount() > 0) {
|
||||||
// parents << parents.last()->child(parents.last()->childCount()-1);
|
// parents << parents.last()->child(parents.last()->childCount()-1);
|
||||||
|
@ -441,7 +449,7 @@ namespace NLQT
|
||||||
|
|
||||||
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType;
|
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType;
|
||||||
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
|
parent->appendChild(new CFormItem(elmt, columnData, parent, *whereV, *whereN));
|
||||||
|
|
||||||
//columnData << QString(elmName.c_str()) << QString("default") << QString("default");
|
//columnData << QString(elmName.c_str()) << QString("default") << QString("default");
|
||||||
//parent->appendChild(new CFormItem(elmt, columnData, parent, UFormElm::ValueDefaultDfn, UFormElm::NodeDfn));
|
//parent->appendChild(new CFormItem(elmt, columnData, parent, UFormElm::ValueDefaultDfn, UFormElm::NodeDfn));
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
|
|
||||||
bool CGeorgesFormProxyModel::filterAcceptsRow(int sourceRow,
|
bool CGeorgesFormProxyModel::filterAcceptsRow(int sourceRow,
|
||||||
const QModelIndex &sourceParent) const
|
const QModelIndex &sourceParent) const
|
||||||
{
|
{
|
||||||
//nlinfo("CGeorgesFormProxyModel::filterAcceptsRow");
|
//nlinfo("CGeorgesFormProxyModel::filterAcceptsRow");
|
||||||
|
|
||||||
|
@ -47,21 +47,19 @@ namespace NLQT
|
||||||
// item->nodeFrom(),
|
// item->nodeFrom(),
|
||||||
// smodel->showParents(),
|
// smodel->showParents(),
|
||||||
// (item->valueFrom() == NLGEORGES::UFormElm::NodeParentForm));
|
// (item->valueFrom() == NLGEORGES::UFormElm::NodeParentForm));
|
||||||
|
|
||||||
|
// if elm not existing it must be some kind of default or type value
|
||||||
|
if(!item->getFormElm())
|
||||||
|
{
|
||||||
|
return smodel->showDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
|
// else it might be some parent elm
|
||||||
switch (item->nodeFrom())
|
switch (item->nodeFrom())
|
||||||
{
|
{
|
||||||
case NLGEORGES::UFormElm::NodeParentForm:
|
case NLGEORGES::UFormElm::NodeParentForm:
|
||||||
{
|
{
|
||||||
switch (item->valueFrom())
|
return smodel->showParents();
|
||||||
{
|
|
||||||
case NLGEORGES::UFormElm::ValueDefaultDfn:
|
|
||||||
{
|
|
||||||
return smodel->showDefaults();
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
return smodel->showParents();;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case NLGEORGES::UFormElm::NodeForm:
|
case NLGEORGES::UFormElm::NodeForm:
|
||||||
{
|
{
|
||||||
|
@ -71,21 +69,18 @@ namespace NLQT
|
||||||
{
|
{
|
||||||
return smodel->showParents();
|
return smodel->showParents();
|
||||||
}
|
}
|
||||||
case NLGEORGES::UFormElm::ValueDefaultDfn:
|
|
||||||
{
|
|
||||||
return smodel->showDefaults();
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
return true;
|
CFormItem *parent = item->parent();
|
||||||
|
if (parent && (parent->nodeFrom() == NLGEORGES::UFormElm::NodeParentForm))
|
||||||
|
{
|
||||||
|
return smodel->showParents();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
Loading…
Reference in a new issue