Results 1 to 3 of 3

Thread: How to avoid putting one's name in a source code

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

    Default How to avoid putting one's name in a source code

    Hi all! If I don't write: /home/sylvain/quick/main.qml it doesn't work. My name is sylvain. I think it is not normal to write his name in a code. . This thread continues the old thread "view possible in the design mode and qmlscene but not at the end or"run" ". Here, below, the code of main.cpp.
    Qt Code:
    1. //main.cpp
    2.  
    3. #include <QGuiApplication>
    4. #include <QQuickView>
    5.  
    6. int main(int argc, char *argv[])
    7. {
    8. QGuiApplication app(argc, argv);
    9. QQuickView view;
    10. //view.setSource(QUrl::fromLocalFile("qrc:/main.qml"));//unfortunately doesn't work
    11. view.setSource(QUrl::fromLocalFile("/home/sylvain/quick/main.qml"));
    12. view.show();
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: How to avoid putting one's name in a source code

    view.setSource(QUrl::fromLocalFile("qrc:/main.qml")); //unfortunately doesn't work
    Are you sure this is the correct path to the resources in your qrc file? Also, resources are not a "local file" - that is a term used to describe files in your file system (e.g. disk drives). Simply use QUrl( "qrc:/main.qml" ) once you are sure the path is correct. You must also be sure that any other QML files you have created are also in the qrc file.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

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

    Default Re: How to avoid putting one's name in a source code

    With your new line, it works very well ! Thank you very much. Here is your line: view.setSource(QUrl("qrc:/main.qml"));

Similar Threads

  1. no source code
    By banlinhtienphong in forum General Programming
    Replies: 1
    Last Post: 25th July 2011, 17:19
  2. Where is the source code?
    By Fletcher in forum Newbie
    Replies: 1
    Last Post: 10th December 2009, 20:45
  3. Source code
    By afflictedd2 in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2008, 09:04
  4. source code
    By Colx007 in forum Newbie
    Replies: 5
    Last Post: 19th December 2007, 09:15
  5. Qte source code
    By Gaurav vyas in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 1st July 2007, 14:11

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.