47 :
public std::basic_ostream<char, std::char_traits<char> > {
50 :
public std::basic_streambuf<char, std::char_traits<char> > {
55 QTextBlockFormat bf = editor->textCursor().blockFormat();
56 bf.setBottomMargin(0);
57 editor->textCursor().setBlockFormat(bf);
58 editor->append(buffer);
61 virtual int overflow(
int v = std::char_traits<char>::eof()) {
69 Buf(QTextEdit* e) : editor(e) {}
75 :
std::basic_ostream<char,
std::char_traits<char> >(&_buf),
85 : QMainWindow(parent) {
93 QString fontFamily(
"Courier");
94 font.setFamily(fontFamily);
95 font.setFixedPitch(
true);
96 font.setPointSize(12);
99 editor =
new QTextEdit;
100 editor->setFont(font);
101 editor->setReadOnly(
true);
102 editor->setLineWrapMode(QTextEdit::FixedColumnWidth);
103 editor->setLineWrapColumnOrWidth(80);
106 QAction* clearText =
new QAction(
"Clear",
this);
107 clearText->setShortcut(QKeySequence(
"Ctrl+K"));
108 this->addAction(clearText);
109 connect(clearText, SIGNAL(triggered()), editor,
112 QAction* closeWindow =
new QAction(
"Close window",
this);
113 closeWindow->setShortcut(QKeySequence(
"Ctrl+W"));
114 this->addAction(closeWindow);
115 connect(closeWindow, SIGNAL(triggered()),
this,
118 QToolBar* t = addToolBar(
"Tools");
119 t->setFloatable(
false);
120 t->setMovable(
false);
121 t->addAction(clearText);
123 stayOnTop =
new QAction(
"Stay on top",
this);
124 stayOnTop->setCheckable(
true);
125 t->addAction(stayOnTop);
126 connect(stayOnTop, SIGNAL(changed()),
this,
130 setCentralWidget(editor);
131 setWindowTitle(QString((std::string(
"Gist Console: ") + name).c_str()));
133 setAttribute(Qt::WA_QuitOnClose,
false);
134 setAttribute(Qt::WA_DeleteOnClose,
false);
TextOutputI(const std::string &name, QWidget *parent=0)
Constructor.
void changeStayOnTop(void)
void insertHtml(const QString &s)
Add html string s to the output.
std::ostream & getStream(void)
Return stream that prints to the text display.