we have use qt TableView like sample source. but the memory was leaked.
-
we have use qt TableView like sample source. but the memory was leaked.
please support us to prevent the memory leaks.
Entry QML:Screen.qmlc++ sample source:
1)display
beginRemoveRows(QModelIndex(), 0, 0);
for (i = - 1; i >= 0; --i)
{
m_inputPointList.removeAt(i);
}
endRemoveRows();
beginInsertRows(QModelIndex(), 0, loopCnt-1);
for(i = 0 ; i < loopCnt; ++i){
......
m_inputPointList.append(point);
}
endInsertRows();
2) data refresh
beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
for (i = m_inputPointList.count() - 1; i >= 0; --i)
{m_inputPointList.removeAt(i); } endRemoveRows(); beginInsertRows(QModelIndex(), 0, loopCnt-1); for(i = 0 ; i < loopCnt; ++i){ ...... m_inputPointList.append(point); } endInsertRows();
-
nondisplay
beginRemoveRows(QModelIndex(), 0, rowCount() - 1);
for (i = m_inputPointList.count() - 1; i >= 0; --i)
{m_inputPointList.removeAt(i); } endRemoveRows();
-
-
-
@cheezus we've confirmed that there is not memory leak on c++ side.
can you tell me how to attach files.
the sample source is listed folloing.
please tell me the reason of leak.MyTableView.qml
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import ...MyItem {
id: myTableView/* テーブルビュー */ property QtObject tableViewStyle: QtObject { //common property real opacity: 1.0 property int fontPixelSize: Style.basicFont.pixelSize property int leftMargin: 8 property int rightMargin: 8 //header property int headerBorderWidth: 0 property int headerInsideBorderWidth: 1 property color headerInsideBorderColor: Style.basicColorStyle.gray5 property color headerBgColor: Style.basicColorStyle.darkblue property int headerRowHeight: 28 property color headerFontColor: Style.basicColorStyle.white //body property color bodyBgColor: Style.basicColorStyle.white property color bodyBgStripeColor: Style.basicColorStyle.peerblue property color bodySelectedBgColor: Style.basicColorStyle.lightblue property int bodyRowHeight: 30 property int bodyBorderWidth: 1 property color bodyBorderColor: Style.basicColorStyle.gray2 property color bodySelectedBorderColor: Style.basicColorStyle.blue property int bodyInsideBorderWidth: 1 property color bodyInsideBorderColor: Style.basicColorStyle.gray3 property color bodyFontColor: Style.basicColorStyle.black property color itemBgColor: "transparent" //drag property color dropAreaColor: Style.basicColorStyle.lightblue property color dropAreaBorderColor: Style.basicColorStyle.vividblue property int dropAreaBorderWidth: 2 } property Component customItemDelegate: null property var displayItem: null property bool dragDropEnable: false property string dropKey: "dropKey" property bool resizeable: false property bool verticalScroll: false property var expansionTitle: null /* 一ページに表示可能の最大行数、verticalScroll=false時無視する */ property int showRowCount: 10 property alias currentRow: tableView.currentRow readonly property alias rowCount: tableView.rowCount property alias onfocus: tableView.focus /* 上位エレメントへ通知 */ signal rowMoved(int from, int to); signal rowSelected(int rowIndex); enabled: displayItem === null ? true : displayItem.enabled visible: displayItem === null ? true : displayItem.visible property int resizeColIndex: 0 property real resizeColBasicWidth signal resizeColumnWidth(real addWidth) onResizeColumnWidth: { if(resizeable === true) { if(tableView.isExistColumn(resizeColIndex) === true && tableView.getColumn(resizeColIndex).width + addWidth > myTableView.resizeColBasicWidth) { tableView.getColumn(resizeColIndex).width += addWidth; } } } function addColumn(column) { return tableView.addColumn(column); } function insertColumn(index, column) { return tableView.insertColumn(index, column); } /* 指定する行をテーブルの先頭に表示する。 */ function positionTableRowAtTop(row) { //rowは-1より大きい、かつ、TableViewの行数より小さいの場合は、 //パラメータrowで指定したテーブル行をmyTableViewの先頭に表示する。 if(row > -1 && row < tableView.rowCount) { tableView.positionViewAtRow(row,ListView.Beginning); } }