示例#1
0
void TextEdit::updateGutter(const QRect &rect, int dy)
{
    if (dy)
        gutter->scroll(0, dy);
    else
        gutter->update(0, rect.y(), gutter->width(), rect.height());

    if (rect.contains(viewport()->rect()))
        updateGutterWidth(0);
}
示例#2
0
void CodeEdit::updateGutter(const QRect &rect, const int &yDistance)
{
	if(yDistance) {
		m_gutter->scroll(0, yDistance);
	} else {
		m_gutter->update(0, rect.y(), m_gutter->width(), rect.height());
	}

	if(rect.contains(viewport()->rect()))
		updateGutterWidth();
}
示例#3
0
void MemoryView::setMemory(const QVector<int> &memory)
{
	if(m_memory == memory)
		return;

	m_memory = memory;

	resizeEvent(new QResizeEvent(QSize(), QSize()));

	updateGutterWidth();
}
示例#4
0
/* TextEdit widget */
TextEdit::TextEdit(QWidget *parent)
    : QPlainTextEdit(parent)
{
    gutter = new Gutter(this);

    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateGutterWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateGutter(QRect,int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    updateGutterWidth(0);
    highlightCurrentLine();
}
示例#5
0
CodeEdit::CodeEdit(QWidget *parent):
	QPlainTextEdit(parent),
	m_gutter(new Gutter(this)),
	m_lineStep(1),
	m_zeroPadding(0),
	m_zeroStart(false),
	m_undoAvailable(false),
	m_redoAvailable(false)
{
	connect(this, &QPlainTextEdit::blockCountChanged, this, &CodeEdit::updateGutterWidth);
	connect(this, &QPlainTextEdit::updateRequest, this, &CodeEdit::updateGutter);

	connect(this, &QPlainTextEdit::redoAvailable, this, &CodeEdit::setRedoAvailable);
	connect(this, &QPlainTextEdit::undoAvailable, this, &CodeEdit::setUndoAvailable);

	updateGutterWidth();
}