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:
@@ -1,5 +1,7 @@
|
||||
#include "component/ComponentManager.h"
|
||||
|
||||
#include "component/view/CodeView.h"
|
||||
|
||||
std::shared_ptr<ComponentManager> ComponentManager::create(
|
||||
std::shared_ptr<ViewManager> viewManager,
|
||||
std::shared_ptr<GuiElementFactory> guiElementFactory,
|
||||
@@ -14,6 +16,14 @@ std::shared_ptr<ComponentManager> ComponentManager::create(
|
||||
void ComponentManager::setup()
|
||||
{
|
||||
m_components.push_back(m_componentFactory->createDummyComponent());
|
||||
|
||||
std::shared_ptr<Component> codeComponent = m_componentFactory->createCodeComponent();
|
||||
m_components.push_back(codeComponent);
|
||||
|
||||
CodeView* codeView = dynamic_cast<CodeView*>(codeComponent->getView());
|
||||
codeView->addCodeSnippet("class HelloWorld;");
|
||||
codeView->addCodeSnippet("static int n = 42; // the answer.");
|
||||
// codeView->clearCodeSnippets();
|
||||
}
|
||||
|
||||
ComponentManager::ComponentManager()
|
||||
|
||||
Reference in New Issue
Block a user