From c28596292fe025dbd1623cc322ed71f4dc7a7d4e Mon Sep 17 00:00:00 2001 From: Eduardo Bart Date: Sun, 20 Jan 2013 13:40:40 -0200 Subject: [PATCH] Text selection in chat * Remove fancy stuff from background * Improve text windows * More improvements to textedit --- modules/client_background/background.otui | 62 -------- modules/game_console/console.lua | 22 ++- modules/game_console/console.otui | 15 +- modules/game_textwindow/textwindow.lua | 1 - modules/game_textwindow/textwindow.otui | 1 + src/framework/CMakeLists.txt | 2 - src/framework/ui/uirichtext.cpp | 24 --- src/framework/ui/uirichtext.h | 33 ---- src/framework/ui/uitextedit.cpp | 181 ++++++++++++++-------- src/framework/ui/uitextedit.h | 6 +- src/framework/ui/uiwidget.cpp | 2 +- src/framework/ui/uiwidget.h | 2 +- src/framework/ui/uiwidgettext.cpp | 1 + 13 files changed, 156 insertions(+), 196 deletions(-) delete mode 100644 src/framework/ui/uirichtext.cpp delete mode 100644 src/framework/ui/uirichtext.h diff --git a/modules/client_background/background.otui b/modules/client_background/background.otui index 3ccf90a9..e14fb9e7 100644 --- a/modules/client_background/background.otui +++ b/modules/client_background/background.otui @@ -9,68 +9,6 @@ Panel anchors.bottom: parent.bottom margin-top: 1 focusable: false - @onSetup: | - scheduleEvent(function() - local count = 0 - cycleEvent(function() - if count > 360 then return end - self:setRotation(count) - count = count + 5 - end, 10) - end, 10) - - UIParticles - anchors.fill: parent - effect: background-effect - reference-pos: 0.5 0.25 - - Label - text: :O Just For Fun LOL ^.^ - font: sans-bold-16px - color: black - background: #ffffff60 - anchors.top: parent.top - anchors.horizontalCenter: parent.horizontalCenter - margin-left: 10 - margin-top: 40 - height: 24 - rotation: -15 - @onSetup: | - local count = 0 - cycleEvent(function() - local text = ':O Just For Fun LOL ^.^' - self:setText(string.sub(text, 0, count)) - if count > #text + 10 then count = 0 end - count = count + 1 - end, 100) - - Label - text: PLEASE REMOVE THAT SHIT! - font: sans-bold-16px - color: black - background: #ffffff60 - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - margin-left: 10 - margin-bottom: 40 - height: 24 - rotation: 15 - visible: false - @onSetup: scheduleEvent(function() self:show() end, 4000) - - Label - text: WTF IS WRONG WITH THIS BACKGROUND? - font: sans-bold-16px - color: pink - background: #ffffff99 - anchors.top: parent.top - anchors.right: parent.right - margin-left: 10 - margin-top: 80 - height: 24 - rotation: 10 - visible: false - @onSetup: scheduleEvent(function() self:show() end, 8000) UILabel id: clientVersionLabel diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index dee6d433..c4909312 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -87,6 +87,22 @@ function init() consoleTabBar:setTabSpacing(-1) channels = {} + consolePanel.onKeyPress = function(self, keyCode, keyboardModifiers) + if not (keyboardModifiers == KeyboardCtrlModifier and keyCode == KeyC) then return false end + + local tab = consoleTabBar:getCurrentTab() + if not tab then return false end + + local consoleBuffer = tab.tabPanel:getChildById('consoleBuffer') + if not consoleBuffer then return false end + + local consoleLabel = consoleBuffer:getFocusedChild() + if not consoleLabel or not consoleLabel:hasSelection() then return false end + + g_window.setClipboardText(consoleLabel:getSelection()) + return true + end + defaultTab = addTab(tr('Default'), true) serverTab = addTab(tr('Server Log'), false) @@ -355,16 +371,16 @@ function addTabText(text, speaktype, tab, creatureName) local panel = consoleTabBar:getTabPanel(tab) local consoleBuffer = panel:getChildById('consoleBuffer') local label = g_ui.createWidget('ConsoleLabel', consoleBuffer) - label:setId('consoleLabel' .. panel:getChildCount()) + label:setId('consoleLabel' .. consoleBuffer:getChildCount()) label:setText(text) label:setColor(speaktype.color) consoleTabBar:blinkTab(tab) -- Overlay for consoleBuffer which shows highlighted words only local consoleBufferHighlight = panel:getChildById('consoleBufferHighlight') - local labelHighlight = g_ui.createWidget('ConsoleLabel', consoleBufferHighlight) + local labelHighlight = g_ui.createWidget('ConsolePhantomLabel', consoleBufferHighlight) - labelHighlight:setId('consoleLabel' .. panel:getChildCount()) + labelHighlight:setId('consoleLabel' .. consoleBufferHighlight:getChildCount()) labelHighlight:setColor("#1f9ffe") local player = g_game.getLocalPlayer() diff --git a/modules/game_console/console.otui b/modules/game_console/console.otui index c171ac64..edbcaf2b 100644 --- a/modules/game_console/console.otui +++ b/modules/game_console/console.otui @@ -1,10 +1,22 @@ -ConsoleLabel < UILabel +ConsoleLabel < UITextEdit font: verdana-11px-antialised height: 14 color: yellow margin-left: 2 text-wrap: true text-auto-resize: true + selection-color: #111416 + selection-background-color: #999999 + +ConsolePhantomLabel < UILabel + font: verdana-11px-antialised + height: 14 + color: yellow + margin-left: 2 + text-wrap: true + text-auto-resize: true + selection-color: #111416 + selection-background-color: #999999 ConsoleTabBar < TabBar ConsoleTabBarPanel < TabBarPanel @@ -168,3 +180,4 @@ Panel margin-left: 6 margin-bottom: 6 shift-navigation: true + max-length: 255 diff --git a/modules/game_textwindow/textwindow.lua b/modules/game_textwindow/textwindow.lua index 20fe22ff..2754654f 100644 --- a/modules/game_textwindow/textwindow.lua +++ b/modules/game_textwindow/textwindow.lua @@ -40,7 +40,6 @@ function onGameEditText(id, itemId, maxLength, text, writter, time) textEdit:setText(text) textEdit:setEditable(writeable) textEdit:setCursorVisible(writeable) - textEdit:wrapText() local desc = '' if #writter > 0 then diff --git a/modules/game_textwindow/textwindow.otui b/modules/game_textwindow/textwindow.otui index 78bfe8ba..d8037372 100644 --- a/modules/game_textwindow/textwindow.otui +++ b/modules/game_textwindow/textwindow.otui @@ -25,6 +25,7 @@ TextWindow < MainWindow anchors.right: textScroll.left anchors.bottom: textScroll.bottom vertical-scrollbar: textScroll + text-wrap: true VerticalScrollBar id: textScroll diff --git a/src/framework/CMakeLists.txt b/src/framework/CMakeLists.txt index 3d778e80..d516fd5a 100644 --- a/src/framework/CMakeLists.txt +++ b/src/framework/CMakeLists.txt @@ -360,8 +360,6 @@ if(FRAMEWORK_GRAPHICS) ${CMAKE_CURRENT_LIST_DIR}/ui/uimanager.h ${CMAKE_CURRENT_LIST_DIR}/ui/uiparticles.cpp ${CMAKE_CURRENT_LIST_DIR}/ui/uiparticles.h - ${CMAKE_CURRENT_LIST_DIR}/ui/uirichtext.cpp - ${CMAKE_CURRENT_LIST_DIR}/ui/uirichtext.h ${CMAKE_CURRENT_LIST_DIR}/ui/uitextedit.cpp ${CMAKE_CURRENT_LIST_DIR}/ui/uitextedit.h ${CMAKE_CURRENT_LIST_DIR}/ui/uitranslator.cpp diff --git a/src/framework/ui/uirichtext.cpp b/src/framework/ui/uirichtext.cpp deleted file mode 100644 index e7ba66da..00000000 --- a/src/framework/ui/uirichtext.cpp +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2010-2013 OTClient - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#include "uirichtext.h" - diff --git a/src/framework/ui/uirichtext.h b/src/framework/ui/uirichtext.h deleted file mode 100644 index 11325d10..00000000 --- a/src/framework/ui/uirichtext.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2010-2013 OTClient - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ - -#ifndef UIRICHTEXT_H -#define UIRICHTEXT_H - -#include - - -class UIRichText : public UIWidget -{ -}; - -#endif // UIRICHTEXT_H diff --git a/src/framework/ui/uitextedit.cpp b/src/framework/ui/uitextedit.cpp index 2f2d4058..e4557adf 100644 --- a/src/framework/ui/uitextedit.cpp +++ b/src/framework/ui/uitextedit.cpp @@ -136,6 +136,17 @@ void UITextEdit::update(bool focusCursor) const Size *glyphsSize = m_font->getGlyphsSize(); int glyph; + // update rect size + if(!m_rect.isValid() || m_textAutoResize) { + textBoxSize += Size(m_padding.left + m_padding.right, m_padding.top + m_padding.bottom) + m_textOffset.toSize(); + Size size = getSize(); + if(size.width() <= 0 || (m_textAutoResize && !m_textWrap)) + size.setWidth(textBoxSize.width()); + if(size.height() <= 0 || m_textAutoResize) + size.setHeight(textBoxSize.height()); + setSize(size); + } + // resize just on demand if(textLength > (int)m_glyphsCoords.size()) { m_glyphsCoords.resize(textLength); @@ -144,6 +155,11 @@ void UITextEdit::update(bool focusCursor) Point oldTextAreaOffset = m_textVirtualOffset; + if(textBoxSize.width() <= getPaddingRect().width()) + m_textVirtualOffset.x = 0; + if(textBoxSize.height() <= getPaddingRect().height()) + m_textVirtualOffset.y = 0; + // readjust start view area based on cursor position m_cursorInRange = false; if(focusCursor) { @@ -331,8 +347,6 @@ void UITextEdit::setSelection(int start, int end) m_selectionStart = std::min(std::max(start, 0), (int)m_text.length()); m_selectionEnd = std::min(std::max(end, 0), (int)m_text.length()); - - onSelectionChange(getSelection(), m_selectionStart, m_selectionEnd); } void UITextEdit::setTextHidden(bool hidden) @@ -355,8 +369,9 @@ void UITextEdit::appendText(std::string text) if(m_cursorPos >= 0) { // replace characters that are now allowed if(!m_multiline) - stdext::replace_all(text, "\n", ""); - stdext::replace_all(text, "\r", " "); + stdext::replace_all(text, "\n", " "); + stdext::replace_all(text, "\r", ""); + stdext::replace_all(text, "\t", " "); if(text.length() > 0) { // only add text if textedit can add it @@ -371,10 +386,10 @@ void UITextEdit::appendText(std::string text) } } - std::string oldText = m_text; - m_text.insert(m_cursorPos, text); + std::string tmp = m_text; + tmp.insert(m_cursorPos, text); m_cursorPos += text.length(); - onTextChange(m_text, oldText); + setText(tmp); } } } @@ -396,26 +411,26 @@ void UITextEdit::appendCharacter(char c) std::string tmp; tmp = c; - std::string oldText = m_text; - m_text.insert(m_cursorPos, tmp); + std::string tmp2 = m_text; + tmp2.insert(m_cursorPos, tmp); m_cursorPos++; - onTextChange(m_text, oldText); + setText(tmp2); } } void UITextEdit::removeCharacter(bool right) { - std::string oldText = m_text; - if(m_cursorPos >= 0 && m_text.length() > 0) { - if((uint)m_cursorPos >= m_text.length()) { - m_text.erase(m_text.begin() + (--m_cursorPos)); + std::string tmp = m_text; + if(m_cursorPos >= 0 && tmp.length() > 0) { + if((uint)m_cursorPos >= tmp.length()) { + tmp.erase(tmp.begin() + (--m_cursorPos)); } else { if(right) - m_text.erase(m_text.begin() + m_cursorPos); + tmp.erase(tmp.begin() + m_cursorPos); else if(m_cursorPos > 0) - m_text.erase(m_text.begin() + --m_cursorPos); + tmp.erase(tmp.begin() + --m_cursorPos); } - onTextChange(m_text, oldText); + setText(tmp); } } @@ -428,12 +443,12 @@ void UITextEdit::blinkCursor() void UITextEdit::del(bool right) { if(hasSelection()) { - std::string oldText = m_text; - m_text.erase(m_selectionStart, m_selectionEnd - m_selectionStart); + std::string tmp = m_text; + tmp.erase(m_selectionStart, m_selectionEnd - m_selectionStart); setCursorPos(m_selectionStart); clearSelection(); - onTextChange(m_text, oldText); + setText(tmp); } else removeCharacter(right); } @@ -494,28 +509,51 @@ int UITextEdit::getTextPos(Point pos) // find any glyph that is actually on the int candidatePos = -1; + Rect firstGlyphRect, lastGlyphRect; for(int i=0;igetYOffset() + m_font->getGlyphSpacing().height()); clickGlyphRect.expandLeft(m_font->getGlyphSpacing().width()+1); - if(clickGlyphRect.contains(pos)) - return i; + if(clickGlyphRect.contains(pos)) { + candidatePos = i; + break; + } else if(pos.y >= clickGlyphRect.top() && pos.y <= clickGlyphRect.bottom()) { - if(pos.x <= clickGlyphRect.left()) + if(pos.x <= clickGlyphRect.left()) { candidatePos = i; - else if(pos.x >= clickGlyphRect.right()) + break; + } else if(pos.x >= clickGlyphRect.right()) candidatePos = i+1; } } + + if(textLength > 0) { + if(pos.y < firstGlyphRect.top()) + return 0; + else if(pos.y > lastGlyphRect.bottom()) + return textLength; + } + return candidatePos; } std::string UITextEdit::getDisplayedText() { + std::string text; if(m_textHidden) - return std::string(m_text.length(), '*'); + text = std::string(m_text.length(), '*'); else - return m_text; + text = m_text; + + if(m_textWrap && m_rect.isValid()) + text = m_font->wrapText(text, getWidth() - m_textOffset.x); + + return text; } std::string UITextEdit::getSelection() @@ -525,35 +563,27 @@ std::string UITextEdit::getSelection() return m_text.substr(m_selectionStart, m_selectionEnd - m_selectionStart); } -void UITextEdit::onHoverChange(bool hovered) +void UITextEdit::updateText() { - if(hovered) - g_mouse.setTextCursor(); - else - g_mouse.restoreCursor(); -} - -void UITextEdit::onTextChange(const std::string& text, const std::string& oldText) -{ - if(m_cursorPos > (int)text.length()) - m_cursorPos = text.length(); + if(m_cursorPos > (int)m_text.length()) + m_cursorPos = m_text.length(); // any text changes reset the selection if(m_selectable) { m_selectionEnd = 0; m_selectionStart = 0; - onSelectionChange(std::string(), 0, 0); } blinkCursor(); update(true); - UIWidget::onTextChange(text, oldText); } -void UITextEdit::onFontChange(const std::string& font) +void UITextEdit::onHoverChange(bool hovered) { - update(true); - UIWidget::onFontChange(font); + if(hovered) + g_mouse.setTextCursor(); + else + g_mouse.restoreCursor(); } void UITextEdit::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode) @@ -615,11 +645,15 @@ bool UITextEdit::onKeyPress(uchar keyCode, int keyboardModifiers, int autoRepeat if(keyboardModifiers == Fw::KeyboardNoModifier) { if(keyCode == Fw::KeyDelete && m_editable) { // erase right character - del(true); - return true; - } else if(keyCode == Fw::KeyBackspace && m_editable) { // erase left character { - del(false); - return true; + if(hasSelection() || !m_text.empty()) { + del(true); + return true; + } + } else if(keyCode == Fw::KeyBackspace && m_editable) { // erase left character + if(hasSelection() || !m_text.empty()) { + del(false); + return true; + } } else if(keyCode == Fw::KeyRight && !m_shiftNavigation) { // move cursor right clearSelection(); moveCursorHorizontally(true); @@ -629,13 +663,17 @@ bool UITextEdit::onKeyPress(uchar keyCode, int keyboardModifiers, int autoRepeat moveCursorHorizontally(false); return true; } else if(keyCode == Fw::KeyHome) { // move cursor to first character - clearSelection(); - setCursorPos(0); - return true; + if(m_cursorPos != 0) { + clearSelection(); + setCursorPos(0); + return true; + } } else if(keyCode == Fw::KeyEnd) { // move cursor to last character - clearSelection(); - setCursorPos(m_text.length()); - return true; + if(m_cursorPos != (int)m_text.length()) { + clearSelection(); + setCursorPos(m_text.length()); + return true; + } } else if(keyCode == Fw::KeyTab && !m_shiftNavigation) { clearSelection(); if(UIWidgetPtr parent = getParent()) @@ -656,14 +694,20 @@ bool UITextEdit::onKeyPress(uchar keyCode, int keyboardModifiers, int autoRepeat paste(g_window.getClipboardText()); return true; } else if(keyCode == Fw::KeyX && m_editable && m_selectable) { - cut(); - return true; + if(hasSelection()) { + cut(); + return true; + } } else if(keyCode == Fw::KeyC && m_selectable) { - copy(); - return true; + if(hasSelection()) { + copy(); + return true; + } } else if(keyCode == Fw::KeyA && m_selectable) { - selectAll(); - return true; + if(m_text.length() > 0) { + selectAll(); + return true; + } } } else if(keyboardModifiers == Fw::KeyboardShiftModifier) { if(keyCode == Fw::KeyTab && !m_shiftNavigation) { @@ -708,6 +752,9 @@ bool UITextEdit::onKeyText(const std::string& keyText) bool UITextEdit::onMousePress(const Point& mousePos, Fw::MouseButton button) { + if(UIWidget::onMousePress(mousePos, button)) + return true; + if(button == Fw::MouseLeftButton) { int pos = getTextPos(mousePos); if(pos >= 0) { @@ -720,7 +767,8 @@ bool UITextEdit::onMousePress(const Point& mousePos, Fw::MouseButton button) } return true; } - return UIWidget::onMousePress(mousePos, button); + + return false; } bool UITextEdit::onMouseRelease(const Point& mousePos, Fw::MouseButton button) @@ -741,13 +789,16 @@ bool UITextEdit::onMouseMove(const Point& mousePos, const Point& mouseMoved) return UIWidget::onMouseMove(mousePos, mouseMoved); } -void UITextEdit::onTextAreaUpdate(const Point& offset, const Size& visibleSize, const Size& totalSize) +bool UITextEdit::onDoubleClick(const Point& mousePos) { - callLuaField("onTextAreaUpdate", offset, visibleSize, totalSize); + if(m_selectable && m_text.length() > 0) { + selectAll(); + return true; + } + return UIWidget::onDoubleClick(mousePos); } -void UITextEdit::onSelectionChange(const std::string& text, int start, int end) +void UITextEdit::onTextAreaUpdate(const Point& offset, const Size& visibleSize, const Size& totalSize) { - update(true); - callLuaField("onSelectionChange", text, start, end); + callLuaField("onTextAreaUpdate", offset, visibleSize, totalSize); } diff --git a/src/framework/ui/uitextedit.h b/src/framework/ui/uitextedit.h index 77a179e7..9890e394 100644 --- a/src/framework/ui/uitextedit.h +++ b/src/framework/ui/uitextedit.h @@ -88,9 +88,9 @@ public: bool isSelectable() { return m_selectable; } protected: + void updateText(); + virtual void onHoverChange(bool hovered); - virtual void onTextChange(const std::string& text, const std::string& oldText); - virtual void onFontChange(const std::string& font); virtual void onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode); virtual void onGeometryChange(const Rect& oldRect, const Rect& newRect); virtual void onFocusChange(bool focused, Fw::FocusReason reason); @@ -99,8 +99,8 @@ protected: virtual bool onMousePress(const Point& mousePos, Fw::MouseButton button); virtual bool onMouseRelease(const Point& mousePos, Fw::MouseButton button); virtual bool onMouseMove(const Point& mousePos, const Point& mouseMoved); + virtual bool onDoubleClick(const Point& mousePos); virtual void onTextAreaUpdate(const Point& vitualOffset, const Size& virtualSize, const Size& totalSize); - virtual void onSelectionChange(const std::string& text, int start, int end); private: void disableUpdates() { m_updatesEnabled = false; } diff --git a/src/framework/ui/uiwidget.cpp b/src/framework/ui/uiwidget.cpp index 15fa22e9..871c47d5 100644 --- a/src/framework/ui/uiwidget.cpp +++ b/src/framework/ui/uiwidget.cpp @@ -1513,7 +1513,7 @@ bool UIWidget::onKeyUp(uchar keyCode, int keyboardModifiers) bool UIWidget::onMousePress(const Point& mousePos, Fw::MouseButton button) { if(button == Fw::MouseLeftButton) { - if(m_clickTimer.running() && m_clickTimer.ticksElapsed() <= 500) { + if(m_clickTimer.running() && m_clickTimer.ticksElapsed() <= 200) { if(onDoubleClick(mousePos)) return true; m_clickTimer.stop(); diff --git a/src/framework/ui/uiwidget.h b/src/framework/ui/uiwidget.h index 96873294..bda1ada3 100644 --- a/src/framework/ui/uiwidget.h +++ b/src/framework/ui/uiwidget.h @@ -456,7 +456,6 @@ public: // text related private: void initText(); - void updateText(); void parseTextStyle(const OTMLNodePtr& styleNode); stdext::boolean m_textMustRecache; @@ -464,6 +463,7 @@ private: Rect m_textCachedScreenCoords; protected: + virtual void updateText(); void drawText(const Rect& screenCoords); virtual void onTextChange(const std::string& text, const std::string& oldText); diff --git a/src/framework/ui/uiwidgettext.cpp b/src/framework/ui/uiwidgettext.cpp index 389cdcae..6f7bda97 100644 --- a/src/framework/ui/uiwidgettext.cpp +++ b/src/framework/ui/uiwidgettext.cpp @@ -120,6 +120,7 @@ void UIWidget::setText(std::string text) m_text = text; updateText(); + text = m_text; onTextChange(text, oldText); }