Qt DevDays 2006 Example Code
At Qt Developer Days 2006, Scott Bloom working with Bo Thorsen of Thorson Consulting gave a talk about model-view programming with Qt 4. This is the source code for the examples.
This code is licensed as public domain, and you are free to use them in whatever way you want to.
Free Qt Classes
All programmers have a set of useful tools. When we find something that could be of general value, we will publish them here. For now
These classes are licensed as public domain (unless otherwise specified), so you are free to use them for whatever you want. But we obviously hope that you will send us patches, should you improve on them.
None of these sources come fully tested. It might very well be that there are bugs here. If you find one, you can fix it and send the patch, or try sending a mail that describes the problem. We give no guarantee at all on this code. Use it at your own risk.
The sources can be built as a static library, or you can copy them into your own tree. You need Qt 4 to use these classes.
Natural String Compare
This funcion provides a string compare methodology that enables complex strings to be compared by a natural sorting algorithm. It fits seemlessly into the QT3 (though some minor tweaks might be necessary) QListViewItem system, as well as the QT4 Model/View architecture.
Natural String comparison allows for strings with numbers embedded to be sorted by the numeric value, not the "ascii" value of the numbers.. For instance, the strings 200 vs 21. Using normal ascii comparison, 200 is less then 21, when its clearly not.
Update:The code base has been updated to include functionality to make it easier to sort QStringList data using the NaturalSort method
QDate/QTime debugging addins for Dev Studio 2003/2005
Zip File
QDate/QTime debugging addins for Dev Studio 2003/2005
This zip file contains multiple items, the DLL named OnShoreCSDbgEE.dll.
It also contains the project file used to create the system. Note, QMake was NOT used. Meaning, if your QT version that you use is differnent then mine, you have to manually modify the project file.
In order to install, you need do two things.
Copy the DLL to $DEVENVDIR (for me thats C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\)
Modify your autoexp.dat and add the following lines
; OnShoreCS START
QDate =$ADDIN(OnShoreCSDbgEE.dll,_OnShoreCSDbgEE_QDate@28)
QTime =$ADDIN(OnShoreCSDbgEE.dll,_OnShoreCSDbgEE_QTime@28)
QDateTime =$ADDIN(OnShoreCSDbgEE.dll,_OnShoreCSDbgEE_QDateTime@28)
; OnShoreCS END
After the ;QT_DEBUG_END
in your file.
autoexp.dat can be found in $DEVENVDIR/../Packages/Debugger (for me C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\Debugger)
Restart your debugger, and it should work... Contact me if you have any questions or issues
Feel free to use this code in any way you want, if you get QDateTime working please let me know!
QDate/QTime debugging addins for Dev Studio 2008
Zip File
QDate/QTime debugging addins for Dev Studio 2008
This zip file contains multiple items, the DLL named OnShoreCSDbgEE.dll.
It also contains the project file used to create the system. Note, QMake was NOT used. Meaning, if your QT version that you use is differnent then mine, you have to manually modify the project file.
In order to install, you need do two things.
Copy the DLL to $DEVENVDIR (for me thats C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\)
Modify your autoexp.dat (mine was located in C:\Program Files\Microsoft Visual Studio 9.0\Common7\Packages\Debugger) and add the following lines
Note, the current integration from Nokia, includes QTime functionality, however I left mine in for an example. If you want to use it, you have to comment out the Nokia code (search for QTime int he autoexp.dat file)
; OnShoreCS START
QDate =$ADDIN(OnShoreCSDbgEE.dll,_OnShoreCSDbgEE_QDate@28)
QTime =$ADDIN(OnShoreCSDbgEE.dll,_OnShoreCSDbgEE_QTime@28)
QDateTime =$ADDIN(OnShoreCSDbgEE.dll,_OnShoreCSDbgEE_QDateTime@28)
; OnShoreCS END
After the ;QT_DEBUG_END in your file.
Also, in the section where you find QVariant, you can add this section for QDateTime
; posted to qt-interest from julien.cugniere at gmail.com
; The debugger has trouble accessing QDateTimePrivate, so we have to cheat.
; The class looks like this (Qt 4.5) :
; class QDateTimePrivate {
; QAtomicInt ref;
; QDate date;
; QTime time;
; ...
; };
; This visualizer assumes the class members are tighly packed.
QDateTime{
preview(
#(
*(QDate*)(((char*)$e.d) + sizeof(QAtomicInt)),
" ",
*(QTime*)(((char*)$e.d) + sizeof(QAtomicInt) + sizeof(QDate))
)
)
children
(
#(
[QDate]: *(QDate*)(((char*)$e.d) + sizeof(QAtomicInt)),
[QTime]: *(QTime*)(((char*)$e.d) + sizeof(QAtomicInt) + sizeof(QDate))
)
)
}
Restart your debugger, and it should work... Contact me if you have any questions or issues
Feel free to use this code in any way you want, if you get QDateTime working please let me know!