forked from nuttyartist/notes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcustomdocument.cpp
More file actions
30 lines (26 loc) · 775 Bytes
/
Copy pathcustomdocument.cpp
File metadata and controls
30 lines (26 loc) · 775 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "customDocument.h"
#include <QDebug>
CustomDocument::CustomDocument(QWidget *parent)
: QTextEdit(parent)
{
}
/*!
* \brief CustomDocument::setDocumentPadding
* We use a custom document for MainWindow::m_textEdit
* so we can set the document padding without the (upstream Qt) issue
* where the vertical scrollbar gets padded with the text as well.
* This way, only the text gets padded, and the vertical scroll bar stays where it is.
* \param left
* \param top
* \param right
* \param bottom
*/
void CustomDocument::setDocumentPadding(int left, int top, int right, int bottom)
{
this->setViewportMargins(left, top, right, bottom);
}
void CustomDocument::resizeEvent(QResizeEvent *event)
{
QTextEdit::resizeEvent(event);
emit resized();
}