From a6fdc45b9d231d1ad7a6cc0f2b53bebae0377249 Mon Sep 17 00:00:00 2001 From: Ake Hedman Date: Mon, 11 Dec 2023 14:16:04 +0100 Subject: [PATCH] Bit definition edit fixed --- src/cdlgmdfregisterbit.cpp | 9 +- src/cdlgmdfregisterbit.h | 4 +- src/cdlgmdfregisterbitlist.cpp | 282 +++++++++++++-------------------- src/cdlgmdfregisterbitlist.h | 48 +++--- src/cdlgmdfregisterbitlist.ui | 2 +- src/cfrmmdf.cpp | 92 ++++++----- src/cfrmmdf.h | 3 +- 7 files changed, 195 insertions(+), 245 deletions(-) diff --git a/src/cdlgmdfregisterbit.cpp b/src/cdlgmdfregisterbit.cpp index 5d84a16e..7695bd0a 100644 --- a/src/cdlgmdfregisterbit.cpp +++ b/src/cdlgmdfregisterbit.cpp @@ -84,17 +84,10 @@ CDlgMdfRegisterBit::~CDlgMdfRegisterBit() // void -CDlgMdfRegisterBit::initDialogData(CMDF* pmdf, CMDF_Bit* pbit, int index) +CDlgMdfRegisterBit::initDialogData(CMDF_Bit* pbit, int index) { QString str; - if (nullptr == pmdf) { - spdlog::error("MDF register bit information - Invalid MDF object (initDialogData)"); - return; - } - - m_pmdf = pmdf; - if (nullptr == pbit) { spdlog::error("MDF register bit information - Invalid MDF register bit object (initDialogData)"); return; diff --git a/src/cdlgmdfregisterbit.h b/src/cdlgmdfregisterbit.h index cd98bc73..5d11de43 100644 --- a/src/cdlgmdfregisterbit.h +++ b/src/cdlgmdfregisterbit.h @@ -64,11 +64,11 @@ class CDlgMdfRegisterBit : public QDialog { /*! Init dialog data @param CMDF *pmdf Pointer to MDF - @param pmdfobject Pointer to MDF object + @param pbit Pointer to MDF bit object @param index Selected file item */ - void initDialogData(CMDF* pmdf, CMDF_Bit* pbit, int index = 0); + void initDialogData(CMDF_Bit* pbit, int index = 0); // ---------------------------------------------------------------------------- // Getters & Setters diff --git a/src/cdlgmdfregisterbitlist.cpp b/src/cdlgmdfregisterbitlist.cpp index bfc7f264..01fa5572 100644 --- a/src/cdlgmdfregisterbitlist.cpp +++ b/src/cdlgmdfregisterbitlist.cpp @@ -57,8 +57,7 @@ CDlgMdfRegisterBitList::CDlgMdfRegisterBitList(QWidget* parent) : QDialog(parent) , ui(new Ui::CDlgMdfRegisterBitList) { - m_pmdf = nullptr; - m_page = 0; + m_preg = nullptr; ui->setupUi(this); @@ -70,9 +69,7 @@ CDlgMdfRegisterBitList::CDlgMdfRegisterBitList(QWidget* parent) connect(ui->btnDelRegisterBit, &QToolButton::clicked, this, &CDlgMdfRegisterBitList::deleteRegisterBit); connect(ui->listRegisterBit, &QListWidget::doubleClicked, this, &CDlgMdfRegisterBitList::editRegisterBit); - - setInitialFocus(); this->setFixedSize(this->size()); } @@ -90,88 +87,52 @@ CDlgMdfRegisterBitList::~CDlgMdfRegisterBitList() // void -CDlgMdfRegisterBitList::initDialogData(CMDF* pmdf, uint16_t page) +CDlgMdfRegisterBitList::initDialogData(CMDF_Register* preg) { QString str; - if (nullptr == pmdf) { - QMessageBox::critical(this, tr("MDF contact information"), tr("Invalid MDF manufacturing object")); - spdlog::error("MDF contact information - Invalid MDF manufacturing object"); + if (nullptr == preg) { + QMessageBox::critical(this, tr("MDF register bit information"), tr("Invalid MDF register object")); + spdlog::error("MDF register information - Invalid MDF register object"); return; } - // Save MDF and page - m_pmdf = pmdf; - m_page = page; + // Save register pointer and page + m_preg = preg; // m_pmdf->getRegisterMap(m_page, pages); - - + renderBitItems(); } - - /////////////////////////////////////////////////////////////////////////////// -// renderRegisterItems +// renderBitItems // void -CDlgMdfRegisterBitList::renderRegisterItems(void) +CDlgMdfRegisterBitList::renderBitItems(void) { std::map pages; - if (nullptr == m_pmdf) { + if (nullptr == m_preg) { return; } ui->listRegisterBit->clear(); + std::deque* pbits = m_preg->getListBits(); - // Make sorted set of registers on this page - std::deque* regset = m_pmdf->getRegisterObjList(); - for (auto it = regset->cbegin(); it != regset->cend(); ++it) { - if (m_page == (*it)->getPage()) { - m_registersSet.insert((*it)->getOffset()); - } - } - - m_pmdf->getRegisterMap(m_page, pages); - - std::deque* regs = m_pmdf->getRegisterObjList(); - - for (auto it = m_registersSet.cbegin(); it != m_registersSet.cend(); ++it) { - // m_registersSet.insert((*it)->getOffset()); - CMDF_Register* preg = m_pmdf->getRegister(*it, m_page); - if (nullptr != preg) { - QString str = QString("Register %1 -- %2").arg(preg->getOffset()).arg(preg->getName().c_str()); + int idx = 0; + for (auto it = pbits->cbegin(); it != pbits->cend(); ++it) { + CMDF_Bit* pbit = *it; + if (nullptr != pbit) { + QString str = QString("Bit %1(%2)-- %3").arg(pbit->getPos()).arg(pbit->getWidth()).arg(pbit->getName().c_str()); ui->listRegisterBit->addItem(str); // Set data to register index - ui->listRegisterBit->item(ui->listRegisterBit->count() - 1)->setData(Qt::UserRole, preg->getOffset()); + ui->listRegisterBit->item(ui->listRegisterBit->count() - 1)->setData(Qt::UserRole, idx); } + idx++; } - - // for (auto it = regs->cbegin(); it != regs->cend(); ++it) { - // m_registersSet.insert((*it)->getOffset()); - // if ((*it)->getPage() == m_page) { - // QString str = QString("Register %1 -- %2").arg((*it)->getOffset()).arg((*it)->getName().c_str()); - // ui->listRegisterBit->addItem(str); - // // Set data to register index - // ui->listRegisterBit->item(ui->listRegisterBit->count() - 1)->setData(Qt::UserRole, (*it)->getOffset()); - // } - // } -} - -/////////////////////////////////////////////////////////////////////////////// -// setInitialFocus -// - -void -CDlgMdfRegisterBitList::setInitialFocus(void) -{ - //ui->editName->setFocus(); } - - /////////////////////////////////////////////////////////////////////////////// // addRegisterBit // @@ -180,42 +141,35 @@ void CDlgMdfRegisterBitList::addRegisterBit(void) { bool ok; - CMDF_Register* pregnew = new CMDF_Register(); - pregnew->setPage(m_page); + CMDF_Bit* pbitnew = new CMDF_Bit(); + if (nullptr == pbitnew) { + QMessageBox::critical(this, tr("MDF register bit information"), tr("Memory problem")); + spdlog::error("MDF register information - Memory problem"); + return; + } // Save the selected row int idx = ui->listRegisterBit->currentRow(); - CDlgMdfRegister dlg(this); - dlg.initDialogData(m_pmdf, pregnew); -addregdlg: + CDlgMdfRegisterBit dlg(this); + dlg.initDialogData(pbitnew); + dlg.setWindowTitle(tr("Add register bit definition")); + +addbitdlg: + if (QDialog::Accepted == dlg.exec()) { - // Check if register is already defined - CMDF_Register* preg = m_pmdf->getRegister(pregnew->getOffset(), pregnew->getPage()); - if (nullptr != preg) { - QMessageBox::warning(this, tr("MDF add new register"), tr("Register page=%1 offset=%2 is already define. Must be unique.").arg(pregnew->getPage()).arg(pregnew->getOffset())); - goto addregdlg; - } - qDebug() << "Page=" << pregnew->getPage() << " Offset=" << pregnew->getOffset(); - m_pmdf->getRegisterObjList()->push_back(pregnew); - if (m_page == pregnew->getPage()) { - m_registersSet.insert(pregnew->getOffset()); - } - ui->listRegisterBit->clear(); - renderRegisterItems(); - if (-1 != idx) { - ui->listRegisterBit->setCurrentRow(idx); - } - // Warn if page is not the same as for dialog - if (pregnew->getPage() != m_page) { - QMessageBox::information(this, - tr("MDF duplicate register"), - tr("Register page=%1 offset=%2 is not on same page [%3] as registers and will be added but not shown.").arg(pregnew->getPage()).arg(pregnew->getOffset()).arg(m_page)); + uint8_t mask; + if ((mask = checkIfBitsOverlap(pbitnew))) { + QMessageBox::warning(this, tr("Add new bit definition"), tr("Can not add bit definition. Bits overlap with already defined bits 0b%1").arg(mask, 8, 2, QChar('0'))); + goto addbitdlg; } + std::deque* pbits = m_preg->getListBits(); + pbits->push_back(pbitnew); + renderBitItems(); } else { - delete pregnew; + delete pbitnew; } } @@ -234,15 +188,21 @@ CDlgMdfRegisterBitList::editRegisterBit(void) int idx = ui->listRegisterBit->currentRow(); QListWidgetItem* pitem = ui->listRegisterBit->currentItem(); - CMDF_Register* preg = m_pmdf->getRegister(pitem->data(Qt::UserRole).toUInt(), m_page); + CMDF_Bit* pbit = m_preg->getListBits()->at(pitem->data(Qt::UserRole).toUInt()); + + CDlgMdfRegisterBit dlg(this); + dlg.initDialogData(pbit); + + editbitdlg: - CDlgMdfRegister dlg(this); - dlg.initDialogData(m_pmdf, preg); - // Don't allow editing of page and offset - dlg.setReadOnly(); if (QDialog::Accepted == dlg.exec()) { + uint8_t mask; + if ((mask = checkIfBitsOverlap(pbit, true))) { + QMessageBox::warning(this, tr("Edit bit definition"), tr("Can not add bit definition. Bits overlap with already defined bits 0b%1").arg(mask, 8, 2, QChar('0'))); + goto editbitdlg; + } ui->listRegisterBit->clear(); - renderRegisterItems(); + renderBitItems(); ui->listRegisterBit->setCurrentRow(idx); } } @@ -263,83 +223,49 @@ CDlgMdfRegisterBitList::dupRegisterBit(void) // Save the selected row int idx = ui->listRegisterBit->currentRow(); - QListWidgetItem* pitem = ui->listRegisterBit->currentItem(); - CMDF_Register* preg = m_pmdf->getRegister(pitem->data(Qt::UserRole).toUInt(), m_page); - - CMDF_Register* pregnew = new CMDF_Register(); - pregnew->setPage(m_page); - - // Make copy - *pregnew = *preg; - - CDlgMdfRegister dlg(this); - dlg.initDialogData(m_pmdf, pregnew); - dupregdlg: - if (QDialog::Accepted == dlg.exec()) { - // Check if register is already defined - CMDF_Register* pregold = m_pmdf->getRegister(pregnew->getOffset(), pregnew->getPage()); - if (nullptr != pregold) { - QMessageBox::warning(this, tr("MDF duplicate register"), tr("Register page=%1 offset=%2 is already define. Must be unique.").arg(pregnew->getPage()).arg(pregnew->getOffset())); - goto dupregdlg; - } - qDebug() << "Page=" << pregnew->getPage() << " Offset=" << pregnew->getOffset(); - m_pmdf->getRegisterObjList()->push_back(pregnew); - if (m_page == pregnew->getPage()) { - m_registersSet.insert(pregnew->getOffset()); - } - ui->listRegisterBit->clear(); - renderRegisterItems(); - if (-1 != idx) { - ui->listRegisterBit->setCurrentRow(idx); - } - // Warn if page is not the same as for dialog - if (pregnew->getPage() != m_page) { - QMessageBox::information(this, - tr("MDF duplicate register"), - tr("Register page=%1 offset=%2 is not on same page [%3] as registers and will be added but not shown.").arg(pregnew->getPage()).arg(pregnew->getOffset()).arg(m_page)); - } - } - else { - delete pregnew; - } + // QListWidgetItem* pitem = ui->listRegisterBit->currentItem(); + // CMDF_Bit* preg = m_pmdf->getRegister(pitem->data(Qt::UserRole).toUInt(), m_page); + + // CMDF_Bit* pregnew = new CMDF_Bit(); + // pregnew->setPage(m_page); + + // // Make copy + // *pregnew = *preg; + + // CDlgMdfRegisterBit dlg(this); + // dlg.initDialogData(m_pmdf, pregnew); + // dupregdlg: + // if (QDialog::Accepted == dlg.exec()) { + // // Check if register is already defined + // CMDF_Bit* pregold = m_pmdf->getRegister(pregnew->getOffset(), pregnew->getPage()); + // if (nullptr != pregold) { + // QMessageBox::warning(this, tr("MDF duplicate register"), tr("Register page=%1 offset=%2 is already define. Must be unique.").arg(pregnew->getPage()).arg(pregnew->getOffset())); + // goto dupregdlg; + // } + // qDebug() << "Page=" << pregnew->getPage() << " Offset=" << pregnew->getOffset(); + // m_pmdf->getRegisterObjList()->push_back(pregnew); + // if (m_page == pregnew->getPage()) { + // m_registersSet.insert(pregnew->getOffset()); + // } + // ui->listRegisterBit->clear(); + // renderRegisterItems(); + // if (-1 != idx) { + // ui->listRegisterBit->setCurrentRow(idx); + // } + // // Warn if page is not the same as for dialog + // if (pregnew->getPage() != m_page) { + // QMessageBox::information(this, + // tr("MDF duplicate register"), + // tr("Register page=%1 offset=%2 is not on same page [%3] as registers and will be added but not shown.").arg(pregnew->getPage()).arg(pregnew->getOffset()).arg(m_page)); + // } + // } + // else { + // delete pregnew; + // } } else { QMessageBox::warning(this, tr(APPNAME), tr("An item must be selected"), QMessageBox::Ok); } - - // if (-1 != ui->listContact->currentRow()) { - - // // Save the selected row - // int idx = ui->listContact->currentRow(); - - // QListWidgetItem* pitem = ui->listContact->currentItem(); - // QString selstr = pitem->text().split('_').first().left(2); - - // std::string str = QInputDialog::getText(this, - // tr("Edit contact item"), - // tr("Contact value:"), - // QLineEdit::Normal, - // pitem->text(), - // &ok) - // .toStdString(); - - // if (ok && str.length()) { - - // CMDF_Item* pitem = new CMDF_Item(); - // if (nullptr != pitem) { - // pitem->setValue(str); - // m_pContactList->push_back(pitem); - // ui->listContact->clear(); - // fillContactItems(); - // } - // else { - // QMessageBox::warning(this, tr(APPNAME), tr("Memory problem could not add item"), QMessageBox::Ok); - // } - // } - // } - // else { - // QMessageBox::warning(this, tr("vscpworks+"), tr("An item must be selected"), QMessageBox::Ok); - // } } /////////////////////////////////////////////////////////////////////////////// @@ -355,12 +281,24 @@ CDlgMdfRegisterBitList::deleteRegisterBit(void) int idx = ui->listRegisterBit->currentRow(); QListWidgetItem* pitem = ui->listRegisterBit->currentItem(); - CMDF_Register* preg = m_pmdf->getRegister(pitem->data(Qt::UserRole).toUInt(), m_page); - m_pmdf->deleteRegister(preg); - delete preg; - ui->listRegisterBit->removeItemWidget(pitem); - renderRegisterItems(); - ui->listRegisterBit->setCurrentRow(idx); + CMDF_Bit* pbit = m_preg->getListBits()->at(pitem->data(Qt::UserRole).toUInt()); + + std::deque::iterator it = m_preg->getListBits()->begin() + pitem->data(Qt::UserRole).toUInt(); + m_preg->getListBits()->erase(it); + + ui->listRegisterBit->clear(); + renderBitItems(); + int sel = idx; + if (0 == idx) { + sel = 0; + } + else if (m_preg->getListBits()->size() == idx) { + sel = m_preg->getListBits()->size() - 1; + } + else { + sel = idx + 1; + } + ui->listRegisterBit->setCurrentRow(sel); } } @@ -372,10 +310,10 @@ void CDlgMdfRegisterBitList::accept() { std::string str; - if (nullptr != m_pmdf) { + if (nullptr != m_preg) { // str = ui->editName->text().toStdString(); - // m_pmdf->setName(str); + // m_pmdf->setName(str); // str = ui->editModel->text().toStdString(); // m_pmdf->setModuleModel(str); diff --git a/src/cdlgmdfregisterbitlist.h b/src/cdlgmdfregisterbitlist.h index 5c55defb..902f3bb6 100644 --- a/src/cdlgmdfregisterbitlist.h +++ b/src/cdlgmdfregisterbitlist.h @@ -29,16 +29,13 @@ #ifndef CDLGMDFREGISTERBITLIST_H #define CDLGMDFREGISTERBITLIST_H -#include #include +#include #include "cdlgmdfregister.h" #include - - - namespace Ui { class CDlgMdfRegisterBitList; } @@ -50,11 +47,6 @@ class CDlgMdfRegisterBitList : public QDialog { explicit CDlgMdfRegisterBitList(QWidget* parent = nullptr); ~CDlgMdfRegisterBitList(); - /*! - Set inital focus to description - */ - void setInitialFocus(void); - /*! Set edit mode. GUID will be READ ONLY @@ -65,18 +57,36 @@ class CDlgMdfRegisterBitList : public QDialog { Init dialog data @param pmdf Pointer to MDF object */ - void initDialogData(CMDF *pmdf, uint16_t page=0); + void initDialogData(CMDF_Register* preg); /*! - Fill page combo box with page information + Fill in register bit items */ - void renderComboPage(void); + void renderBitItems(void); /*! - Fill in contact items + Check if bits overlap + @param pbit2test pointer to bit to test + @param bEdit Edit mode. The bit is already in the list. + @return Overlapping bits or zero iof no bits overlap */ - void renderRegisterItems(void); - + uint8_t checkIfBitsOverlap(CMDF_Bit* pbit2test, bool bEdit = false) + { + uint8_t result = 0; + std::deque* pbits = m_preg->getListBits(); + for (auto it = pbits->cbegin(); it != pbits->cend(); ++it) { + CMDF_Bit* pbit = *it; + // Don't test the edited bit of in edit mode + if (bEdit && (pbit2test == pbit)) { + continue; + } + if (nullptr != pbit) { + result |= pbit->getMask(); + } + } + + return (result & pbit2test->getMask()); + }; // ---------------------------------------------------------------------------- // Getters & Setters @@ -101,13 +111,7 @@ public slots: Ui::CDlgMdfRegisterBitList* ui; // MDF - CMDF *m_pmdf; - - // Register page - uint16_t m_page; - - // Used to get a sorted list of registers - std::set m_registersSet ; + CMDF_Register* m_preg; }; #endif // CDLGMDFREGISTERBITLIST_H diff --git a/src/cdlgmdfregisterbitlist.ui b/src/cdlgmdfregisterbitlist.ui index 93c403d5..cd294b2d 100644 --- a/src/cdlgmdfregisterbitlist.ui +++ b/src/cdlgmdfregisterbitlist.ui @@ -11,7 +11,7 @@ - Dialog + Register bit definitions diff --git a/src/cfrmmdf.cpp b/src/cfrmmdf.cpp index 6619870f..5a13be3d 100644 --- a/src/cfrmmdf.cpp +++ b/src/cfrmmdf.cpp @@ -739,7 +739,7 @@ CFrmMdf::renderInfoUrlItems(QTreeWidgetItem* pParent, // void -CFrmMdf::renderBits(QTreeWidgetItem* pParent, std::deque& dequebits) +CFrmMdf::renderBits(QTreeWidgetItem* pParent, std::deque& dequebits, bool bParentKnown) { QString str; QMdfTreeWidgetItem* pItem; @@ -749,9 +749,15 @@ CFrmMdf::renderBits(QTreeWidgetItem* pParent, std::deque& dequebits) return; } - QMdfTreeWidgetItem* pItemBitDefs = new QMdfTreeWidgetItem(pParent, mdf_type_bit); - pItemBitDefs->setText(0, "Bit definitions"); - pParent->addChild(pItemBitDefs); + QMdfTreeWidgetItem* pItemBitDefs; + if (bParentKnown) { + pItemBitDefs = (QMdfTreeWidgetItem*)pParent; + } + else { + pItemBitDefs = new QMdfTreeWidgetItem(pParent, ((QMdfTreeWidgetItem*)pParent)->getObject(), mdf_type_bit); + pItemBitDefs->setText(0, "Bit definitions"); + pParent->addChild(pItemBitDefs); + } // Must be items to fill in childs if (!dequebits.size()) { @@ -5437,42 +5443,50 @@ CFrmMdf::editRegisterBit(void) switch (pItem->getObjectType()) { case mdf_type_bit: { - // CDlgMdfRegisterBitList dlg(this); - // dlg.initDialogData(&m_mdf, selectedIndex); - // if (QDialog::Accepted == dlg.exec()) { - // // Redraw all register items - We do not know changes - // QList childrenList = m_headRegister->takeChildren(); - // // Remove children - // for (qsizetype i = 0; i < childrenList.size(); ++i) { - // QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); - // delete item; - // } - // childrenList.clear(); - // renderRegisters(m_headRegister); - // } + CMDF_Register *preg = (CMDF_Register *)pItem->getObject(); + CDlgMdfRegisterBitList dlg(this); + dlg.initDialogData(preg); + if (QDialog::Accepted == dlg.exec()) { + // Redraw all rbit items - We do not know changes + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + delete item; + } + childrenList.clear(); + renderBits(pItem/*->parent()*/, *preg->getListBits(), true); + //pParent, *preg->getListBits() + } } break; case mdf_type_bit_item: { - // CMDF_Bit* pbit = (CMDF_Bit*)pItem->getObject(); - // if (nullptr == pbit) { - // int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid firmware object")); - // spdlog::error("MDF register edit - object has nullptr"); - // return; - // } - // CDlgMdfRegisterBitList dlg(this); - // dlg.initDialogData(&m_mdf, pbit, selectedIndex); - // if (QDialog::Accepted == dlg.exec()) { - // pItem->setExpanded(true); - // QList childrenList = pItem->takeChildren(); - // // Remove children - // for (qsizetype i = 0; i < childrenList.size(); ++i) { - // QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); - // delete item; - // } - // childrenList.clear(); - // pItem->setText(0, QString("Bitfield %1 Bits:{").arg(pbit->getName().c_str())); - // renderRegisterInfo(pItem, preg); - // } + CMDF_Bit* pbit = (CMDF_Bit*)pItem->getObject(); + if (nullptr == pbit) { + int ret = QMessageBox::critical(this, tr("APPNAME"), tr("Internal error: Invalid firmware object")); + spdlog::error("MDF register edit - object has nullptr"); + return; + } + CDlgMdfRegisterBit dlg(this); + dlg.initDialogData(pbit, 0); + if (QDialog::Accepted == dlg.exec()) { + pItemHead->setExpanded(true); + QList childrenList = pItem->takeChildren(); + // Remove children + for (qsizetype i = 0; i < childrenList.size(); ++i) { + QMdfTreeWidgetItem* item = (QMdfTreeWidgetItem*)childrenList.at(i); + // qDebug() << item->text(0); + delete item; + } + childrenList.clear(); + QString str = QString("Bitfield %1 Bits:{").arg(pbit->getName().c_str()); + for (int j = pbit->getPos(); j < qMin(8, pbit->getPos() + pbit->getWidth()); j++) { + str += QString(" %1 ").arg(j); + } + str += "}"; + pItem->setText(0, str); + renderBitInfo(pItem, pbit); + } } break; case mdf_type_bit_sub_item: { @@ -5483,7 +5497,7 @@ CFrmMdf::editRegisterBit(void) return; } CDlgMdfRegisterBit dlg(this); - dlg.initDialogData(&m_mdf, pbit, selectedIndex); + dlg.initDialogData(pbit, selectedIndex); if (QDialog::Accepted == dlg.exec()) { pItemHead->setExpanded(true); QList childrenList = pItemHead->takeChildren(); @@ -5494,7 +5508,7 @@ CFrmMdf::editRegisterBit(void) delete item; } childrenList.clear(); - QString str = str = QString("Bitfield %1 Bits:{").arg(pbit->getName().c_str()); + QString str = QString("Bitfield %1 Bits:{").arg(pbit->getName().c_str()); for (int j = pbit->getPos(); j < qMin(8, pbit->getPos() + pbit->getWidth()); j++) { str += QString(" %1 ").arg(j); } diff --git a/src/cfrmmdf.h b/src/cfrmmdf.h index 3787e190..38520cac 100644 --- a/src/cfrmmdf.h +++ b/src/cfrmmdf.h @@ -283,9 +283,10 @@ public slots: Fill bit list info @param parent Pointer to parent treewidget @param dequebits Reference for std:deque holding bit infor objects + @param bParentKnown If pParent is the head of the bit definitions this should be set to true */ void - renderBits(QTreeWidgetItem* pParent, std::deque& dequebits); + renderBits(QTreeWidgetItem* pParent, std::deque& dequebits, bool bParentKnown = false); /*! Render info for one bit