[vlmc-devel] [PATCH 07/12] Commands::Generic Implement setText() correctly

Yikai Lu luyikei.qmltu at gmail.com
Sun May 22 08:36:51 CEST 2016


---
 src/Commands/Commands.cpp | 14 ++++++++++++++
 src/Commands/Commands.h   |  8 +++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/src/Commands/Commands.cpp b/src/Commands/Commands.cpp
index b3ecb90..72902a2 100644
--- a/src/Commands/Commands.cpp
+++ b/src/Commands/Commands.cpp
@@ -64,6 +64,20 @@ Commands::Generic::isValid() const
     return m_valid;
 }
 
+#ifndef WITH_GUI
+void
+Commands::Generic::setText( const QString& text )
+{
+    m_text = text;
+}
+
+QString
+Commands::Generic::text() const
+{
+    return m_text;
+}
+#endif
+
 void
 Commands::Generic::redo()
 {
diff --git a/src/Commands/Commands.h b/src/Commands/Commands.h
index 105303e..9b0e9e8 100644
--- a/src/Commands/Commands.h
+++ b/src/Commands/Commands.h
@@ -54,16 +54,18 @@ namespace Commands
             void            redo();
             void            undo();
             bool            isValid() const;
+#ifndef WITH_GUI
+            void            setText( const QString& text ) ;
+            QString         text() const;
+#endif
         private:
             bool            m_valid;
+            QString         m_text;
         protected slots:
             virtual void    retranslate() = 0;
             void            invalidate();
         signals:
             void            invalidated();
-#ifndef WITH_GUI
-            virtual void    setText( const QString& ) {}
-#endif
     };
 
 #ifdef WITH_GUI
-- 
1.9.1



More information about the Vlmc-devel mailing list