mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 17:45:35 +00:00
Merge branch 'autoresize' into 'master'
Autoresize table subview columns (bug #6939) Closes #6939 See merge request OpenMW/openmw!2292
This commit is contained in:
commit
2056365159
4 changed files with 16 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
|||
Bug #5057: Weapon swing sound plays at same pitch whether it hits or misses
|
||||
Bug #5129: Stuttering animation on Centurion Archer
|
||||
Bug #5977: Fatigueless NPCs' corpse underwater changes animation on game load
|
||||
Bug #6939: OpenMW-CS: ID columns are too short
|
||||
Feature #6945: Support S3TC-compressed and BGR/BGRA NiPixelData
|
||||
|
||||
0.48.0
|
||||
|
|
|
@ -96,3 +96,12 @@ CSMWorld::ColumnBase::Display CSVWorld::DragRecordTable::getIndexDisplayType(con
|
|||
}
|
||||
return CSMWorld::ColumnBase::Display_None;
|
||||
}
|
||||
|
||||
int CSVWorld::DragRecordTable::sizeHintForColumn(int column) const
|
||||
{
|
||||
// Prevent the column width from getting too long or too short
|
||||
constexpr int minWidth = 100;
|
||||
constexpr int maxWidth = 300;
|
||||
int width = QTableView::sizeHintForColumn(column);
|
||||
return std::clamp(width, minWidth, maxWidth);
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ namespace CSVWorld
|
|||
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
|
||||
int sizeHintForColumn(int column) const override;
|
||||
|
||||
private:
|
||||
CSMWorld::ColumnBase::Display getIndexDisplayType(const QModelIndex &index) const;
|
||||
|
||||
|
|
|
@ -263,6 +263,10 @@ CSVWorld::Table::Table (const CSMWorld::UniversalId& id,
|
|||
|
||||
setModel (mProxyModel);
|
||||
horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
|
||||
// The number is arbitrary but autoresize would be way too slow otherwise.
|
||||
constexpr int autoResizePrecision = 500;
|
||||
horizontalHeader()->setResizeContentsPrecision(autoResizePrecision);
|
||||
resizeColumnsToContents();
|
||||
verticalHeader()->hide();
|
||||
setSelectionBehavior (QAbstractItemView::SelectRows);
|
||||
setSelectionMode (QAbstractItemView::ExtendedSelection);
|
||||
|
|
Loading…
Reference in a new issue