diff options
Diffstat (limited to 'frontends/qt/layout.cpp')
-rw-r--r-- | frontends/qt/layout.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/frontends/qt/layout.cpp b/frontends/qt/layout.cpp index 3aab3ca80..110ab5f60 100644 --- a/frontends/qt/layout.cpp +++ b/frontends/qt/layout.cpp @@ -22,6 +22,7 @@ */ #include <stddef.h> +#include <QPainter> extern "C" { @@ -132,6 +133,27 @@ nsqt_layout_split(const struct plot_font_style *fstyle, return NSERROR_OK; } +/* exported interface documented in qt/layout.h */ +nserror +nsqt_layout_plot(QPainter* painter, + const struct plot_font_style *fstyle, + int x, + int y, + const char *text, + size_t length) +{ + QColor strokecolour(fstyle->foreground & 0xFF, + (fstyle->foreground & 0xFF00) >>8, + (fstyle->foreground & 0xFF0000) >>16); + QPen pen(strokecolour); + painter->setPen(pen); + + painter->drawText(x,y, QString::fromUtf8(text,length)); + + return NSERROR_OK; + +} + static struct gui_layout_table layout_table = { .width = nsqt_layout_width, .position = nsqt_layout_position, |