无法在QTableWidget中更新字符串

时间:2016-07-21 14:38:45

标签: c++ qt qtablewidget qstring qtablewidgetitem

我想在表格中将2.16更改为2,16。这是我的代码

return

我的代码正常运行,我已经调试,实现了行(defun write-segment (filename segment) (cond ((null segment) (with-open-file (out filename :direction :output :if-exists :append :if-does-not-exist :create) (format out "~%"))) (T (with-open-file (out filename :direction :output :if-exists :append :if-does-not-exist :create) (format out "~D " (first segment)) (write-segment filename (cdr segment)))))) 。但在那之后,该表仍然显示2.16,而不是2,16。我不知道为什么?在更换字符串后,是否需要刷新表格或类似内容?

1 个答案:

答案 0 :(得分:1)

您的代码中没有 <!DOCTYPE html> <html lang="en"> <head> <title>Bootstrap Example</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script> function allowDrop(ev) { ev.preventDefault(); } function drag(ev) { ev.dataTransfer.setData("text", ev.target.id); } function dropOrder(ev) { ev.preventDefault(); var data = ev.dataTransfer.getData("text"); if (ev.target === document.getElementById('drop-from') || ev.target === document.getElementById('drop-to')) { ev.target.appendChild(document.getElementById(data)); } else { ev.target.parentNode.insertBefore(document.getElementById(data), ev.target.nextSibling) } updateOrder(); } function updateOrder() { var w = document.getElementById('drop-to'); var children = w.getElementsByTagName('div'); for (var i = 0; i < children.length; i++) { var node = children[i]; document.getElementById('order-'+i).value=node.id; } } </script> </head> <body> <div class="container"> <h2>Vertical (basic) form</h2> <form role="form"> <div class="form-group"> <label for="order">Put in order:</label> <input type="text" name="order-1" id="order-0" value=""> <input type="text" name="order-2" id="order-1" value=""> <input type="text" name="order-3" id="order-2" value=""> <input type="text" name="order-4" id="order-3" value=""> <div style="border: 1px dashed #ddd; padding: 0.5em; min-height: 2em; margin-bottom: 4px;" ondrop="dropOrder(event)" ondragover="allowDrop(event)" id="drop-from" placeholder="Pak hier de opties"> <div draggable="true" ondragstart="drag(event)" style="float: left;" id="option-1" class="label label-default">Optie 1</div> <div draggable="true" ondragstart="drag(event)" style="float: left;" id="option-2" class="label label-default">Optie 2</div> <div draggable="true" ondragstart="drag(event)" style="float: left;" id="option-3" class="label label-default">Optie 3</div> <div draggable="true" ondragstart="drag(event)" style="float: left;" id="option-4" class="label label-default">Optie 4</div> </div> <div class="form-control" ondrop="dropOrder(event)" ondragover="allowDrop(event)" id="drop-to" placeholder="sleep ze in de juiste volgorde hier naartoe"></div> </div> <button type="submit" class="btn btn-default">Submit</button> </form> </div> </body> </html> 。试试这个:

setText