no message

master
zcy 2021-09-12 01:28:36 +08:00
parent 62c9df87c8
commit 8e0176a5c0
4 changed files with 38 additions and 20 deletions

View File

@ -5,6 +5,7 @@ import QtQuick.Controls.Material 2.12
Item { Item {
id: debug_form
objectName: "ProtoDebug" objectName: "ProtoDebug"
width: 800 width: 800
height: 600 height: 600
@ -52,7 +53,7 @@ Item {
font.pixelSize: 30 font.pixelSize: 30
font.bold: true font.bold: true
} }
Flickable { ScrollView {
id: flick id: flick
Layout.preferredHeight: parent.height - 100 Layout.preferredHeight: parent.height - 100
Layout.preferredWidth: parent.width/2 - 20 Layout.preferredWidth: parent.width/2 - 20
@ -60,7 +61,6 @@ Item {
contentWidth: lua_script.paintedWidth contentWidth: lua_script.paintedWidth
contentHeight: lua_script.paintedHeight contentHeight: lua_script.paintedHeight
clip: true
Layout.leftMargin: 10 Layout.leftMargin: 10
ColorAnimation { ColorAnimation {
@ -91,19 +91,28 @@ Item {
onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
} }
} }
ScrollView{
TextArea {
id: text_output
Layout.preferredHeight: parent.height - 100
text: qsTr("")
font.pixelSize: 20
Layout.columnSpan: 1 Layout.columnSpan: 1
Layout.preferredWidth: parent.width/2 - 20 Layout.preferredWidth: parent.width/2 - 35
background: Rectangle { Layout.preferredHeight: parent.height - 200
border.color: text_output.enabled ? "#21be2b" : "transparent"
}
Layout.leftMargin: 10 Layout.leftMargin: 10
height: parent.height
TextArea {
id: text_output
height: parent.height
text: qsTr("")
font.pixelSize: 20
cursorVisible: true;
focus: true;
readOnly: true
selectByMouse:true;
selectByKeyboard: true
background: Rectangle {
border.color: text_output.enabled ? "#21be2b" : "transparent"
}
}
} }
RowLayout{ RowLayout{
visible: true visible: true
@ -168,10 +177,17 @@ Item {
text: qsTr("执行命令") text: qsTr("执行命令")
Layout.bottomMargin: 10 Layout.bottomMargin: 10
onClicked: { onClicked: {
} }
} }
Button {
id: button3
text: qsTr("清空缓冲区")
Layout.bottomMargin: 10
onClicked: {
console.log("dfsd")
debug_form.clearbuff()
}
}
} }
} }
} }
@ -195,6 +211,10 @@ Item {
showbuf += str; showbuf += str;
text_output.text = showbuf; text_output.text = showbuf;
} }
function clearbuff(){
showbuf = "";
text_output.text = showbuf;
}
} }

View File

@ -95,6 +95,7 @@ void LuaDelegate::OnClientLeave(QString ip, uint32_t port, uint32_t sockptr)
lua_call(mVM,3,0); lua_call(mVM,3,0);
} }
void LuaDelegate::DumpStack() void LuaDelegate::DumpStack()
{ {
static int count = 0; static int count = 0;

View File

@ -50,6 +50,7 @@ public:
void OnNetworkData(char*,char*,uint32_t port); void OnNetworkData(char*,char*,uint32_t port);
void OnNewTcpClient(QString ip,uint32_t port,uint32_t sockptr); void OnNewTcpClient(QString ip,uint32_t port,uint32_t sockptr);
void OnClientLeave(QString ip,uint32_t port,uint32_t sockptr); void OnClientLeave(QString ip,uint32_t port,uint32_t sockptr);
void ClearShowBuffer();
void DumpStack(); void DumpStack();

View File

@ -32,16 +32,13 @@ public:
int OnDataRecv(QByteArray); int OnDataRecv(QByteArray);
int ShowDataInQML(QString x); int ShowDataInQML(QString x);
int SendUartData(const char *); int SendUartData(const char *);
Q_INVOKABLE void getValFromQml(int v) { Q_INVOKABLE void getValFromQml(int v) {
emit valueFromCpp(456); emit valueFromCpp(456);
} }
Q_INVOKABLE int openUart(QString port,QString baudRate,QString dataBits,QString stopBits, Q_INVOKABLE int openUart(QString port,QString baudRate,QString dataBits,QString stopBits,
QString flow); QString flow);
Q_INVOKABLE int openNetwork(QString ip,unsigned int port,bool is_ws,int type); Q_INVOKABLE int openNetwork(QString ip,unsigned int port,bool is_ws,int type);
Q_INVOKABLE int closeNetwork(QString); Q_INVOKABLE int closeNetwork(QString);
Q_INVOKABLE int closeSerial(); Q_INVOKABLE int closeSerial();
Q_INVOKABLE int TestLua(); Q_INVOKABLE int TestLua();
Q_INVOKABLE int TestShowData(); Q_INVOKABLE int TestShowData();
@ -49,14 +46,13 @@ public:
Q_INVOKABLE int saveLuaScript(QString); Q_INVOKABLE int saveLuaScript(QString);
Q_INVOKABLE bool luaStatus(); Q_INVOKABLE bool luaStatus();
Q_INVOKABLE bool DoLuaCmd(QString); Q_INVOKABLE bool DoLuaCmd(QString);
QString _txt = "hello world\r\n"; QString _txt = "hello world\r\n";
signals: signals:
void txtchanged(); void txtchanged();
void valueFromCpp(int val); void valueFromCpp(int val);
void sendToQml(int count); void sendToQml(int count);
void disConnected(); void disConnected();
void clearBuffer();
public slots: public slots:
void on_network_data_recv(); void on_network_data_recv();