ui: basic CodeView with syntax highlighting

Added CodeView interface and QtCodeView implementation for showing syntax highlighted code snippets. This change avoids
using the GuiElement hierarchy by using directly using QtClasses and creating QtCodeView in the QtElementFactory.
This commit is contained in:
Eberhard Graether
2014-06-30 13:50:19 +02:00
parent 1045ce4ab9
commit 73b74cb618
17 changed files with 325 additions and 17 deletions
+37
View File
@@ -0,0 +1,37 @@
#ifndef QT_CODE_VIEW_H
#define QT_CODE_VIEW_H
#include <memory>
#include <vector>
#include <iostream>
#include <QFont>
#include "component/view/CodeView.h"
class QtHighlighter;
class QTextEdit;
class ViewManager;
class QtCodeView: public CodeView
{
public:
QtCodeView(std::shared_ptr<ViewManager> viewManager);
~QtCodeView();
// CodeView implementation
virtual void addCodeSnippet(std::string str);
virtual void clearCodeSnippets();
private:
struct Snippet
{
std::shared_ptr<QTextEdit> textField;
std::shared_ptr<QtHighlighter> highlighter;
};
std::vector<std::shared_ptr<Snippet>> m_snippets;
QFont m_font;
};
# endif // QT_CODE_VIEW_H