This is a libqxt bug that you should report. The following code shows the problem:
#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"
#include <QtGui>
#include <QDebug>
#include <QxtCsvModel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QxtCsvModel m("test.csv");
QTableView v;
v.setModel(&m);
v.show();
qDebug() << "Before:" << m.columnCount();
m.insertColumn(2);
qDebug() << "After: " << m.columnCount();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
QT += sql
CONFIG += qxt
QXT += core
# Input
SOURCES += main.cpp
TEMPLATE = app
TARGET =
DEPENDPATH += .
INCLUDEPATH += .
QT += sql
CONFIG += qxt
QXT += core
# Input
SOURCES += main.cpp
To copy to clipboard, switch view to plain text mode
test.csv:
0,1,2,3,4,5
0,1,2,3,4,5
0,1,2,3,4,5
0,1,2,3,4,5
0,1,2,3,4,5
0,1,2,3,4,5
0,1,2,3,4,5
0,1,2,3,4,5
To copy to clipboard, switch view to plain text mode
Output:
Before: 6
After: 7
Before: 6
After: 7
To copy to clipboard, switch view to plain text mode
but 8 columns are visible in the QTableView after the insertColumns() call.
Bookmarks