Improve track default height / header width.

Related to #629
parent 1de7eb95
......@@ -239,7 +239,7 @@
<group name="timeline">
<entry name="headerwidth" type="Int">
<label>Default width for timeline track headers.</label>
<default>140</default>
<default>0</default>
</entry>
<entry name="defaultkeyframeinterp" type="Int">
<label>Default interpolation for keyframes.</label>
......
......@@ -1759,12 +1759,14 @@ bool MainWindow::readOptions()
KdenliveSettings::setDefaultprojectfolder(dir.absolutePath());
}
if (KdenliveSettings::trackheight() == 0) {
QFontMetrics metrics(font());
int trackHeight = 2.2 * metrics.height();
QStyle *style = qApp->style();
trackHeight += style->pixelMetric(QStyle::PM_ToolBarIconSize) + 2 * style->pixelMetric(QStyle::PM_ToolBarItemMargin) +
style->pixelMetric(QStyle::PM_ToolBarItemSpacing) + 2;
KdenliveSettings::setTrackheight(trackHeight == 0 ? 50 : trackHeight);
QFont ft = QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
int trackHeight = qMax(50, (int) (3.6 * QFontInfo(ft).pixelSize() + 6));
KdenliveSettings::setTrackheight(trackHeight);
}
if (KdenliveSettings::headerwidth() == 0) {
QFont ft = QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont);
int trackWidth = qMax(50, 6 * (int)(1.8 * QFontInfo(ft).pixelSize() + 2));
KdenliveSettings::setHeaderwidth(trackWidth);
}
bool firstRun = false;
KConfigGroup initialGroup(config, "version");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment