Make margin variables non-const to allow modification
This commit is contained in:
committed by
Chih-Hsuan Yen
parent
540c00ffc3
commit
ac6581e24f
+14
-12
@@ -359,6 +359,8 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
|
||||
,_filterChain(new TerminalImageFilterChain())
|
||||
,_cursorShape(Emulation::KeyboardCursorShape::BlockCursor)
|
||||
,mMotionAfterPasting(NoMoveScreenWindow)
|
||||
,_leftBaseMargin(1)
|
||||
,_topBaseMargin(1)
|
||||
{
|
||||
// variables for draw text
|
||||
_drawTextAdditionHeight = 0;
|
||||
@@ -371,8 +373,8 @@ TerminalDisplay::TerminalDisplay(QWidget *parent)
|
||||
// The offsets are not yet calculated.
|
||||
// Do not calculate these too often to be more smoothly when resizing
|
||||
// konsole in opaque mode.
|
||||
_topMargin = DEFAULT_TOP_MARGIN;
|
||||
_leftMargin = DEFAULT_LEFT_MARGIN;
|
||||
_topMargin = _topBaseMargin;
|
||||
_leftMargin = _leftBaseMargin;
|
||||
|
||||
// create scroll bar for scrolling output up and down
|
||||
// set the scroll bar's slider to occupy the whole area of the scroll bar initially
|
||||
@@ -3002,23 +3004,23 @@ void TerminalDisplay::calcGeometry()
|
||||
switch(_scrollbarLocation)
|
||||
{
|
||||
case QTermWidget::NoScrollBar :
|
||||
_leftMargin = DEFAULT_LEFT_MARGIN;
|
||||
_contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN;
|
||||
_leftMargin = _leftBaseMargin;
|
||||
_contentWidth = contentsRect().width() - 2 * _leftBaseMargin;
|
||||
break;
|
||||
case QTermWidget::ScrollBarLeft :
|
||||
_leftMargin = DEFAULT_LEFT_MARGIN + scrollBarWidth;
|
||||
_contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN - scrollBarWidth;
|
||||
_leftMargin = _leftBaseMargin + scrollBarWidth;
|
||||
_contentWidth = contentsRect().width() - 2 * _leftBaseMargin - scrollBarWidth;
|
||||
_scrollBar->move(contentsRect().topLeft());
|
||||
break;
|
||||
case QTermWidget::ScrollBarRight:
|
||||
_leftMargin = DEFAULT_LEFT_MARGIN;
|
||||
_contentWidth = contentsRect().width() - 2 * DEFAULT_LEFT_MARGIN - scrollBarWidth;
|
||||
_leftMargin = _leftBaseMargin;
|
||||
_contentWidth = contentsRect().width() - 2 * _leftBaseMargin - scrollBarWidth;
|
||||
_scrollBar->move(contentsRect().topRight() - QPoint(_scrollBar->width()-1, 0));
|
||||
break;
|
||||
}
|
||||
|
||||
_topMargin = DEFAULT_TOP_MARGIN;
|
||||
_contentHeight = contentsRect().height() - 2 * DEFAULT_TOP_MARGIN + /* mysterious */ 1;
|
||||
_topMargin = _topBaseMargin;
|
||||
_contentHeight = contentsRect().height() - 2 * _topBaseMargin + /* mysterious */ 1;
|
||||
|
||||
if (!_isFixedSize)
|
||||
{
|
||||
@@ -3056,8 +3058,8 @@ void TerminalDisplay::setSize(int columns, int lines)
|
||||
int scrollBarWidth = (_scrollBar->isHidden()
|
||||
|| _scrollBar->style()->styleHint(QStyle::SH_ScrollBar_Transient, nullptr, _scrollBar))
|
||||
? 0 : _scrollBar->sizeHint().width();
|
||||
int horizontalMargin = 2 * DEFAULT_LEFT_MARGIN;
|
||||
int verticalMargin = 2 * DEFAULT_TOP_MARGIN;
|
||||
int horizontalMargin = 2 * _leftBaseMargin;
|
||||
int verticalMargin = 2 * _topBaseMargin;
|
||||
|
||||
QSize newSize = QSize( horizontalMargin + scrollBarWidth + (columns * _fontWidth) ,
|
||||
verticalMargin + (lines * _fontHeight) );
|
||||
|
||||
@@ -820,8 +820,9 @@ private:
|
||||
|
||||
//the delay in milliseconds between redrawing blinking text
|
||||
static const int TEXT_BLINK_DELAY = 500;
|
||||
static const int DEFAULT_LEFT_MARGIN = 1;
|
||||
static const int DEFAULT_TOP_MARGIN = 1;
|
||||
|
||||
int _leftBaseMargin;
|
||||
int _topBaseMargin;
|
||||
|
||||
public:
|
||||
static void setTransparencyEnabled(bool enable)
|
||||
|
||||
Reference in New Issue
Block a user