Mercurial > projects > qtd
comparison demos/browser/autosaver.d @ 94:87bb4e622f9e
more porting
author | mandel |
---|---|
date | Thu, 28 May 2009 22:11:52 +0000 |
parents | 5c8c9c5d9ee1 |
children | dcd36d8db2da |
comparison
equal
deleted
inserted
replaced
93:55fd7080c4b9 | 94:87bb4e622f9e |
---|---|
72 } | 72 } |
73 | 73 |
74 ~this() | 74 ~this() |
75 { | 75 { |
76 if (m_timer.isActive()) | 76 if (m_timer.isActive()) |
77 qWarning() << "AutoSaver: still active when destroyed, changes not saved."; | 77 qWarning("AutoSaver: still active when destroyed, changes not saved."); |
78 } | 78 } |
79 | 79 |
80 void saveIfNeccessary() | 80 void saveIfNeccessary() |
81 { | 81 { |
82 if (!m_timer.isActive()) | 82 if (!m_timer.isActive()) |
83 return; | 83 return; |
84 m_timer.stop(); | 84 m_timer.stop(); |
85 m_firstChange = QTime(); | 85 m_firstChange = new QTime(); |
86 | 86 |
87 //TODO! | 87 //TODO! |
88 //if (!QMetaObject.invokeMethod(parent(), "save", Qt.DirectConnection)) { | 88 //if (!QMetaObject.invokeMethod(parent(), "save", Qt.DirectConnection)) { |
89 // qWarning() << "AutoSaver: error invoking slot save() on parent"; | 89 // qWarning("AutoSaver: error invoking slot save() on parent"); |
90 //} | 90 //} |
91 } | 91 } |
92 | 92 |
93 public: | 93 public: |
94 | 94 |
109 void timerEvent(QTimerEvent event) | 109 void timerEvent(QTimerEvent event) |
110 { | 110 { |
111 if (event.timerId() == m_timer.timerId()) { | 111 if (event.timerId() == m_timer.timerId()) { |
112 saveIfNeccessary(); | 112 saveIfNeccessary(); |
113 } else { | 113 } else { |
114 QObject.timerEvent(event); | 114 super.timerEvent(event); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 private: | 118 private: |
119 | 119 |