Render widgets on framebuffer

This commit is contained in:
Alex Spataru 2021-11-29 05:35:40 -06:00
parent 40e4b94697
commit 00640a3f4e
4 changed files with 92 additions and 80 deletions

View File

@ -51,6 +51,7 @@ Item {
WidgetLoader {
id: loader
widgetIndex: root.widgetIndex
renderTarget: PaintedItem.FramebufferObject
anchors {
fill: parent
leftMargin: window.borderWidth
@ -113,6 +114,7 @@ Item {
widgetIndex: root.widgetIndex
widgetVisible: _window.visible
anchors.margins: _window.radius
renderTarget: PaintedItem.FramebufferObject
}
}

View File

@ -145,6 +145,7 @@ Item {
maximumBlockCount: 12000
font.family: app.monoFont
autoscroll: Cpp_IO_Console.autoscroll
renderTarget: PaintedItem.FramebufferObject
wordWrapMode: Text.WrapAtWordBoundaryOrAnywhere
placeholderText: qsTr("No data received so far") + "..."

View File

@ -51,10 +51,11 @@ WidgetLoader::WidgetLoader(QQuickItem *parent)
, m_widgetVisible(false)
, m_isExternalWindow(false)
{
// Set item flags
setFlag(ItemHasContents, true);
setFlag(ItemIsFocusScope, true);
setFlag(ItemAcceptsInputMethod, true);
// Set render flags
setOpaquePainting(true);
setAcceptHoverEvents(true);
setRenderTarget(FramebufferObject);
setPerformanceHints(FastFBOResizing);
setAcceptedMouseButtons(Qt::AllButtons);
// Resize widget to fit QML item size
@ -66,6 +67,9 @@ WidgetLoader::WidgetLoader(QQuickItem *parent)
// Automatically update the widget's visibility
connect(Dashboard::getInstance(), &Dashboard::widgetVisibilityChanged, this,
&WidgetLoader::updateWidgetVisible);
// Draw widget
QTimer::singleShot(0, this, SLOT(update()));
}
/**

View File

@ -57,10 +57,12 @@ Terminal::Terminal(QQuickItem *parent)
, m_copyAvailable(false)
, m_textEdit(new QPlainTextEdit)
{
// Set item flags
setFlag(ItemHasContents, true);
setFlag(ItemAcceptsInputMethod, true);
setFlag(ItemIsFocusScope, true);
// Set render flags
setAntialiasing(true);
setOpaquePainting(true);
setAcceptHoverEvents(true);
setRenderTarget(FramebufferObject);
setPerformanceHints(FastFBOResizing);
setAcceptedMouseButtons(Qt::AllButtons);
m_escapeCodeHandler.setTextEdit(textEdit());
@ -100,6 +102,9 @@ Terminal::Terminal(QQuickItem *parent)
// React to widget events
connect(textEdit(), SIGNAL(copyAvailable(bool)), this, SLOT(setCopyAvailable(bool)));
// Draw widget
QTimer::singleShot(0, this, SLOT(update()));
}
/**