This forum has been archived. All content is frozen. Please use KDE Discuss instead.

using template for new project

Tags: None
(comma "," separated)
User avatar
tinosezc
Registered Member
Posts
14
Karma
0
OS

using template for new project

Thu May 16, 2013 10:56 am
Using linux arch, qt 4.8

I use kdevelop for many years. From last update 15/05 i got several problem with project template.

using qt I create new project with template kde --> kgraphical

Source is a bit different from the past in this position

--->>>#include <QtDeclarative/QDeclarativeView>
--->>>#include <QtDeclarative/QDeclarativeProperty>
--->>>#include <QtDeclarative/QDeclarativeItem>

KGraphicalTestView::KGraphicalTestView(QWidget *)
{
view = new QDeclarativeView(this);
--->>> view->setSource(QUrl::fromLocalFile(KStandardDirs::locate("data", "kgraphicaltest/src/qml/main.qml")));
--->>> kcfg_sillyLabel = view->rootObject();
@@@@--->>> kcfg_sillyLabel->setProperty("width", width());
--->>> QDeclarativeProperty(kcfg_sillyLabel, "width").write(width());
kcfg_sillyLabel->setProperty("height", height());
QDeclarativeProperty(kcfg_sillyLabel, "height").write(height());
QObject::connect(kcfg_sillyLabel, SIGNAL(clicked()),
qApp, SLOT(quit()));
view->show();
settingsChanged();
}

build project

when running project crash on point @@@@, where the file "......" is not found

I think there is a mix of qt4 and qt5, but how to solve it ?

thanks
tino
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: using template for new project

Sat May 18, 2013 11:30 pm
It looks to me like those are source code merge conflict markers.
Assuming you did not add the "--->>>" or "@@@@--->>>" please remove those and try again.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
tinosezc
Registered Member
Posts
14
Karma
0
OS

Re: using template for new project

Tue May 21, 2013 10:36 am
bcooksley wrote:It looks to me like those are source code merge conflict markers.
Assuming you did not add the "--->>>" or "@@@@--->>>" please remove those and try again.



I put marking to signal the "bad" point.

They do not exist !

Tino
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: using template for new project

Tue May 21, 2013 10:52 am
My guess would be that your project is not being installed in the paths which KDE applications (including your project/app) search for their materials.
This is done in:
Code: Select all
view->setSource(QUrl::fromLocalFile(KStandardDirs::locate("data", "kgraphicaltest/src/qml/main.qml")));

If you run "export KDEDIRS=$(kde4-config --prefix):/path/to/install/dir" prior to trying to start your application, does that have any effect?
You will need to change "/path/to/install/dir/" to where you are installing your project (which is necessary for this to work).


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
tinosezc
Registered Member
Posts
14
Karma
0
OS

Re: using template for new project

Thu May 23, 2013 9:21 am
If you run "export KDEDIRS=$(kde4-config --prefix):/path/to/install/dir" prior to trying to start your application, does that have any effect?
You will need to change "/path/to/install/dir/" to where you are installing your project (which is necessary for this to work).


I have always problem to understand "/path/to/install/dir", is this for project or for KDE ?

anyway I made this
$ set |grep KDEDIRS
KDEDIRS=/usr:/workarea/projects

I prune the project and rebuild

this is the execute result:

Starting: /workarea/projects/KGraphicalTest/build/src/kgraphicaltest
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
file:///workarea/projects/KGraphicalTest/build/src/: File not found
KCrash: Application 'kgraphicaltest' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
*** Exited with return code: 253 ***
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: using template for new project

Thu May 23, 2013 11:49 am
The "installation directory" i'm referring to is where your project is installed - building it is not sufficient.
You can specify where to install it at configure time, using the "-DCMAKE_INSTALL_PREFIX=/install/location" argument - replacing "/install/location" with the path where you want the application to be installed. Once built, you need to run "make install" to perform the installation to that location.

An example would be "/workarea/installs/" for instance.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
tinosezc
Registered Member
Posts
14
Karma
0
OS

Re: using template for new project

Tue May 28, 2013 9:52 am
Thank bccoksley,

I try to follow yours suggestions without success.

first of all I check CMakeCache.txt on the build directory "../workarea/projects/KGraphicalTest/build"
that is:

//Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=/usr/local

then I make these actions on the konsole inside KDEVELOP:

![~]$ export KDEDIRS=$(kde4-config --prefix):/workarea/projects/KGraphicalTest/build:/usr/local/bin


obtainig this
Code: Select all
![~]$ set |grep KDE
KDEDIRS=/usr:/workarea/projects/KGraphicalTest/build:/usr/local/bin
KDEV_ATTACHED_PID=2828
KDEV_BASEDIR=/usr/bin
KDEV_DBUS_ID=org.kdevelop.kdevelop-2828
KDEV_SHELL_ENVIRONMENT_ID=default
KDE_FULL_SESSION=true
KDE_MULTIHEAD=false
KDE_SESSION_UID=1000
KDE_SESSION_VERSION=4
XDG_CURRENT_DESKTOP=KDE
_=KDEDIRS
    TARG=$(qdbus $KDEV_DBUS_ID /org/kdevelop/ProjectController org.kdevelop.ProjectController.mapSourceBuild "$(pwd)" false);
    qdbus $KDEV_DBUS_ID /org/kdevelop/GrepViewPlugin org.kdevelop.kdevelop.GrepViewPlugin.startSearch "$PATTERN" "$LOCATION" false
    local ENV_ID=$KDEV_SHELL_ENVIRONMENT_ID;
        if [ "$ID" == "$KDEV_SHELL_ENVIRONMENT_ID" ]; then
    RESULT=$(qdbus $KDEV_DBUS_ID /org/kdevelop/ExternalScriptPlugin org.kdevelop.ExternalScriptPlugin.executeCommand "$CMD" "$WD");
    RESULT=$(qdbus $KDEV_DBUS_ID /org/kdevelop/ExternalScriptPlugin org.kdevelop.ExternalScriptPlugin.executeCommandSync "$CMD" "$WD");
    qdbus $KDEV_DBUS_ID /org/kdevelop/DocumentController org.kdevelop.DocumentController.activeDocumentPath $@
    local ENV_ID=$KDEV_SHELL_ENVIRONMENT_ID;
    qdbus $KDEV_DBUS_ID /org/kdevelop/DocumentController org.kdevelop.DocumentController.activeDocumentPaths
    if [ "$KDEV_SSH_FORWARD_CHAIN" ]; then
        echo "KDEV_SSH_FORWARD_CHAIN=\"$KDEV_SSH_FORWARD_CHAIN,$HOST\"";
        echo "KDEV_SSH_FORWARD_CHAIN=$HOST";
    echo "$(qdbus $KDEV_DBUS_ID /kdevelop/SessionController org.kdevelop.kdevelop.KDevelop.SessionController.sessionDir)"
    echo "$(qdbus $KDEV_DBUS_ID /kdevelop/SessionController org.kdevelop.kdevelop.KDevelop.SessionController.sessionName)"
    while ! $KDEV_BASEDIR/kdev_dbus_socket_transformer $FORWARD_DBUS_FROM_PORT ${DBUS_ABSTRACT_SOCKET_TARGET_BASE_PATH}-${DBUS_ABSTRACT_SOCKET_TARGET_INDEX} --bind-only; do
    $KDEV_BASEDIR/kdev_dbus_socket_transformer $FORWARD_DBUS_FROM_PORT $PATH &
    while ! $KDEV_BASEDIR/kdev_dbus_socket_transformer $DBUS_FORWARDING_TCP_LOCAL_PORT --bind-only; do
    $KDEV_BASEDIR/kdev_dbus_socket_transformer $DBUS_FORWARDING_TCP_LOCAL_PORT & return 0
        if [ "$KDEV_SSH_FORWARD_CHAIN" ]; then
                FISH_HOST=$KDEV_SSH_FORWARD_CHAIN;
                    echo "ssh chain is too long: $KDEV_SSH_FORWARD_CHAIN mapping anyway using $FISH_HOST" 1>&2;
    RESULT=$(qdbus $KDEV_DBUS_ID /org/kdevelop/DocumentController org.kdevelop.DocumentController.openDocumentSimple $1);
    RESULT=$(qdbus $KDEV_DBUS_ID /org/kdevelop/DocumentController org.kdevelop.DocumentController.openDocumentsSimple "(" $1 ")");
    TARG=$(qdbus $KDEV_DBUS_ID /org/kdevelop/ProjectController org.kdevelop.ProjectController.mapSourceBuild "$(pwd)" true);
    qdbus $KDEV_DBUS_ID /kdevelop/MainWindow org.kdevelop.MainWindow.ensureVisible
    qdbus $KDEV_DBUS_ID /org/kdevelop/GrepViewPlugin org.kdevelop.kdevelop.GrepViewPlugin.startSearch "$PATTERN" "$LOCATION" true
        KDEV_SHELL_ENVIRONMENT_ID=$1;
    local ENV_ID=$KDEV_SHELL_ENVIRONMENT_ID;
    ssh $@ -t -R localhost:$DBUS_FORWARDING_TCP_TARGET_PORT:localhost:$DBUS_FORWARDING_TCP_LOCAL_PORT " APPLICATION=$APPLICATION            KDEV_BASEDIR=$KDEV_BASEDIR            KDEV_DBUS_ID=$KDEV_DBUS_ID            FORWARD_DBUS_FROM_PORT=$DBUS_FORWARDING_TCP_TARGET_PORT            APPLICATION_HOST=$APPLICATION_HOST            KDEV_WORKING_DIR=$KDEV_WORKING_DIR            KDEV_SHELL_ENVIRONMENT_ID=$KDEV_SHELL_ENVIRONMENT_ID            DBUS_SOCKET_SUFFIX=$(getDBusAbstractSocketSuffix)            $(getSSHForwardOptionsFromCommand "$@")               bash --init-file                         \$(if [ -e \"$KDEV_BASEDIR/kdevplatform_shell_environment.sh\" ];                                 then echo \"$KDEV_BASEDIR/kdevplatform_shell_environment.sh\";                            elif [ -e \"$(which kdevplatform_shell_environment.sh)\" ]; then
    KDEV_WORKING_DIR=$(pwd);
            if [ "$KDEV_SSH_FORWARD_CHAIN" == "$LOGIN" ]; then
                if [ "$KDEV_SSH_FORWARD_CHAIN" == "" ]; then
                    KDEV_WORKING_DIR="$(dirname $P_ON_HOST)";
                    echo "Cannot synchronize the working directory, because the host-names do not match (app: $LOGIN, shell: $KDEV_SSH_FORWARD_CHAIN)";
            if [ "$KDEV_SSH_FORWARD_CHAIN" ]; then



then I install the project:

![~ build]$ su -c "make install"
Password:
[ 0%] Built target kgraphicaltest_automoc
[ 12%] Building CXX object src/CMakeFiles/kgraphicaltest.dir/kgraphicaltest_automoc.o
[ 25%] Building CXX object src/CMakeFiles/kgraphicaltest.dir/kgraphicaltest.o
[ 37%] Building CXX object src/CMakeFiles/kgraphicaltest.dir/main.o
[ 50%] Building CXX object src/CMakeFiles/kgraphicaltest.dir/kgraphicaltestview.o
[ 62%] Building CXX object src/CMakeFiles/kgraphicaltest.dir/settings.o
Linking CXX executable kgraphicaltest
[100%] Built target kgraphicaltest
Install the project...
-- Install configuration: "Debug .."
-- Installing: /usr/local/bin/kgraphicaltest
-- Set runtime path of "/usr/local/bin/kgraphicaltest" to "/usr/local/lib"
-- Up-to-date: /usr/local/share/applications/kde4/kgraphicaltest.desktop
-- Up-to-date: /usr/local/share/config.kcfg/kgraphicaltest.kcfg
-- Up-to-date: /usr/local/share/apps/kgraphicaltest/kgraphicaltestui.rc
-- Up-to-date: /usr/local/share/apps/kgraphicaltest/qml/main.qml
-- Up-to-date: /usr/local/share/icons/hicolor/16x16/apps/./kgraphicaltest.png
-- Up-to-date: /usr/local/share/icons/hicolor/32x32/apps/./kgraphicaltest.png
-- Up-to-date: /usr/local/share/icons/hicolor/48x48/apps/./kgraphicaltest.png


then I try to run directly from KDE and from KDEVELOP
but the resul is the same:

Starting: ../workarea/projects/KGraphicalTest/build/src/kgraphicaltest
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 14: reading configurations from ~/.fonts.conf is deprecated.
file:..///workarea/projects/KGraphicalTest/build/src/: File not found
KCrash: Application 'kgraphicaltest' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
*** Exited with return code: 253 ***



It is normal that the enviroment of KDEVELOP is so ?

I hope all these info can help to give me more adjustment.
thanks
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: using template for new project

Tue May 28, 2013 9:56 am
Sorry, I'm not sure what is going on at this point - please note that i've never worked with QML.
I would suggest asking on the kde-devel@kde.org mailing list at this point, as people there may know more.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
tinosezc
Registered Member
Posts
14
Karma
0
OS

Re: using template for new project

Tue May 28, 2013 10:39 am
I find a temporary solution to the problem:

this is the original, from "kgraphicaltestview.cpp", main class is "KGraphicalTest" and "KGraphicalTestview" :
Code: Select all
    view->setSource(QUrl::fromLocalFile(KStandardDirs::locate("data", "kgraphicaltest/src/qml/main.qml")));

first problem: the template put "kgraphicaltest" but really the directory is "KGraphicalTest"

so I make the first modification (NOT WORKING):
Code: Select all
    view->setSource(QUrl::fromLocalFile(KStandardDirs::locate("data", "KGraphicalTest/src/qml/main.qml")));

this works, inside kdevelop:
Code: Select all
    view->setSource(QUrl::fromLocalFile(KStandardDirs::locate("data", "/workarea/projects/KGraphicalTest/src/qml/main.qml")));

but the question now is : when I want to run as system where point the projects ?

thanks
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: using template for new project

Tue May 28, 2013 10:41 am
This is why it is necessary to ensure KDEDIRS is set properly. Unfortunately it doesn't seem to work properly within KDevelop for you.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot]