Qt: Row colors and resize

Set the row colors in the traffic dialogs to alternating for better
readibility and add a context menu option to resize the columns back
to content

Fixes #16189
This commit is contained in:
Roland Knall 2022-05-19 15:58:20 +02:00 committed by Roland Knall
parent 6913bff6cd
commit 5a53e72c63
3 changed files with 16 additions and 0 deletions

View File

@ -728,6 +728,13 @@ ConversationTreeWidget::ConversationTreeWidget(QWidget *parent, register_ct_t* t
connect(fa, SIGNAL(triggered()), this, SLOT(filterActionTriggered()));
}
ctx_menu_.addSeparator();
QAction * act = ctx_menu_.addAction(tr("Resize all columns to content"));
connect(act, &QAction::triggered, [this]() {
for (int col = 0; col < this->columnCount(); col++)
this->resizeColumnToContents(col);
});
updateItems();
}

View File

@ -708,6 +708,13 @@ EndpointTreeWidget::EndpointTreeWidget(QWidget *parent, register_ct_t *table) :
connect(fa, SIGNAL(triggered()), this, SLOT(filterActionTriggered()));
}
ctx_menu_.addSeparator();
QAction * act = ctx_menu_.addAction(tr("Resize all columns to content"));
connect(act, &QAction::triggered, [this]() {
for (int col = 0; col < this->columnCount(); col++)
this->resizeColumnToContents(col);
});
updateItems();
}

View File

@ -338,6 +338,7 @@ TrafficTableTreeWidget::TrafficTableTreeWidget(QWidget *parent, register_ct_t *t
resolve_names_(false)
{
setRootIsDecorated(false);
setAlternatingRowColors(true);
sortByColumn(0, Qt::AscendingOrder);
connect(mainApp, SIGNAL(addressResolutionChanged()), this, SLOT(updateItemsForSettingChange()));
@ -364,6 +365,7 @@ QList<QVariant> TrafficTableTreeWidget::rowData(int row) const
}
}
}
return row_data;
}