Merge pull request #72 from OpenMW/master

Add OpenMW commits up to 30 Sep
pull/76/head
David Cernat 8 years ago committed by GitHub
commit add1a5e5b2

@ -578,35 +578,31 @@ void CSVWorld::EditWidget::remake(int row)
fixedRows = true; fixedRows = true;
} }
NestedTable* table = // Create and display nested table only if it's editable.
new NestedTable(mDocument, id, mNestedModels.back(), this, editable, fixedRows); if (editable)
table->resizeColumnsToContents();
if (!editable)
{ {
table->setEditTriggers(QAbstractItemView::NoEditTriggers); NestedTable* table =
table->setEnabled(false); new NestedTable(mDocument, id, mNestedModels.back(), this, editable, fixedRows);
} table->resizeColumnsToContents();
int rows = mTable->rowCount(mTable->index(row, i)); int rows = mTable->rowCount(mTable->index(row, i));
int rowHeight = (rows == 0) ? table->horizontalHeader()->height() : table->rowHeight(0); int rowHeight = (rows == 0) ? table->horizontalHeader()->height() : table->rowHeight(0);
int tableMaxHeight = (5 * rowHeight) int headerHeight = table->horizontalHeader()->height();
+ table->horizontalHeader()->height() + 2 * table->frameWidth(); int tableMaxHeight = (5 * rowHeight) + headerHeight + (2 * table->frameWidth());
table->setMinimumHeight(tableMaxHeight); table->setMinimumHeight(tableMaxHeight);
QLabel* label = QString headerText = mTable->headerData (i, Qt::Horizontal, Qt::DisplayRole).toString();
new QLabel (mTable->headerData (i, Qt::Horizontal, Qt::DisplayRole).toString(), mMainWidget); QLabel* label = new QLabel (headerText, mMainWidget);
label->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
label->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
if(!editable)
label->setEnabled(false);
tablesLayout->addWidget(label); tablesLayout->addWidget(label);
tablesLayout->addWidget(table); tablesLayout->addWidget(table);
connect(table, connect(table,
SIGNAL(editRequest(const CSMWorld::UniversalId &, const std::string &)), SIGNAL(editRequest(const CSMWorld::UniversalId &, const std::string &)),
this, this,
SIGNAL(editIdRequest(const CSMWorld::UniversalId &, const std::string &))); SIGNAL(editIdRequest(const CSMWorld::UniversalId &, const std::string &)));
}
} }
else if (!(flags & CSMWorld::ColumnBase::Flag_Dialogue_List)) else if (!(flags & CSMWorld::ColumnBase::Flag_Dialogue_List))
{ {

Loading…
Cancel
Save