1
0
Fork 0

Attempt to scale the column widths when changing fonts

This commit is contained in:
Duncan Ogilvie 2021-12-05 15:28:02 +01:00
parent 59c46f374b
commit 72e326459c
2 changed files with 11 additions and 13 deletions

View File

@ -138,7 +138,18 @@ void AbstractTableView::updateColorsSlot()
void AbstractTableView::updateFontsSlot()
{
auto oldCharWidth = getCharWidth();
updateFonts();
auto newCharWidth = getCharWidth();
// Scale the column widths to the new font
for(int col = 0; col < getColumnCount(); col++)
{
auto width = getColumnWidth(col);
auto charCount = width / oldCharWidth;
auto padding = width % oldCharWidth;
setColumnWidth(col, charCount * newCharWidth + padding);
}
}
void AbstractTableView::updateShortcutsSlot()

View File

@ -1675,19 +1675,6 @@ border-width: 1px 2px 2px 1px;</string>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>