![]() Registered Member ![]()
|
I am trying to add a tree view to my configuration dialog but trying to add a model to it crashes the plasmoid.
http://doc.qt.nokia.com/4.6/itemviews-s ... model.html I am using that as a reference... pretty much after failing with my own implementation I'm trying to get their one working first before making changes... I have:
default.txt:
Any help is greatly appreciated. |
![]() Administrator ![]()
|
Have you tried using gdb to trace where the crash occurs?
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Sorry, I'm new to KDE/Linux programming; how do I debug the plasmoid? (It isn't an executable itself is it?)
|
![]() Administrator ![]()
|
You can use the following procedure to debug the Plasmoid. First start gdb.
Then, start Plasmoidviewer, loading your plasmoid. Type at the gdb prompt:
When it crashes, the gdb prompt should be returned to you. Enter "bt" to generate a backtrace, and post that here. Then enter "quit" to close gdb, and plasmoidviewer.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Thanks, I couldn't find how to do it on the Internet.
|
![]() Administrator ![]()
|
Try creating your model as follows:
And change
To
Which should fix it. The problem is that the Model is being deleted immediately before the setModel call is made, hence causing it to crash. It is being deleted by compiler automatic garbage cleanup because it is created local to this function, and is no longer used after this function.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
I did that but it still Seg Faults, but calling a function from model is fine, i.e.:
I also tried making model a member but same Seg Fault, just gdb can't pin down where it happens then. |
![]() Administrator ![]()
|
Is m_settingsMenu created automatically from a *.ui file?
If so, you need to create it first.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Ah, ok. Yes it is.
Changed it but it still Seg Faults... :/
|
![]() Administrator ![]()
|
Can you please send me the full sources so I can try to debug it? You can find my address on my profile page.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
|
![]() Administrator ![]()
|
Thanks. Don't know why the profile page refuses to show my email address.. i'll have to investigate that.
In any case, please find the fixed sources attached to this post. The issue was caused by the Model incorrectly checking that the parent was valid. I also fixed CMakeLists.txt to generate the *.ui file header automatically.
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
![]() Registered Member ![]()
|
Thanks very much. It's weird going from .NET/C#/Java programming to KDE/Qt and having very little tutorials and the like to reference.
|
Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]