mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 09:19:01 +00:00
Changed: #1168 default checkbox activated, formdelegate adapted to introduced proxymodel
This commit is contained in:
parent
18e0b77db2
commit
4fa112a08c
9 changed files with 242 additions and 82 deletions
|
@ -35,6 +35,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
// Project includes
|
// Project includes
|
||||||
#include "georgesform_model.h"
|
#include "georgesform_model.h"
|
||||||
|
#include "georgesform_proxy_model.h"
|
||||||
#include "formitem.h"
|
#include "formitem.h"
|
||||||
|
|
||||||
namespace NLQT
|
namespace NLQT
|
||||||
|
@ -49,14 +50,15 @@ namespace NLQT
|
||||||
const QStyleOptionViewItem & option ,
|
const QStyleOptionViewItem & option ,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
CFormItem *item = static_cast<CFormItem*>(index.internalPointer());
|
const CGeorgesFormProxyModel * mp = dynamic_cast<const CGeorgesFormProxyModel *>(index.model());
|
||||||
|
const CGeorgesFormModel * m = dynamic_cast<const CGeorgesFormModel *>(mp->sourceModel());
|
||||||
|
CFormItem *item = static_cast<CFormItem*>(mp->mapToSource(index).internalPointer());
|
||||||
QString value = item->data(1).toString();
|
QString value = item->data(1).toString();
|
||||||
|
|
||||||
if (value.isEmpty())
|
if (value.isEmpty() || !mp || !m)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
const NLGEORGES::UType *type = dynamic_cast<const CGeorgesFormModel *>(index.model())->
|
const NLGEORGES::UType *type = m->getItem(mp->mapToSource(index))->getFormElm()->getType();
|
||||||
getItem(index)->getFormElm()->getType();
|
|
||||||
if(type)
|
if(type)
|
||||||
{
|
{
|
||||||
int numDefinitions = type->getNumDefinition();
|
int numDefinitions = type->getNumDefinition();
|
||||||
|
@ -130,8 +132,10 @@ namespace NLQT
|
||||||
void FormDelegate::setEditorData(QWidget *editor,
|
void FormDelegate::setEditorData(QWidget *editor,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
const NLGEORGES::UType *type = dynamic_cast<const CGeorgesFormModel *>(index.model())->
|
const CGeorgesFormProxyModel * mp = dynamic_cast<const CGeorgesFormProxyModel *>(index.model());
|
||||||
getItem(index)->getFormElm()->getType();
|
const CGeorgesFormModel * m = dynamic_cast<const CGeorgesFormModel *>(mp->sourceModel());
|
||||||
|
|
||||||
|
const NLGEORGES::UType *type = m->getItem(mp->mapToSource(index))->getFormElm()->getType();
|
||||||
int numDefinitions = type->getNumDefinition();
|
int numDefinitions = type->getNumDefinition();
|
||||||
QString value = index.model()->data(index, Qt::DisplayRole).toString();
|
QString value = index.model()->data(index, Qt::DisplayRole).toString();
|
||||||
|
|
||||||
|
@ -175,8 +179,10 @@ namespace NLQT
|
||||||
void FormDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
void FormDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||||
const QModelIndex &index) const
|
const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
const NLGEORGES::UType *type = dynamic_cast<const CGeorgesFormModel *>(index.model())->
|
const CGeorgesFormProxyModel * mp = dynamic_cast<const CGeorgesFormProxyModel *>(index.model());
|
||||||
getItem(index)->getFormElm()->getType();
|
const CGeorgesFormModel * m = dynamic_cast<const CGeorgesFormModel *>(mp->sourceModel());
|
||||||
|
|
||||||
|
const NLGEORGES::UType *type = m->getItem(mp->mapToSource(index))->getFormElm()->getType();
|
||||||
int numDefinitions = type->getNumDefinition();
|
int numDefinitions = type->getNumDefinition();
|
||||||
|
|
||||||
if (numDefinitions)
|
if (numDefinitions)
|
||||||
|
|
|
@ -85,6 +85,10 @@ namespace NLQT
|
||||||
if (column < 0 || column >= itemData.size())
|
if (column < 0 || column >= itemData.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// TODO: default values
|
||||||
|
if (!formElm)
|
||||||
|
return false;
|
||||||
|
|
||||||
itemData[column] = value;
|
itemData[column] = value;
|
||||||
if (formElm->isAtom())
|
if (formElm->isAtom())
|
||||||
{
|
{
|
||||||
|
|
|
@ -65,10 +65,12 @@ namespace NLQT
|
||||||
_ui.treeView->setItemDelegateForColumn(1, formdelegate);
|
_ui.treeView->setItemDelegateForColumn(1, formdelegate);
|
||||||
|
|
||||||
|
|
||||||
connect(_ui.treeView, SIGNAL(doubleClicked (QModelIndex)),
|
//connect(_ui.treeView, SIGNAL(doubleClicked (QModelIndex)),
|
||||||
this, SLOT(doubleClicked (QModelIndex)));
|
// this, SLOT(doubleClicked (QModelIndex)));
|
||||||
connect(_ui.checkBoxParent, SIGNAL(stateChanged(int)),
|
connect(_ui.checkBoxParent, SIGNAL(toggled(bool)),
|
||||||
this, SLOT(showParentRows (int)));
|
this, SLOT(filterRows()));
|
||||||
|
connect(_ui.checkBoxDefaults, SIGNAL(toggled(bool)),
|
||||||
|
this, SLOT(filterRows()));
|
||||||
}
|
}
|
||||||
|
|
||||||
CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()
|
CGeorgesTreeViewDialog::~CGeorgesTreeViewDialog()
|
||||||
|
@ -131,9 +133,9 @@ namespace NLQT
|
||||||
_ui.treeView->resizeColumnToContents(0);
|
_ui.treeView->resizeColumnToContents(0);
|
||||||
_ui.treeView->resizeColumnToContents(1);
|
_ui.treeView->resizeColumnToContents(1);
|
||||||
_ui.treeView->resizeColumnToContents(2);
|
_ui.treeView->resizeColumnToContents(2);
|
||||||
_ui.treeView->hideColumn(3);
|
//_ui.treeView->hideColumn(3);
|
||||||
|
|
||||||
showParentRows(_ui.checkBoxParent->isChecked());
|
filterRows();
|
||||||
|
|
||||||
//_ui.treeView->setRowHidden(0,QModelIndex(),true);
|
//_ui.treeView->setRowHidden(0,QModelIndex(),true);
|
||||||
connect(model, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)),
|
connect(model, SIGNAL(dataChanged(const QModelIndex, const QModelIndex)),
|
||||||
|
@ -237,8 +239,10 @@ namespace NLQT
|
||||||
|
|
||||||
void CGeorgesTreeViewDialog::doubleClicked ( const QModelIndex & index )
|
void CGeorgesTreeViewDialog::doubleClicked ( const QModelIndex & index )
|
||||||
{
|
{
|
||||||
if (index.column() == 1)
|
if (index.column() == 1) {
|
||||||
|
//QTreeView::doubleClicked(index);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CFormItem *item = static_cast<CFormItem*>(index.internalPointer());
|
CFormItem *item = static_cast<CFormItem*>(index.internalPointer());
|
||||||
|
|
||||||
|
@ -264,53 +268,61 @@ namespace NLQT
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Modules::mainWin().getTreeViewList().removeOne(this);
|
if(Modules::mainWin().getTreeViewList().size() == 1)
|
||||||
if(!Modules::mainWin().getTreeViewList().size())
|
|
||||||
{
|
{
|
||||||
Modules::mainWin().createEmptyView();
|
Modules::mainWin().createEmptyView(
|
||||||
|
Modules::mainWin().getTreeViewList().takeFirst());
|
||||||
}
|
}
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGeorgesTreeViewDialog::showParentRows(int newState)
|
void CGeorgesTreeViewDialog::filterRows()
|
||||||
{
|
{
|
||||||
|
nlinfo("CGeorgesTreeViewDialog::filterRows");
|
||||||
CGeorgesFormProxyModel * mp = dynamic_cast<CGeorgesFormProxyModel *>(_ui.treeView->model());
|
CGeorgesFormProxyModel * mp = dynamic_cast<CGeorgesFormProxyModel *>(_ui.treeView->model());
|
||||||
CGeorgesFormModel *m = dynamic_cast<CGeorgesFormModel *>(mp->sourceModel());
|
CGeorgesFormModel *m = dynamic_cast<CGeorgesFormModel *>(mp->sourceModel());
|
||||||
|
if (m) {
|
||||||
for (int i = 0; i < m->rowCount(); i++)
|
m->setShowParents(_ui.checkBoxParent->isChecked());
|
||||||
{
|
m->setShowDefaults(_ui.checkBoxDefaults->isChecked());
|
||||||
const QModelIndex in = m->index(i,0);
|
|
||||||
if (m->getItem(in)->nodeFrom() == UFormElm::NodeParentForm)
|
|
||||||
{
|
|
||||||
if (newState == Qt::Checked)
|
|
||||||
{
|
|
||||||
_ui.treeView->setRowHidden(in.row(),in.parent(),false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_ui.treeView->setRowHidden(in.row(),in.parent(),true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // search childs // recursive?
|
|
||||||
for (int j = 0; j < m->rowCount(in); j++)
|
|
||||||
{
|
|
||||||
const QModelIndex in2 = m->index(j,0,in);
|
|
||||||
if (m->getItem(in2)->nodeFrom() == UFormElm::NodeParentForm)
|
|
||||||
{
|
|
||||||
if (newState == Qt::Checked)
|
|
||||||
{
|
|
||||||
_ui.treeView->setRowHidden(in2.row(),in,false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_ui.treeView->setRowHidden(in2.row(),in,true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // end of search childs
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//CGeorgesFormProxyModel * mp = dynamic_cast<CGeorgesFormProxyModel *>(_ui.treeView->model());
|
||||||
|
//CGeorgesFormModel *m = dynamic_cast<CGeorgesFormModel *>(mp->sourceModel());
|
||||||
|
|
||||||
|
//for (int i = 0; i < m->rowCount(); i++)
|
||||||
|
//{
|
||||||
|
// const QModelIndex in = m->index(i,0);
|
||||||
|
// if (m->getItem(in)->nodeFrom() == UFormElm::NodeParentForm)
|
||||||
|
// {
|
||||||
|
// if (newState == Qt::Checked)
|
||||||
|
// {
|
||||||
|
// _ui.treeView->setRowHidden(in.row(),in.parent(),false);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// _ui.treeView->setRowHidden(in.row(),in.parent(),true);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// { // search childs // recursive?
|
||||||
|
// for (int j = 0; j < m->rowCount(in); j++)
|
||||||
|
// {
|
||||||
|
// const QModelIndex in2 = m->index(j,0,in);
|
||||||
|
// if (m->getItem(in2)->nodeFrom() == UFormElm::NodeParentForm)
|
||||||
|
// {
|
||||||
|
// if (newState == Qt::Checked)
|
||||||
|
// {
|
||||||
|
// _ui.treeView->setRowHidden(in2.row(),in,false);
|
||||||
|
// }
|
||||||
|
// else
|
||||||
|
// {
|
||||||
|
// _ui.treeView->setRowHidden(in2.row(),in,true);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// } // end of search childs
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -66,7 +66,7 @@ namespace NLQT
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void doubleClicked ( const QModelIndex & index );
|
void doubleClicked ( const QModelIndex & index );
|
||||||
void modifiedFile( );
|
void modifiedFile( );
|
||||||
void showParentRows(int);
|
void filterRows();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::CGeorgesTreeViewDialog _ui;
|
Ui::CGeorgesTreeViewDialog _ui;
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>241</width>
|
<width>199</width>
|
||||||
<height>236</height>
|
<height>165</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
@ -76,11 +76,48 @@ namespace NLQT
|
||||||
}
|
}
|
||||||
case Qt::BackgroundRole:
|
case Qt::BackgroundRole:
|
||||||
{
|
{
|
||||||
if (getItem(p_index)->valueFrom() == UFormElm::ValueDefaultDfn)
|
QBrush defaultBrush = QBrush(QColor(255,0,0,30));
|
||||||
return QBrush(QColor(255,0,0,30));
|
QBrush parentBrush = QBrush(QColor(0,255,0,30));
|
||||||
if (getItem(p_index)->nodeFrom() == UFormElm::NodeParentForm)
|
|
||||||
return QBrush(QColor(0,255,0,30));
|
switch (getItem(p_index)->nodeFrom())
|
||||||
return QVariant();
|
{
|
||||||
|
case NLGEORGES::UFormElm::NodeParentForm:
|
||||||
|
{
|
||||||
|
switch (getItem(p_index)->valueFrom())
|
||||||
|
{
|
||||||
|
case NLGEORGES::UFormElm::ValueDefaultDfn:
|
||||||
|
{
|
||||||
|
return defaultBrush;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return parentBrush;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case NLGEORGES::UFormElm::NodeForm:
|
||||||
|
{
|
||||||
|
switch (getItem(p_index)->valueFrom())
|
||||||
|
{
|
||||||
|
case NLGEORGES::UFormElm::ValueParentForm:
|
||||||
|
{
|
||||||
|
return parentBrush;
|
||||||
|
}
|
||||||
|
case NLGEORGES::UFormElm::ValueDefaultDfn:
|
||||||
|
{
|
||||||
|
return defaultBrush;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return QVariant();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case Qt::DecorationRole:
|
case Qt::DecorationRole:
|
||||||
{
|
{
|
||||||
|
@ -363,6 +400,7 @@ 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);
|
||||||
|
@ -372,12 +410,47 @@ namespace NLQT
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// add Defaults
|
// add Defaults
|
||||||
|
// TODO: spams warnings for non ATOM values but i dont get type of non existing nodes
|
||||||
|
bool success = root->getValueByName(value, elmName.c_str(),UFormElm::Eval,whereV);
|
||||||
|
switch (*whereN)
|
||||||
|
{
|
||||||
|
case UFormElm::NodeForm:
|
||||||
|
elmtType.append("_fromForm"); break;
|
||||||
|
case UFormElm::NodeParentForm:
|
||||||
|
elmtType.append("_fromParentForm"); break;
|
||||||
|
case UFormElm::NodeDfn:
|
||||||
|
elmtType.append("_isDFN"); break;
|
||||||
|
case UFormElm::NodeType:
|
||||||
|
elmtType.append("_isType"); break;
|
||||||
|
default:
|
||||||
|
elmtType.append("_noNode");
|
||||||
|
}
|
||||||
|
switch (*whereV)
|
||||||
|
{
|
||||||
|
case UFormElm::ValueForm:
|
||||||
|
elmtType.append("_formValue"); break;
|
||||||
|
case UFormElm::ValueParentForm:
|
||||||
|
elmtType.append("_parentValue"); break;
|
||||||
|
case UFormElm::ValueDefaultDfn:
|
||||||
|
elmtType.append("_dfnValue"); break;
|
||||||
|
case UFormElm::ValueDefaultType:
|
||||||
|
elmtType.append("_typeValue"); break;
|
||||||
|
default:
|
||||||
|
elmtType.append("_noValue");
|
||||||
|
}
|
||||||
|
|
||||||
|
columnData << QString(elmName.c_str()) << QString(value.c_str()) << "" << elmtType;
|
||||||
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nlinfo("getNodeByName returned false");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
num++;
|
num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -474,6 +547,20 @@ namespace NLQT
|
||||||
loadFormHeader();
|
loadFormHeader();
|
||||||
loadFormData(_rootElm, _rootItem);
|
loadFormData(_rootElm, _rootItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
void CGeorgesFormModel::setShowParents( bool show ) {
|
||||||
|
_showParents = show;
|
||||||
|
Q_EMIT layoutAboutToBeChanged();
|
||||||
|
Q_EMIT layoutChanged();
|
||||||
|
}
|
||||||
|
void CGeorgesFormModel::setShowDefaults( bool show )
|
||||||
|
{
|
||||||
|
_showDefaults = show;
|
||||||
|
Q_EMIT layoutAboutToBeChanged();
|
||||||
|
Q_EMIT layoutChanged();
|
||||||
|
}
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
||||||
/* end of file */
|
/* end of file */
|
||||||
|
|
|
@ -55,6 +55,10 @@ namespace NLQT
|
||||||
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
CFormItem *getItem(const QModelIndex &index) const;
|
CFormItem *getItem(const QModelIndex &index) const;
|
||||||
CGeorgesFormModel *model() { return this; }
|
CGeorgesFormModel *model() { return this; }
|
||||||
|
bool showParents() { return _showParents;}
|
||||||
|
bool showDefaults() { return _showDefaults;}
|
||||||
|
void setShowParents( bool show );
|
||||||
|
void setShowDefaults( bool show );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupModelData();
|
void setupModelData();
|
||||||
|
@ -68,6 +72,9 @@ namespace NLQT
|
||||||
QStringList _parents;
|
QStringList _parents;
|
||||||
QList<const QModelIndex*>* _parentRows;
|
QList<const QModelIndex*>* _parentRows;
|
||||||
|
|
||||||
|
bool _showParents;
|
||||||
|
bool _showDefaults;
|
||||||
|
|
||||||
};/* class CGeorgesFormModel */
|
};/* class CGeorgesFormModel */
|
||||||
|
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -17,9 +17,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "georgesform_proxy_model.h"
|
#include "georgesform_proxy_model.h"
|
||||||
|
#include "georgesform_model.h"
|
||||||
|
|
||||||
// NeL includes
|
// NeL includes
|
||||||
#include <nel/misc/debug.h>
|
#include <nel/misc/debug.h>
|
||||||
|
#include <nel/georges/u_form_elm.h>
|
||||||
|
|
||||||
|
// project includes
|
||||||
|
#include "formitem.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
namespace NLQT
|
namespace NLQT
|
||||||
{
|
{
|
||||||
|
@ -27,21 +34,58 @@ 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");
|
||||||
//QModelIndex index0 = sourceModel()->index(sourceRow, 0, sourceParent);
|
|
||||||
//QModelIndex index1 = sourceModel()->index(sourceRow, 1, sourceParent);
|
|
||||||
//QModelIndex index2 = sourceModel()->index(sourceRow, 2, sourceParent);
|
|
||||||
|
|
||||||
//return (sourceModel()->data(index0).toString().contains(filterRegExp())
|
// column doesnt matter for item
|
||||||
// || sourceModel()->data(index1).toString().contains(filterRegExp()))
|
CGeorgesFormModel *smodel = dynamic_cast<CGeorgesFormModel *>(sourceModel());
|
||||||
// && dateInRange(sourceModel()->data(index2).toDate());
|
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
|
||||||
|
CFormItem *item = smodel->getItem(index);
|
||||||
|
|
||||||
// if (getItem(p_index)->valueFrom() == UFormElm::ValueDefaultDfn)
|
//qDebug() << smodel->showParents() << (item->valueFrom() == NLGEORGES::UFormElm::NodeParentForm);
|
||||||
// return QBrush(QColor(255,0,0,30));
|
//nlinfo("%s %d %d %d %d", item->data(index.column()).toString().toStdString().c_str(),
|
||||||
// if (getItem(p_index)->nodeFrom() == UFormElm::NodeParentForm)
|
// item->valueFrom(),
|
||||||
// return QBrush(QColor(0,255,0,30));
|
// item->nodeFrom(),
|
||||||
// return QVariant();
|
// smodel->showParents(),
|
||||||
return true;
|
// (item->valueFrom() == NLGEORGES::UFormElm::NodeParentForm));
|
||||||
|
switch (item->nodeFrom())
|
||||||
|
{
|
||||||
|
case NLGEORGES::UFormElm::NodeParentForm:
|
||||||
|
{
|
||||||
|
switch (item->valueFrom())
|
||||||
|
{
|
||||||
|
case NLGEORGES::UFormElm::ValueDefaultDfn:
|
||||||
|
{
|
||||||
|
return smodel->showDefaults();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return smodel->showParents();;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case NLGEORGES::UFormElm::NodeForm:
|
||||||
|
{
|
||||||
|
switch (item->valueFrom())
|
||||||
|
{
|
||||||
|
case NLGEORGES::UFormElm::ValueParentForm:
|
||||||
|
{
|
||||||
|
return smodel->showParents();
|
||||||
|
}
|
||||||
|
case NLGEORGES::UFormElm::ValueDefaultDfn:
|
||||||
|
{
|
||||||
|
return smodel->showDefaults();
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
@ -49,7 +93,7 @@ namespace NLQT
|
||||||
bool CGeorgesFormProxyModel::filterAcceptsColumn(int sourceRow,
|
bool CGeorgesFormProxyModel::filterAcceptsColumn(int sourceRow,
|
||||||
const QModelIndex &sourceParent) const
|
const QModelIndex &sourceParent) const
|
||||||
{
|
{
|
||||||
nlinfo("CGeorgesFormProxyModel::filterAcceptsColumn");
|
//nlinfo("CGeorgesFormProxyModel::filterAcceptsColumn");
|
||||||
return QSortFilterProxyModel::filterAcceptsColumn(sourceRow, sourceParent);
|
return QSortFilterProxyModel::filterAcceptsColumn(sourceRow, sourceParent);
|
||||||
}
|
}
|
||||||
} /* namespace NLQT */
|
} /* namespace NLQT */
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>472</width>
|
<width>540</width>
|
||||||
<height>310</height>
|
<height>370</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -18,8 +18,8 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>89</width>
|
<width>0</width>
|
||||||
<height>122</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>0</width>
|
||||||
<height>100</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
|
Loading…
Reference in a new issue