fixed toggle section

This commit is contained in:
2025-09-08 22:58:52 +02:00
parent 95b7b026ff
commit 809ef10c0d
5 changed files with 10 additions and 20 deletions

View File

@@ -267,7 +267,7 @@ void XQMainWindow::onTreeViewItemClicked( 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
XQItem* xqItem = static_cast<XQItem*>(item.parent());
onTreeViewItemClicked( *xqItem );
@@ -312,23 +312,14 @@ void XQMainWindow::onSectionCreated( const XQModelSection& section )
void XQMainWindow::onSectionToggled( const XQModelSection& section )
{
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)
{
QStandardItem* child = _currentProjectItem->child(row);
qDebug() << " --- XXX section toggled 3: " << child->text();
if (child->text() == section.contentType() )
{
// rekursion vermeiden
_currentProjectItem->model()->blockSignals( true );
bool checked = (child->checkState() == Qt::Checked);
qDebug() << " --- XXX section toggled 4: " << child->text() << " ->" << checked;
child->setCheckState( checked ? Qt::Unchecked :Qt::Checked );
_currentProjectItem->model()->blockSignals( false );
_mainTreeView->repaint();
break;
}
}

View File

@@ -92,18 +92,16 @@ void XQItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option
case XQItem::ComboBoxStyle :
return drawComboBoxStyle( painter, option, index );
/*
case XQItem::SpinBoxStyle :
return drawSpinBoxStyle( painter, option, index );
case XQItem::ProgressBarStyle :
return drawProgressBarStyle( painter, option, index );
*/
case XQItem::HiddenStyle :
return;
default:
break;
} // switch

View File

@@ -113,6 +113,7 @@ XQItemType* XQItemType::replaceAttribute( const QVariant& newValue, int role )
// Gibt es den geänderten ItemType schon?
QString newKey = myClone->makeItemTypeKey();
// jawoll
if( s_ItemTypeMap.contains( newKey ) )
{
// abräumen ...

View File

@@ -154,7 +154,7 @@ void XQViewModel::initModel(const QString& modelName)
//! die section kann erst gültig sein, wenn die items im model gelandet sind,
//! 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.
void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode )
@@ -182,7 +182,7 @@ void XQViewModel::addSection(const XQItemList& list, const XQNodePtr& sheetNode
//! SLOT, toggled die section mit dem 'sectionKey' (hier: contentType)
void XQViewModel::onToggleSection(const QString& sectionKey )
{
{
toggleSection( _sections.sectionByKey(sectionKey) );
}
@@ -194,8 +194,7 @@ void XQViewModel::toggleSection( const XQModelSection& section )
if( section.isValid() && _treeTable )
{
XQSectionRange pos = _sections.sectionRange(section);
_treeTable->toggleRowsHidden(pos.firstRow, pos.lastRow );
emit sectionToggled(section);
_treeTable->toggleRowsHidden(pos.firstRow, pos.lastRow );
}
}
@@ -522,7 +521,8 @@ void XQViewModel::cmdToggleSection( const XQCommand& command )
const QModelIndex& index = command.originIndex();
Q_ASSERT(index.isValid());
const XQModelSection& section = _sections.sectionByRow(index.row());
toggleSection( section );
//toggleSection( section );
emit sectionToggled(section);
}

View File

@@ -19,7 +19,7 @@
<ValueType RenderStyle="FormattedStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" UnitType="Coulomb"/>
<CheckableType RenderStyle="FormattedStyle" EditorType="LineEditType" ItemFlags="IsEnabled|IsEditable|IsSelectable" UnitType="###"/>
<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"/>
</ItemTypes>