1
0
mirror of https://github.com/fwbuilder/fwbuilder synced 2026-03-24 20:27:22 +01:00

fixes #2665 "Adding text to comment causes rule to go from 2 rows to 1

row". Under certain circumstances, editing rule comment caused the GUI
to collapse corresponding row in the rule set view so that only the
first object of each rule element that contained several objects was
visible.
This commit is contained in:
Vadim Kurland 2011-11-08 13:56:40 -08:00
parent 0ba45e6569
commit ece8ca17a6
5 changed files with 37 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2011-11-08 Vadim Kurland <vadim@netcitadel.com>
* RuleSetViewDelegate.cpp (sizeHint): fixes #2665 "Adding text to
comment causes rule to go from 2 rows to 1 row"
* ACL.cpp (ciscoACL::trimLine): fixed SF bug 3435004: "Empty lines
in comment result in "Incomplete Command" in IOS".

View File

@ -2755,10 +2755,15 @@ void RuleSetView::updateColumnSizeForIndex(QModelIndex index)
resizeColumns();
}
void RuleSetView::updateSectionSizesForIndex(QModelIndex idx1, QModelIndex idx2)
{
updateAllColumnsSize();
}
void RuleSetView::setModel(QAbstractItemModel *model)
{
connect (model, SIGNAL (dataChanged(QModelIndex,QModelIndex)),
this, SLOT (updateAllColumnsSize()));
this, SLOT (updateSectionSizesForIndex(QModelIndex,QModelIndex)));
connect (model, SIGNAL (layoutChanged()),
this, SLOT (updateAllColumnsSize()));

View File

@ -197,6 +197,8 @@ public slots:
void updateAllColumnsSize();
void updateColumnSizeForIndex(QModelIndex);
void updateSectionSizesForIndex(QModelIndex, QModelIndex);
void updateObject(libfwbuilder::FWObject* object);
void compileCurrentRule();

View File

@ -466,8 +466,24 @@ QSize RuleSetViewDelegate::sizeHint(const QStyleOptionViewItem & option,
{
return node->sizes[index.column()];
}
res = calculateCellSizeForRule(newOpt, index, node) + QSize(1,1);
node->sizes[index.column()] = res;
// make sure cell height is equal to max height of all cells
// in the same row. See #2665
QSize tallest_cell = QSize(0, 0);
for (unsigned int c=0; c<=index.column(); ++c)
{
QSize cell_size = node->sizes[c];
if (cell_size.isValid())
{
int max_height = qMax(tallest_cell.height(), cell_size.height());
tallest_cell.setHeight(max_height);
node->sizes[c].setHeight(max_height);
}
}
return res;
}

View File

@ -176,6 +176,16 @@
</p>
</li>
<li>
<p>
fixes #2665 "Adding text to comment causes rule to go from 2
rows to 1 row". Under certain circumstances, editing rule
comment caused the GUI to collapse corresponding row in the rule
set view so that only the first object of each rule element that
contained several objects was visible.
</p>
</li>
</ul>