From aeaa90c126b7f56cbbcf6b4ffe2f53db58292a33 Mon Sep 17 00:00:00 2001 From: Mike Skec Date: Sat, 13 Feb 2021 14:27:46 +1100 Subject: Margins are now split into seperate horizontal/vertical options --- src/renderers/renderhelpers.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/renderers/renderhelpers.cpp') diff --git a/src/renderers/renderhelpers.cpp b/src/renderers/renderhelpers.cpp index 298dc9d..6c5f2ef 100644 --- a/src/renderers/renderhelpers.cpp +++ b/src/renderers/renderhelpers.cpp @@ -2,7 +2,7 @@ * @TODO I'm hardcoding this to ANSI for now, as it's the most common. * Ideally we should have configurable control characters for various * types of terminals that could be emulated via a standard termcap file. - * @NOTE ANSI escape sequence reference: + * @NOTE ANSI escape sequence reference: * https://en.wikipedia.org/wiki/ANSI_escape_code#Escape_sequences * Note that escape sequences for other terminal types are a thing, and * currently aren't implemented yet as mentioned in the TODO above, eg: @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include @@ -79,7 +81,7 @@ void parseSGR( if (args.empty()) return; for (auto it = args.cbegin(); it != args.cend(); ++it) { - /// @TODO A whole bunch of unimplemented SGR codes are unimplemented + /// @TODO A whole bunch of unimplemented SGR codes are unimplemented /// yet (eg: blink or font switching) enum { Reset = 0, Bold, Light, Italic, Underline, @@ -347,3 +349,13 @@ void RenderEscapeCodes(const QByteArray &input, const QTextCharFormat& format, Q } } +void renderhelpers::setPageMargins(QTextDocument *doc, int mh, int mv) +{ + QTextFrame *root = doc->rootFrame(); + QTextFrameFormat fmt = root->frameFormat(); + fmt.setLeftMargin(mh); + fmt.setRightMargin(mh); + fmt.setTopMargin(mv); + fmt.setBottomMargin(mv); + root->setFrameFormat(fmt); +} -- cgit v1.2.3