1 Attachment(s)
how coult this happen with the QTableView Column insert?
i have a slot function on insert a column with the qtableview,and the colde are bleow,i use the libqxt csvmodel function;:
Code:
void PFDataGrid::insertColumn(int columnNumber)
{
QxtCsvModel *csvModel=(QxtCsvModel*)(this->model());
csvModel->insertColumn(columnNumber);
}
but when i insert a column ,there is always will insert a column at the end ,can't be edit ,and the first column did't have column number ,can anyone help my ,i will be appreciate itAttachment 5599
Re: how coult this happen with the QTableView Column insert?
What value does columnNumber have? Does insertColumn() return true or false?
Re: how coult this happen with the QTableView Column insert?
Code:
void PFDataGrid::insertColumn(int columnNumber)
{
QxtCsvModel *csvModel=(QxtCsvModel*)(this->model());
bool success=csvModel->insertColumn(columnNumber);
}
it returns true;and i use qDebug()<<"column count:"<<columnCount();the columns' count did add
Re: how coult this happen with the QTableView Column insert?
What value does columnNumber not columnCount() have? Clearly the columnCount is increasing but you are claiming the new column is not where you think it should be.
Please put [code] tags around your code. It is one of the # tools on the tool bar.
Re: how coult this happen with the QTableView Column insert?
after i call the insertColumn(int columnNumber) function ,it will add a column at the end of the tableview ,and it can't be edit ,but also it will insert a column before the place i inserted,and the column did't have a column header,the header is blank
Re: how coult this happen with the QTableView Column insert?
This is a libqxt bug that you should report. The following code shows the problem:
Code:
#include <QtGui>
#include <QDebug>
#include <QxtCsvModel>
int main(int argc, char *argv[])
{
QxtCsvModel m("test.csv");
v.setModel(&m);
v.show();
qDebug() << "Before:" << m.columnCount();
m.insertColumn(2);
qDebug() << "After: " << m.columnCount();
return app.exec();
}
#include "main.moc"
Code:
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
QT += sql
CONFIG += qxt
QXT += core
# Input
SOURCES += main.cpp
test.csv:
Code:
0,1,2,3,4,5
0,1,2,3,4,5
0,1,2,3,4,5
0,1,2,3,4,5
Output:
but 8 columns are visible in the QTableView after the insertColumns() call.
Re: how coult this happen with the QTableView Column insert?
ok ,i will report this bug to the LibQxt team