Results 1 to 20 of 27

Thread: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    Quote Originally Posted by sylas View Post
    Unfortunately it does not work.
    You have given no indication what problem you are having.

    Quote Originally Posted by sylas View Post
    In the book he speeks only of two files, Button.qml and main.qml. No trace of a main.cpp.
    You don't necessarily need any C++ files.
    E.g. you could simply launch main.qml using "qmlscene" or as a "QtQuick UI" project in QtCreator.

    Quote Originally Posted by sylas View Post
    Now nothing about my first problem of anchor.
    Great.

    Quote Originally Posted by sylas View Post
    The only problem I have now is (in Application Output): "make sure to deploy Qt with accessibility plugins".
    That's not a problem unless you need accessibility support.
    Do you?

    Cheers,
    _

  2. #2
    Join Date
    Nov 2016
    Posts
    48
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    I looked everywhere for Qt plugins, even with my terminal. Now nothing about plugins in "Application Output". I can see very well the calculator in the "Design" mode. But "show" impossible. Maybe there is an error in the main.cpp. Here is its code:
    Qt Code:
    1. //main.cpp
    2. #include <QtGui/QGuiApplication>
    3. #include "qtquick2applicationviewer.h"
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QGuiApplication app(argc, argv);
    8.  
    9. QtQuick2ApplicationViewer viewer;
    10. viewer.setMainQmlFile(QStringLiteral("qml/QtQuickCalculator/main.qml"));
    11. viewer.showExpanded();//origin
    12. // viewer.show();
    13.  
    14.  
    15. }
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    Quote Originally Posted by sylas View Post
    I looked everywhere for Qt plugins, even with my terminal.
    As I said, if you don't need accessiblity, don't bother looking for plugins that you don't need.

    Quote Originally Posted by sylas View Post
    But "show" impossible.
    Why didn't you say so before?

    So when you run the program you don't see a window or does the window not have any content?

    Have you tried running the main.qml with "qmlscene"?

    Cheers,
    _

  4. #4
    Join Date
    Nov 2016
    Posts
    48
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    1. I don't understand "running the main.qml with "qmlscene"".
    2. The last message of "Application Output" is:
    file:///home/sylvain/build-quickcalc-Qt_5_5_1_in_PATH_qt5_invalid-Debug/qml/QtQuickCalculator/main.qml: File not found
    /home/sylvain/build-quickcalc-Qt_5_5_1_in_PATH_qt5_invalid-Debug/quickcalc exited with code 0
    3. I must say to you that the name I gave to the project is "quickcalc", because I noticed with other projects that the name of the project is not compulsory.
    Many thanks for your help.

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    Quote Originally Posted by sylas View Post
    1. I don't understand "running the main.qml with "qmlscene"".
    qmlscene mai.qml

    in a shell that has qmlscene in $PATH

    Quote Originally Posted by sylas View Post
    2. The last message of "Application Output" is:
    file:///home/sylvain/build-quickcalc-Qt_5_5_1_in_PATH_qt5_invalid-Debug/qml/QtQuickCalculator/main.qml: File not found
    See, an actual error message is way more informative than posting random bits of information.
    Looks like the file you are trying to load does not exist or you have specified a wrong path.

    Quote Originally Posted by sylas View Post
    3. I must say to you that the name I gave to the project is "quickcalc", because I noticed with other projects that the name of the project is not compulsory.
    Yes, the name of the project doesn't really matter.

    Cheers,
    _

  6. #6
    Join Date
    Nov 2016
    Posts
    48
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    qmlscene: marvellous ! Calculator works very well. But is it possible you try yourself this demoniac quick application ? Only Button.qml and main.qml are necessary, and you have them above.1. you create the project with Qt Creator: "Application" and "QtQuickApplication"
    2. main.cpp already appears. I don't touch it. (it is not the main.cpp I sent to you above). Now you add the file "Button.qml". You can look already in the Design mode the button.
    3. You add "main.qml". You can look already in the design mode the calculator.
    4. You build the project. No error message..
    5. you run it. Then you see the "Application Output" message I gave at the beginning of this thread.
    I think that if you don't have the message and your project works well the error is in my Linux or in a pluggin missing. Thank you very much. Cheers

  7. #7
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    This has nothing to do with plugins, the error clearly indicates that the file does not exist where the program looks for it.

    Most likely cause: the two QML files are in your project directory and you have a shadow build (out of source build).
    So the working directory of the application is not the source directory.

    Several options:
    1) Start the application with the source directory as the working directory
    2) Copy or link the QML files into the build directory
    3) Put the QML files into a Qt resource and load them from there

    Cheers,
    _

  8. #8
    Join Date
    Nov 2016
    Posts
    48
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    I use another project more complete. First paste of the "Application Output":
    Starting /home/sylvain/build-quickcalc-Qt_5_5_1_in_PATH_qt5_invalid-Debug/quickcalc...
    QML debugging is enabled. Only use this in a safe environment.
    file:///home/sylvain/build-quickcalc-Qt_5_5_1_in_PATH_qt5_invalid-Debug/qml/QtQuickCalculator/main.qml: File not found
    /home/sylvain/build-quickcalc-Qt_5_5_1_in_PATH_qt5_invalid-Debug/quickcalc exited with code 0
    The files; quickcalc.pro, deployment.pri, qtquick2applicationviwer.h, main.cpp, qtquick2applicationviewer.cpp Ressources: Button.qml, main.qml Others: qmldir
    It is very hard for me. Have you an idea ? Thanks and cheers

  9. #9
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    Quote Originally Posted by sylas View Post
    file:///home/sylvain/build-quickcalc-Qt_5_5_1_in_PATH_qt5_invalid-Debug/qml/QtQuickCalculator/main.qml: File not found
    Your program, the last one and this one, tells you that there is no

    /home/sylvain/build-quickcalc-Qt_5_5_1_in_PATH_qt5_invalid-Debug/qml/QtQuickCalculator/main.qml

    file.

    Quote Originally Posted by sylas View Post
    It is very hard for me. Have you an idea ? Thanks and cheers
    Files in a file system are address with by name, which consists of the the actual file name and path.
    A path can be absolute or relative.
    Absolute means it has all information there is, a full sequence of directory names from the top level of the directory tree to the file itself.

    A relative path is just a filename or the filename plus some directories. The runtime environment will then prepend the program's working directory to create a full/absolute path for the actual access operation.

    See https://en.wikipedia.org/wiki/Path_(computing)

    Cheers,
    _

  10. #10
    Join Date
    Nov 2016
    Posts
    48
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    Trial.jpg
    You can see better with the image
    Attached Images Attached Images

  11. #11
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    So you added the files to the resource, but forgot to change the path when loading main.qml?

    Cheers,
    _

  12. #12
    Join Date
    Nov 2016
    Posts
    48
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    I made a third project respecting this time the name "QtQuickCalculator". I included also the two files .cpp and .h about the viewers. Now the Application Output becomes exactly the same I had at the beginning of the thread. Here it is:
    Starting /home/sylvain/build-QtQuickCalculator-Qt_5_5_1_in_PATH_qt5_invalid-Debug/QtQuickCalculator...
    QML debugging is enabled. Only use this in a safe environment.
    qrc:/main.qml:47:35: Unable to assign QQuickRectangle to QQuickAnchorLine
    So there is apparently a syntax error. I added already to add left, right, bottom, top, center without any success.

  13. #13
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    Quote Originally Posted by sylas View Post
    qrc:/main.qml:47:35: Unable to assign QQuickRectangle to QQuickAnchorLine
    So there is apparently a syntax error. I added already to add left, right, bottom, top, center without any success.
    Apparently you are back at your oridinal problem.

    An anchor line property needs a compatible anchor line assignment, not an item.
    There are vertical and horizontal lines http://doc.qt.io/qt-5/qtquick-positioning-anchors.html so compatible means a vertical line for a vertical anchor or a horizontal line for a horizontal anchor.

    Cheers,
    _

  14. #14
    Join Date
    Nov 2016
    Posts
    48
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    I don't find your reply. Maybe you consider it is enough with this thread. However I tell you that I repaired the error. I have now two projects which give me the same "application Output" message, the one I give on the title of my thread. I don't see how to repair this "syntax error". Cheers

  15. #15
    Join Date
    Nov 2016
    Posts
    48
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    Finished the problem with syntax. Iadded : .horizontalCenter. Finished the probllem with file not found. I wrote a new path. Now I have two projects one simple without vewers, the other with viewers. But no one shows any calculator upon 'run".
    So it seems something is wrong in Main.cpp. I give you below the two codes:
    Qt Code:
    1. //main.cpp of quickcalc project
    2. #include <QtGui/QGuiApplication>
    3. #include "qtquick2applicationviewer.h"
    4. int main(int argc, char *argv[])
    5. {
    6. QGuiApplication app(argc, argv);
    7. QtQuick2ApplicationViewer viewer;
    8. viewer.setMainQmlFile(QStringLiteral("/home/sylvain/quickcalc/main.qml"));
    9. //viewer.showExpanded();//origin
    10. viewer.show();
    11. }
    To copy to clipboard, switch view to plain text mode 

    And the other:
    Qt Code:
    1. //main.cpp of quickc project
    2. #include <QGuiApplication>
    3. #include <QQmlApplicationEngine>
    4. int main(int argc, char *argv[])
    5. {
    6. QGuiApplication app(argc, argv);
    7. QQmlApplicationEngine engine;
    8. engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
    9. return app.exec();
    10. }
    To copy to clipboard, switch view to plain text mode 

  16. #16
    Join Date
    Nov 2016
    Posts
    48
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    Apparently I don't see the calculator because there is nowhere any window in the main.qml . So I must construct one. isn't it ? How is it possible this calculator i so incomplete ? Regards

  17. #17
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: qrc:/main.qml:48:35: Unable to assign QQuickRectangle to QQuickAnchorLine

    Quote Originally Posted by sylas View Post
    Finished the problem with syntax. Iadded : .horizontalCenter.
    We had that days ago already.

    Quote Originally Posted by sylas View Post
    So it seems something is wrong in Main.cpp.
    It is interesting how you find new ways of introducing problems.

    First main.cpp is missing the application start, second main.cpp is OK but requires a QML file with a top level window element.

    Quote Originally Posted by sylas View Post
    Apparently I don't see the calculator because there is nowhere any window in the main.qml . So I must construct one. isn't it ? How is it possible this calculator i so incomplete ?
    I though you had it already working with qmlscene?

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 8th August 2014, 19:08
  2. Unable to load background image in Main Window
    By bedbuffer in forum Newbie
    Replies: 0
    Last Post: 16th December 2010, 08:40
  3. Replies: 11
    Last Post: 11th August 2008, 09:14
  4. Replies: 1
    Last Post: 23rd July 2008, 10:19
  5. Replies: 15
    Last Post: 23rd March 2007, 16:16

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.