fixed toggle section
This commit is contained in:
@@ -267,7 +267,7 @@ void XQMainWindow::onTreeViewItemClicked( const XQItem& item )
|
|||||||
|
|
||||||
void XQMainWindow::onTreeViewItemChanged(const XQItem& item )
|
void XQMainWindow::onTreeViewItemChanged(const XQItem& item )
|
||||||
{
|
{
|
||||||
//qDebug() << " --- TREE VIEW itemChanged:" << item.text() << " : " << item.parent()->text();
|
qDebug() << " --- TREE VIEW itemChanged:" << item.text() << " : " << item.parent()->text() << " : " << (void*)&_mainModel << " : " << (void*) sender();
|
||||||
// hier müssen wir erst das projekt aktivieren
|
// hier müssen wir erst das projekt aktivieren
|
||||||
XQItem* xqItem = static_cast<XQItem*>(item.parent());
|
XQItem* xqItem = static_cast<XQItem*>(item.parent());
|
||||||
onTreeViewItemClicked( *xqItem );
|
onTreeViewItemClicked( *xqItem );
|
||||||
@@ -312,23 +312,14 @@ void XQMainWindow::onSectionCreated( const XQModelSection& section )
|
|||||||
void XQMainWindow::onSectionToggled( const XQModelSection& section )
|
void XQMainWindow::onSectionToggled( const XQModelSection& section )
|
||||||
{
|
{
|
||||||
qDebug() << " --- XXX section toggled: " << section.contentType() << ":" << section.sheetRootNode()->to_string();
|
qDebug() << " --- XXX section toggled: " << section.contentType() << ":" << section.sheetRootNode()->to_string();
|
||||||
if( _currentProjectItem )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
qDebug() << " --- XXX section toggled 2: " << _currentProjectItem->text();
|
|
||||||
for (int row = 0; row < _currentProjectItem->rowCount(); ++row)
|
for (int row = 0; row < _currentProjectItem->rowCount(); ++row)
|
||||||
{
|
{
|
||||||
QStandardItem* child = _currentProjectItem->child(row);
|
QStandardItem* child = _currentProjectItem->child(row);
|
||||||
qDebug() << " --- XXX section toggled 3: " << child->text();
|
|
||||||
if (child->text() == section.contentType() )
|
if (child->text() == section.contentType() )
|
||||||
{
|
{
|
||||||
// rekursion vermeiden
|
|
||||||
_currentProjectItem->model()->blockSignals( true );
|
|
||||||
bool checked = (child->checkState() == Qt::Checked);
|
bool checked = (child->checkState() == Qt::Checked);
|
||||||
qDebug() << " --- XXX section toggled 4: " << child->text() << " ->" << checked;
|
|
||||||
child->setCheckState( checked ? Qt::Unchecked :Qt::Checked );
|
child->setCheckState( checked ? Qt::Unchecked :Qt::Checked );
|
||||||
_currentProjectItem->model()->blockSignals( false );
|
|
||||||
_mainTreeView->repaint();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -92,18 +92,16 @@ void XQItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option
|
|||||||
|
|
||||||
case XQItem::ComboBoxStyle :
|
case XQItem::ComboBoxStyle :
|
||||||
return drawComboBoxStyle( painter, option, index );
|
return drawComboBoxStyle( painter, option, index );
|
||||||
|
/*
|
||||||
case XQItem::SpinBoxStyle :
|
case XQItem::SpinBoxStyle :
|
||||||
return drawSpinBoxStyle( painter, option, index );
|
return drawSpinBoxStyle( painter, option, index );
|
||||||
|
|
||||||
case XQItem::ProgressBarStyle :
|
case XQItem::ProgressBarStyle :
|
||||||
return drawProgressBarStyle( painter, option, index );
|
return drawProgressBarStyle( painter, option, index );
|
||||||
|
*/
|
||||||
case XQItem::HiddenStyle :
|
case XQItem::HiddenStyle :
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
} // switch
|
} // switch
|
||||||
|
@@ -113,6 +113,7 @@ XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role )
|
|||||||
// Gibt es den geänderten ItemType schon?
|
// Gibt es den geänderten ItemType schon?
|
||||||
QString newKey = myClone->makeItemTypeKey();
|
QString newKey = myClone->makeItemTypeKey();
|
||||||
// jawoll
|
// jawoll
|
||||||
|
|
||||||
if( s_ItemTypeMap.contains( newKey ) )
|
if( s_ItemTypeMap.contains( newKey ) )
|
||||||
{
|
{
|
||||||
// abräumen ...
|
// abräumen ...
|
||||||
|
@@ -154,7 +154,7 @@ void XQViewModel::initModel(const QString& modelName)
|
|||||||
//! die section kann erst gültig sein, wenn die items im model gelandet sind,
|
//! die section kann erst gültig sein, wenn die items im model gelandet sind,
|
||||||
//! deswegen ist das hier zusammengefasst.
|
//! deswegen ist das hier zusammengefasst.
|
||||||
|
|
||||||
//! Wrzeugt dann eine section aus einer frisch erzeugten itemlist. Der erste modelindex
|
//! Erzeugt dann eine section aus einer frisch erzeugten itemlist. Der erste modelindex
|
||||||
//! der liste und der root knoten der model-beschreibung werden gespeichert.
|
//! der liste und der root knoten der model-beschreibung werden gespeichert.
|
||||||
|
|
||||||
void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode )
|
void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode )
|
||||||
@@ -195,7 +195,6 @@ void XQViewModel::toggleSection( const XQModelSection& section )
|
|||||||
{
|
{
|
||||||
XQSectionRange pos = _sections.sectionRange(section);
|
XQSectionRange pos = _sections.sectionRange(section);
|
||||||
_treeTable->toggleRowsHidden(pos.firstRow, pos.lastRow );
|
_treeTable->toggleRowsHidden(pos.firstRow, pos.lastRow );
|
||||||
emit sectionToggled(section);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,7 +521,8 @@ void XQViewModel::cmdToggleSection( const XQCommand& command )
|
|||||||
const QModelIndex& index = command.originIndex();
|
const QModelIndex& index = command.originIndex();
|
||||||
Q_ASSERT(index.isValid());
|
Q_ASSERT(index.isValid());
|
||||||
const XQModelSection& section = _sections.sectionByRow(index.row());
|
const XQModelSection& section = _sections.sectionByRow(index.row());
|
||||||
toggleSection( section );
|
//toggleSection( section );
|
||||||
|
emit sectionToggled(section);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
<ValueType RenderStyle="FormattedStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" UnitType="Coulomb"/>
|
<ValueType RenderStyle="FormattedStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" UnitType="Coulomb"/>
|
||||||
<CheckableType RenderStyle="FormattedStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" UnitType="###"/>
|
<CheckableType RenderStyle="FormattedStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" UnitType="###"/>
|
||||||
<PercentageType RenderStyle="ProgressBarStyle" EditorType="ProgressBarType" ItemFlags="IsEnabled|IsEditable|IsSelectable"/>
|
<PercentageType RenderStyle="ProgressBarStyle" EditorType="ProgressBarType" ItemFlags="IsEnabled|IsEditable|IsSelectable"/>
|
||||||
<ChoiceType RenderStyle="ComboBoxStyle" EditorType="ComboBoxType" ItemFlags="IsEnabled|IsEditable|IsSelectable" FixedChoices="1|2|3"/>
|
<ChoiceType RenderStyle="ComboBoxStyle" EditorType="ComboBoxType" ItemFlags="IsEnabled|IsEditable|IsSelectable" FixedChoices="1|2|3|4"/>
|
||||||
<IntValueType RenderStyle="SpinBoxStyle" EditorType="SpinBoxType" ItemFlags="IsEnabled|IsEditable|IsSelectable"/>
|
<IntValueType RenderStyle="SpinBoxStyle" EditorType="SpinBoxType" ItemFlags="IsEnabled|IsEditable|IsSelectable"/>
|
||||||
</ItemTypes>
|
</ItemTypes>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user