-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuicontroller.cpp
More file actions
34 lines (29 loc) · 850 Bytes
/
uicontroller.cpp
File metadata and controls
34 lines (29 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "uicontroller.h"
#include <QString>
#include <QEvent>
#include <iostream>
void UiController::setProperty(const char* objectName, const char* propertyName, const char* value)
{
root->findChild<QObject*>(objectName)->setProperty(propertyName, QString(value));
}
string UiController::getProperty(const char* objectName, const char* propertyName)
{
return root->findChild<QObject*>(objectName)->property(propertyName).toString().toStdString();
}
void UiController::clearLog()
{
setProperty("sys_log", "text", "");
}
void UiController::writeToLog(const char* msg)
{
string text = getProperty("sys_log", "text");
if ( !text.empty() )
text.append("\n");
text.append(msg);
setProperty("sys_log", "text", text.c_str());
refreshForm();
}
void UiController::refreshForm(void)
{
qApp->processEvents();
}