Commit f9139b74 authored by Robert Knight's avatar Robert Knight
Browse files

Fix calculation of required display size given (lines,columns) in

TerminalDisplay widget.  Include width of vertical scrollbar (if visible)
and top/left margins.  Konsole will now start with a default width of 80 columns
on most systems if no window size has been saved in konsolerc

The initial size of Konsole is specified as 80x40 internally.  Qt constrains
the size of top-level windows on their first automatic resize to a
maximum of 2/3rds of the screen size (see QWidgetPrivate::adjustedSize()).
This means that the display might not get the 80x40 columns that it asks
for, depending on the desktop size.

CCBUG: 160422

svn path=/trunk/KDE/kdebase/apps/konsole/; revision=793964
parent a7a3ed68
......@@ -2575,7 +2575,7 @@ void TerminalDisplay::calcGeometry()
_topMargin = DEFAULT_TOP_MARGIN;
_contentHeight = contentsRect().height() - 2 * DEFAULT_TOP_MARGIN + /* mysterious */ 1;
if (!_isFixedSize)
{
// ensure that display is always at least one column wide
......@@ -2606,16 +2606,16 @@ void TerminalDisplay::makeImage()
clearImage();
}
// calculate the needed size
// calculate the needed size, this must be synced with calcGeometry()
void TerminalDisplay::setSize(int columns, int lines)
{
//FIXME - Not quite correct, a small amount of additional space
// will be used for margins, the scrollbar etc.
// we need to allow for this so that '_size' does allow
// enough room for the specified number of columns and lines to fit
int scrollBarWidth = _scrollBar->isHidden() ? 0 :
style()->pixelMetric(QStyle::PM_ScrollBarExtent);
int horizontalMargin = 2 * DEFAULT_LEFT_MARGIN;
int verticalMargin = 2 * DEFAULT_TOP_MARGIN;
QSize newSize = QSize( columns * _fontWidth ,
lines * _fontHeight );
QSize newSize = QSize( horizontalMargin + scrollBarWidth + (columns * _fontWidth) ,
verticalMargin + (lines * _fontHeight) );
if ( newSize != size() )
{
......
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