Registered Member
|
Hi all
After a couple of years, I am preparing to write software again. It's gonna be a scientific app for room acoustics analysis. So I brushed up my rusty knowledge on C++ and am now looking to get familiar with KDevelop. So, I thought, I' find myself some tutorials and/or examples. I am trying to follow them on my system, which is as follows: OpenSUSE Leap 15.3, up to date as of Feb. 23rd 22 Kdevelop from official suse repo, version 5.6.1, KDE Frameworks 5.76.0, Qt 5.12.7 (compiled against 5.12.7), The xcb windowsystem PC is i5 4790s, 32 GB Ram One example is this one: https://userbase.kde.org/Build_your_first_KDE_application_on_Kubuntu#3._Create_a_basic_KDE_Application_using_an_existing_template.
I did as instructed, but instead of "Project -> New From Template -> Qt -> Graphical -> C++ KDE Framework", I choose "Project -> New From Template -> Qt -> Graphical -> KParts Program". Then I had to give it a name "KPart", selected Git as versioning soft and finished. I had to set up a build directory "/home/users/seuchato/projects/KPart/build", I choose to omit setting other options and clicked on OK. Beuatiful C++ code is generated and displayyed nicely in the code window :-). I was pleased! In the build tab the following messages appeared:
I hit "execute" on top, Kdevelop prompts me to select/edit a start configuration (what is that really for?). I hit on KPart, apply and OK : nothing! So again, but this time I select "KPart" again and click on "src/shel/kpart" , it adds "kpart" and "debug", in the "kpart" there is "program file "KPart/src/shel/kpart". Furthe the action is set to build. Again, I click apply and OK. It compiles and links:
then a message pops up: "Could not find KPart part!" (would have loved to add a picture ere, but cannot figure out how to do this using the form editor) I click on OK and an empty window with the name KPart appears. It has all the basic decorations in the title bar, but no specific application menu, dialog elements or whatever other gui elements it should show imho. (again, a picture would be nice to emphasize what I mean). So, what went wrong? I switch to "~/projects/KPart/build/src/shell" and there is the executable "kpart", I initiate with "./kpart" and get
on the terminal, the mentioned message dialog "Could not find KPart part!", clicking OK, the empty program window appears again. Trying to get rid of the dialog I add "#include "kpartpart.h"" in "main.cpp". KDevelop adds (in red) it cannot find that file. So I need to set the include paths correctly. I choose "project/Settings" and a dialog pops up. Under "Language support" I add "/home/users/seuchato/projects/KPart/src/part", I apply and leave with OK.
So it still does not find "kpartpart.h", I alter "kpartpart.h" to "#include "../part/kpartpart.h" and the red warning disappears. I hit build again, no errors. I run the app again, same same but different:
The line starting with "qt.qpa.xcb:" is new. So, questions: [*]how can I omit this: kf.xmlgui: cannot find .rc file "kpartui.rc" for component "kpart" [*]why is "kpartpart.h" not found despite include path set correctly? [*]how can I omit "qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 725, " [*]how can I ad/attach files here? I would be happy to get answers to above questions, chocolate up as a reward :-) greez chris |
Registered Member
|
Hi
Figured out howto make the KParts App work: First the "start configuration" needs to be altered: the "Action" has to be "build and install", not only "build" Then, hitting shift-F9, I got this:
The key is here: " file INSTALL cannot copy file" ... to "/usr/lib64/qt5/plugins/kpartapppart.so": Permission denied. Checking permissions for /usr/lib64/qt5/plugins:
... makes it obvious: ordinary users do not have write permissions to /usr/lib64/qt5/plugins, which I believe is correct. So, in order to test, I copied as root kpartapppart.so to /usr/lib64/qt5/plugins. Now KPartsapp starts and shows the editor as expected. However, that cannot be the way to do this! So, I deleted kpartapppart.so in /usr/lib64/qt5/plugins again and did:
altered the "start configuration" back to "build" and triggered shift-F9 et voila: now the KPartsApp starts even from within KDevelop! Greez chris |
Registered Member
|
Hi,
Glad You found the solution. However, I suggest doing one of the following instead: 1. In Your kpartshell.cpp when doing instantiatePlugin, instead of the "kf5/parts/kpartpart" just put "kpartpart". You don't need to do "build and install" when doing this. Only "build" is enough. 2. Add environment variable "KDE_INSTALL_PLUGINDIR" in your config and put your build folder path there. I suggest the first solution for easier build/debug sessions, but the second one is probably the correct way to do it. Overall, it's a bad practice to copy or work in /usr/lib even if You are working with Your own libraries. Hope this cleared things a little. Kind regards |
Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]