What is your code for itemChanged()?
What is your code for itemChanged()?
Same as in 'ElasticNode' example.
which doesnt get called for Release version I am using QT 4.5.1. & Visual Studio 2008 on Windowz XP.
Qt Code:
{ switch (change) { case ItemPositionHasChanged: foreach (Edge *edge, edgeList) edge->adjust(); graph->itemMoved(); break; default: break; }; }To copy to clipboard, switch view to plain text mode
Last edited by wysota; 7th April 2010 at 09:14. Reason: wrong bbcode tag usage
And how do you know it doesn't get called?
I have put some std::cout << "\nItemPositionHasChanged"; in this function, which doesnt get print in case of Release version but for Debug version it gets print.
Does any other std::cout get printed throughout your application in release mode? Did you remember to flush the stream (i.e. with std::endl)?
ya, other std::cout gets print. but as it seems event is not getting called I am not able to see the ItemPositionHasChanged string.
Also as I have lot of rectagle getting drawn. so to improve performance initially I am drawing filled rect without border and then after some LevelOfDetails I am drawing border.
the codei s below
Qt Code:
// Paints the item. void RectItem :: paint(QPainter * painter, QStyleOptionGraphicsItem const * option, QWidget * widget) { Q_UNUSED(widget); painter->setPen(Qt::black); painter->setBrush(brush); if (option->levelOfDetail > 2.) painter->drawRects(&squareRect, 1); else painter->fillRect(squareRect, brush); }To copy to clipboard, switch view to plain text mode
But above code also seems not working for Release version. I am not able to see border after zoom-in operations when levelOfDetails > 2.
its very strange as same code works in Debug version.
Last edited by nileshsince1980; 7th April 2010 at 10:28.
Please use proper bbcode tags in your posts.
Make sure that you are actually running the right binary (i.e. that it has been rebuilt with your changes). It's not possible that an arbitrary method is called in debug mode and ignored in release mode.
Ho Wysota,
I am too feeling the same way as you. I have tried cleaning and rebuilding the app. , checking the lib. for Debug/Release version. But nothing seems worked.
If possible Can you just try to compile 'ElasticNode' example from Sample Code of QT 4.5.1 with VS2008 on Windows XP and see this effect.
Thanks in advance.
I don't use VS2008 but the compiler is really irrelevant here. The elastic nodes example works fine and that's the sufficient proof that the method gets called.
nileshsince1980 (8th April 2010)
This is just a wild guess, but could it be that the release version of your program version loads the 4.6 Qt dlls at runtime? That would explain the effect. Check your paths or debug the release version in MSVC and check the output pane.
EDIT:
This also explains the problems with levelOfDetails, because this variable isn't set anymore in 4.6.
There were some major performance tweaks of the Graphics View Framework between 4.5 and 4.6 and the Qt developers decided to change the default behaviour to "Don't pay for what you don't use". This means that any code relying on items sending updates of their position, or using levelOfDetail will not work as expected with the 4.6 dlls.
Last edited by spud; 7th April 2010 at 13:43.
nileshsince1980 (8th April 2010)
Hi All,
Thanks for your suggestion.
After taking lot of trial and error, I have got the solution of this Release version problem. On my computer, whenever I use to run 'ElasticNodes' example from QtDemo.exe then it runs fine & when I run that same exe ('ElasticNodes') from clicking on it from Windows Explorer it is not running as per expected.
So when I copied my QT app's exe into Qt's bin folder & then executes from bin dir. then it runs fine. So I changed PATH variable & set QT's bin dir. path at very first position (i.e. PATH=C:\Qt\bin; %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\Sy stem32\Wbem;<other paths> ). Now it works fine.
It might be because of some Release version DLLs clashing with other path’s present in PATH variable.
Last edited by nileshsince1980; 8th April 2010 at 06:33.
Hi All
I got the exact cause for Release version. I had installed MIKeTex 2.8 which intern installs Qt's some Dlls ( I dont know how ? but the DLLs are find in MIKTEx2.8 bin's dir. are QtCore4.dll, QtGui4.dll, QtScript4.dll, QtXml4.dll) into its bin folder. and in my PATH variable MIKTex2.8's bin dir. path is stored before QT's bin dir. path.
So for Release version my QT app used to take DLLs from MIKTex2.8's bin dir rather than QT's bin dir.
Thanks,
Nilesh
Bookmarks