Initial commit

This commit is contained in:
torsten committed 2026-08-13 18:33:10 +02:00
commit b7d90b9afe
16245 files changed
+3396666

No files matched your search

+92
View File
@@ -0,0 +1,92 @@
#include <QLayout>
#include "content.h"
#include "fullline.h"
#include "ui_content.h"
Content::Content(QWidget *parent) : QWidget(parent)
, m_ui(new Ui::Content)
{
m_ui->setupUi(this);
}
Content::~Content()
{
delete m_ui;
}
void Content::init()
{
delete layout();
m_layout = new QVBoxLayout(this);
m_layout->setSpacing(0);
while (!m_lines.isEmpty())
deleteLastLine();
while (m_lines.size() < m_lineCount)
newLine();
}
void Content::setLineCount(int lineCount)
{
while(lineCount != m_lines.size())
{
if(lineCount > m_lineCount)
newLine();
else if (lineCount < m_lineCount)
deleteLastLine();
}
m_lineCount = m_lines.size();
}
void Content::setCharCount(int charCount)
{
m_charCount = charCount;
for (FullLine * l : qAsConst(m_lines))
l->setCharCount(m_charCount);
}
int Content::charCount() const
{
return m_charCount;
}
void Content::setHeight(int height)
{
m_height = height;
for (FullLine * l : qAsConst(m_lines))
l->setHeight(height);
}
int Content::height() const
{
return m_height;
}
void Content::setCharCountAndHeight(int charCount, int height)
{
m_charCount = charCount;
m_height = height;
init();
}
void Content::newLine()
{
FullLine *line = new FullLine(m_lines.count()+1, m_height, m_charCount, this);
m_layout->addWidget(line);
m_lines.append(line);
}
void Content::deleteLastLine()
{
if (m_lines.isEmpty())
return;
delete m_lines.last();
m_lines.remove(m_lines.size()-1);
}