Qt 5.3.1 TableView not updating - qt

Recently I upgraded from Qt 5.3.0 to Qt 5.3.1 and noticed that my TableView's which use a QSortFilterProxyModel as their model no longer update when I sort the proxy model.
You can see this in action by using the sample code here!
If you compile it with Qt 5.3.0 the table will sort but if you compile it with Qt 5.3.1 the model will sort (verified with qDebug statements) but the TableView will not update. This happens on both Windows and Linux.
To get around it I had to add emit layoutChanged() after I call this->sort().
My question is has anyone else noticed this and found out if this is by design or is a defect.
Thanks

I did a little more digging and I found a Qt bug filed for exactly this issue. QTBUG-40035 TableView, Sort doesn't work.
Turns out in Qt 5.3.1 another bug was resolved QTBUG-37983 which changed the QQMLDelegateModel to emit layoutChanged( QList, QAbstractItemModel::LayoutChangedHint) instead of simply emitting layoutChanged(). The TableView does not seem to be listening to the parameratized version of the layoutChanged() signal which is why I can fix this by manually emitting layoutChanged() after I call sort().
This apparently has been fixed by QTBUG-39492 in Qt 5.3.2

Related

How to view QString values in debugger with Qt 5.5.1

Does anyone know how to view QString values in the debugger for Qt 5.5.1 (QtCreator 5.3.1)?
I have tried various things found online, from enabling/disabling GDB pretty printer, display QString format etc. Nothing seems to work.
(Compiler - MSVC 2013 - 32 bit)
Edit- image:
Many thanks,
Michael
I have encountered the same problem. And I find the solution.
My Qt is 5.9.2. IDE is Qt Creator 4.3.1.
Click Tools->options->Debugger->Local & Expresions->Use Debugging Helper.
I believe you can use the QString::data() function or data_ptr pointer in your QString class.
This was a bug in QT Creator 3.5.1. when webengine was linked to the project (for some reason)
Fix is in Qt Creator 3.6.1. Details are here: https://bugreports.qt.io/browse/QTCREATORBUG-15580

Qt Creator crashes loading Examples

There is an Example tab at the Qt Creator(2.6.1)'s Welcome page, which is supposed to show the already made Qt Project Examples. But whenever I click on that, Qt creator closes automatically. Sometimes it shows the Example projects for 1 or 2 seconds and the exits. Any idea?
You probably need to configure Qt Creator to find your Qt installation.
Compiler configuration for Qt Creator
And you might need to get the msvs compiler, too.
http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products
They now have the mingw version available for windows with Qt 5.0.2.
http://qt-project.org/downloads
Also if you installed Qt without the examples that may also cause this error.
Hope that helps.

Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()

Whenever I use OpenCV's cv::imshow alongside with Qt's QApplication, I get this error:
Gtk-WARNING **: gtk_disable_setlocale() must be called before gtk_init()
I did some searching and ended up reading more and more about stuff I don't fully understand, but got some ideas how OpenCV and GTK+ are connected. And since the warning is obviously an instruction to call something before something, I included gtk.h and called gtk_disable_setlocale(), but ended up with even more errors.
My code runs despite the warning without any problem, but it really bugs me! And I assume that behind the warning, there are some essential stuff a programmer should understand. So maybe somebody can explain the whole thing in a way an advanced newbie can understand? ;)
Edit:
I'm using ubuntu 12.10, OpenCV 2.4, GTK 2.24.13 and qmake -v tells me
QMake version 2.01a
Using Qt version 4.8.3 in /usr/lib/x86_64-linux-gnu
If you are going to use Qt windowing system, it's best to avoid creating OpenCV windows alongside with Qt windows.
Convert IplImage or cv::Mat to QImage and draw that on a Qt window. Check cvImage, a simple Qt/OpenCV example that displays an image loaded with OpenCV on a Qt window, and also shows the RGB values of a pixel based on mouse coordinates.

Adding Qt Sources to QtCreator 2.4.1

I am currently using QtCreator 2.4.1 with Qt 4.7.4 development libraries (in Ubuntu) and am trying to track down a bug which after profiling with valgrind seems to occur internally within QGraphicsView::paintEvent(…) method
To help isolate this problem I would like to step into the Qt sources. Having done some searching through both the Qt forums and stack overflow and have not being able to find a way to integrate the sources with my version of QtCreator.
I have currently tried downloading the sources via the QtSDK manager and adding a “Source Path Mapping” within Tools->Options->Debugger. I am sure that this step is where I am making a mistake as I am unable to even switch to source when viewing internal Qt header files i.e. from QGraphicsView.h
I have so far tried adding the following Source Path Mappings
Source Path=/var/tmp/qt-src
TargetPath=/home/paul/QtSDK/QtSources/4.7.4
and
Source Path=/var/tmp/qt-src
TargetPath=/home/paul/QtSDK/QtSources/4.7.4/src
Neither works.
I have also tried building Qt directly from source, adding this to my "Qt versions" list within Qt Creator and creating a new project configuration using this version. This also did not work.
Likewise I have tried adding the src folders to my gdbinit file. This also fails to work.
I am completely lost with this.
Paul
Someone asked a similar question here: Need to step into Qt sources (my IDE is Qt Creator).
Someone else asked about Valgrind errors with Qt here: Suppression files for Qt memory leaks with Valgrind
And here is a little more info about Using Valgrind with Qt Creator along with some explanation about how to read the results. Its a little dated from late 2010.
Related Suggestions
I wouldn't debug the QGraphicsView class just because of all the effort to make it work or find the problem might be for nothing... Qt is moving to using the SceneGraph as the backend for QML and the rendering engine for QGraphicsView might become obsolete.
Updating to the latest stable build of the Qt libraries may make a big difference for QGraphicsView.
If you post the valgrind error you are getting to the Qt Trolls, someone might be able to explain what is going on for you.
There are other debugging techniques besides the traditional debugger. I've been programming in Qt in Windows (without valgrind) and with a large multi-threaded application, that loads a bunch of Dll's. I've had to put some faith into the Object Tree Model clean up and work on all the new calls I put in. Most of the time I just use QDebug to find errors. Then I am also using a combination of qInstallMessageHandler() with QDebug to implement decent logging for the hard to track bugs.
See also Qt Debugging Techniques.

QLineEdit onVisible() causes crash in debug in QT

I'm using Qt 4.7.0 (32 bit) on Windows(mingw32).
The app is crashing when setVisible(),setDisabled(),hide() and show() are called. Official documentation, forums and google haven't helped so far. The QLineEdit variable is declared in the xml (passwordEdit).
The crash occurs only in debug mode, not in release mode.
ui->passwordEdit->setVisible(false);
The app was crashing because I was updating widgets' visibility and other properties from another thread. I didn't realize you have to do it from within the GUI thread. Using postEvent solved the problem.

Resources