Restructure "src/" folder

Moving files from the "src/" folder into "src/legacy", "src/macro-core",
and "src/utils" was necessary as it was becoming a bit too cluttered.
This commit is contained in:
WarmUpTill
2022-08-14 04:10:30 +02:00
committed by WarmUpTill
parent 5ae9e18044
commit 53a5fa6ff4
224 changed files with 589 additions and 895 deletions

View File

@@ -0,0 +1,31 @@
#include "resizing-text-edit.hpp"
ResizingPlainTextEdit::ResizingPlainTextEdit(QWidget *parent,
const int scrollAt,
const int minLines,
const int paddingLines)
: QPlainTextEdit(parent),
_scrollAt(scrollAt),
_minLines(minLines),
_paddingLines(paddingLines)
{
QWidget::connect(this, SIGNAL(textChanged()), this,
SLOT(ResizeTexteditArea()));
}
void ResizingPlainTextEdit::ResizeTexteditArea()
{
QFontMetrics f(font());
int rowHeight = f.lineSpacing();
int numLines = document()->blockCount();
if (numLines + _paddingLines < _minLines) {
setFixedHeight(_minLines * rowHeight);
} else if (numLines + _paddingLines < _scrollAt) {
setFixedHeight((numLines + _paddingLines) * rowHeight);
} else {
setFixedHeight(_scrollAt * rowHeight);
}
adjustSize();
updateGeometry();
}