On 27 November 2016 at 07:40, Thiago Macieira <thiago.macie...@intel.com> wrote: > On sábado, 26 de novembro de 2016 21:58:03 PST Ch'Gans wrote: >> So my code is build using the same gcc, but behave differently >> depending on the qt libraries (qt-5.6-official gives different result >> than qt-6.6-ubuntu). >> And more disturbing, linking against qt-5.5-official gives different >> behaviour than when linking against qt-5.6-official... > > Of course. There's a new feature in QVariant and the metatype system relating > to enums. So it's going to work on the newer versions but not on older ones. > > That said, the information I can find indicates the feature was introduced in > 5.5. So it should have worked on all of your tests. Conclusion: the problem is > not where you're looking. > > Please attach a simple[*] testcase so we can investigate further. > > [*] simple is: a single .cpp file, less than 200 lines of code, that compiles > and is self-sufficient. No need to attach the .pro file.
I think i have it (monitoring QStandardItemModel::dataChanged signal), see attached source file (40 lines! ;)). Hopefully I'm not doing something stupid... Output with KUbuntu 16.10, Qt 5.6: Data changed QVariant(int, 2) Qt::CheckState(Unchecked) Data changed QVariant(int, 0) Qt::CheckState(Unchecked) Output with Official Qt 5.5 for Linux: Data changed QVariant(int, 2) Qt::CheckState(Unchecked) Data changed QVariant(int, 0) Qt::CheckState(Unchecked) Output with Official Qt 5.6 for Linux: Data changed QVariant(int, 2) Qt::CheckState(Checked) Data changed QVariant(int, 0) Qt::CheckState(Unchecked) Output with Official Qt 5.7 for Linux: Data changed QVariant(int, 2) Qt::CheckState(Checked) Data changed QVariant(int, 0) Qt::CheckState(Unchecked) Chris > -- > Thiago Macieira - thiago.macieira (AT) intel.com > Software Architect - Intel Open Source Technology Center > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > http://lists.qt-project.org/mailman/listinfo/interest
#include <QApplication> #include <QDebug> #include <QListView> #include <QMainWindow> #include <QStandardItemModel> #include <QStandardItem> class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow(QWidget *parent = 0): QMainWindow(parent) { setCentralWidget(&m_view); m_view.setModel(&m_model); auto item = new QStandardItem; item->setCheckable(true); item->setText("Item0"); m_model.appendRow(item); connect(&m_model, &QStandardItemModel::dataChanged, this, [this](const QModelIndex &tl, const QModelIndex &br, const QVector<int> &roles) { qDebug() << "Data changed" << m_model.data(tl, Qt::CheckStateRole) << m_model.data(tl, Qt::CheckStateRole).value<Qt::CheckState>(); }); } ~MainWindow() {} QStandardItemModel m_model; QListView m_view; }; int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } #include "main.moc"
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest