refactor: merge icon into name column
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
@ -24,8 +24,10 @@ InstanceDelegate::InstanceDelegate(QObject* parent) : QStyledItemDelegate(parent
|
||||
void InstanceDelegate::initStyleOption(QStyleOptionViewItem* option, const QModelIndex& index) const
|
||||
{
|
||||
QStyledItemDelegate::initStyleOption(option, index);
|
||||
if (index.column() == InstanceList::IconColumn) {
|
||||
if (index.column() == InstanceList::NameColumn) {
|
||||
// make decoration fill cell, subtract default margins
|
||||
option->decorationSize = option->rect.size().shrunkBy(QMargins(3, 1, 3, 1));
|
||||
QSize decorationSize = QSize(option->rect.height(), option->rect.height());
|
||||
decorationSize -= QSize(2, 2); // subtract 1px margin
|
||||
option->decorationSize = decorationSize;
|
||||
}
|
||||
}
|
@ -80,13 +80,11 @@ void InstanceView::createTable()
|
||||
header->restoreState(QByteArray::fromBase64(APPLICATION->settings()->get("InstanceViewTableHeaderState").toByteArray()));
|
||||
|
||||
header->setSectionsMovable(true);
|
||||
header->setSectionResizeMode(InstanceList::IconColumn, QHeaderView::Fixed);
|
||||
header->setSectionResizeMode(InstanceList::NameColumn, QHeaderView::Stretch);
|
||||
header->setSectionResizeMode(InstanceList::GameVersionColumn, QHeaderView::Interactive);
|
||||
header->setSectionResizeMode(InstanceList::PlayTimeColumn, QHeaderView::Interactive);
|
||||
header->setSectionResizeMode(InstanceList::LastPlayedColumn, QHeaderView::Interactive);
|
||||
m_table->setColumnWidth(InstanceList::IconColumn, m_rowHeight + 3 + 3); // padding left and right
|
||||
m_table->verticalHeader()->setDefaultSectionSize(m_rowHeight + 1 + 1); // padding top and bottom
|
||||
m_table->verticalHeader()->setDefaultSectionSize(m_rowHeight + 1 + 1); // padding top and bottom
|
||||
|
||||
if (!APPLICATION->settings()->contains("InstanceViewTableHeaderState"))
|
||||
m_table->sortByColumn(InstanceList::LastPlayedColumn, Qt::AscendingOrder);
|
||||
|
Reference in New Issue
Block a user