39 #if QT_VERSION >= 0x050000
47 namespace Gecode {
namespace Gist {
51 :
public std::basic_ostream<char, std::char_traits<char> > {
54 :
public std::basic_streambuf<char, std::char_traits<char> > {
59 QTextBlockFormat bf = editor->textCursor().blockFormat();
60 bf.setBottomMargin(0);
61 editor->textCursor().setBlockFormat(bf);
62 editor->append(buffer);
65 virtual int overflow(
int v = std::char_traits<char>::eof()) {
73 Buf(QTextEdit* e) : editor(e) {}
79 :
std::basic_ostream<char,
std::char_traits<char> >(&_buf),
89 : QMainWindow(parent) {
97 QString fontFamily(
"Courier");
98 font.setFamily(fontFamily);
99 font.setFixedPitch(
true);
100 font.setPointSize(12);
103 editor =
new QTextEdit;
104 editor->setFont(font);
105 editor->setReadOnly(
true);
106 editor->setLineWrapMode(QTextEdit::FixedColumnWidth);
107 editor->setLineWrapColumnOrWidth(80);
110 QAction* clearText =
new QAction(
"Clear",
this);
111 clearText->setShortcut(QKeySequence(
"Ctrl+K"));
112 this->addAction(clearText);
113 connect(clearText, SIGNAL(triggered()), editor,
116 QAction* closeWindow =
new QAction(
"Close window",
this);
117 closeWindow->setShortcut(QKeySequence(
"Ctrl+W"));
118 this->addAction(closeWindow);
119 connect(closeWindow, SIGNAL(triggered()),
this,
122 QToolBar*
t = addToolBar(
"Tools");
123 t->setFloatable(
false);
124 t->setMovable(
false);
125 t->addAction(clearText);
127 stayOnTop =
new QAction(
"Stay on top",
this);
128 stayOnTop->setCheckable(
true);
129 t->addAction(stayOnTop);
130 connect(stayOnTop, SIGNAL(changed()),
this,
134 setCentralWidget(editor);
135 setWindowTitle(QString((std::string(
"Gist Console: ") + name).c_str()));
137 setAttribute(Qt::WA_QuitOnClose,
false);
138 setAttribute(Qt::WA_DeleteOnClose,
false);
158 QTextBlockFormat bf = editor->textCursor().blockFormat();
159 bf.setBottomMargin(0);
160 editor->textCursor().setBlockFormat(bf);
161 editor->insertHtml(s);
162 editor->ensureCursorVisible();
167 if (stayOnTop->isChecked()) {
168 setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
170 setWindowFlags(windowFlags() & ~Qt::WindowStaysOnTopHint);
~TextOutputI(void)
Destructor.
bool pos(const View &x)
Test whether x is postive.
void flush(void)
Flush output.
int p
Number of positive literals for node type.
Class holding Gecode and Gist logo icons.
void changeStayOnTop(void)
GistOutputStream(QTextEdit *editor)
const unsigned char * gistLogo
A smaller logo used as a window icon.
std::ostream & getStream(void)
Return stream that prints to the text display.
Gecode toplevel namespace
void insertHtml(const QString &s)
Add html string s to the output.
TextOutputI(const std::string &name, QWidget *parent=0)
Constructor.
const unsigned int gistLogoSize
Size of the smaller logo.
An outputstream that prints on a QTextEdit.