Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. A few design questions...
Forum Updated to NodeBB v4.3 + New Features

A few design questions...

Scheduled Pinned Locked Moved General and Desktop
127 Posts 7 Posters 92.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    andre
    wrote on 31 Mar 2011, 15:03 last edited by
    #15

    1: depends on your design. If you use a QML file for your whole UI, yes. Otherwise, the QML view is just a part of your UI design, and one that would be part of the actual .ui file.

    2: to decide that, you need to tell us about the criteria, and even then it is hard for us to advise you on that. QML may be a candidate, but...

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mzimmers
      wrote on 31 Mar 2011, 15:09 last edited by
      #16

      Thanks, Andre. Tell you what: I'll spend today playing with QML and doing some reading.

      Regarding the upcoming product GUI: think of how you configure a home DSL modem, except we (probably) won't be using a browser to reach the embedded application.

      I'll be back later with (I'm sure) some questions.

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        ZapB
        wrote on 31 Mar 2011, 15:13 last edited by
        #17

        QML or a QWidget based GUI will work fine for that. Depends how much you want in the way of animations or how much you would like it to look native on your target platform. Having said that QML can be made to look native and we may see some native looking QML components coming out in the course of the coming year.

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mzimmers
          wrote on 31 Mar 2011, 17:22 last edited by
          #18

          Not directly related to the thread, but I've stumbled across an issue that I've been wondering about.

          I'm running on a Mac platform. The code that Zap posted above won't work unless I move my QML file into the resource for the binary. I don't like to do this, because 1) it's a minor hassle, and 2) it seems like a maintenance issue that I don't need.

          Does Qt have any hooks for setting a default directory, or putting a prefix on files to direct them to somewhere else? I'm trying to avoid any hard-coding here, though some may be necessary.

          I did find this thread:
          "thread on setSource":http://developer.qt.nokia.com/forums/viewthread/656

          Which seems related, but not quite the answer.

          Any advice on how to handle this?

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            ZapB
            wrote on 31 Mar 2011, 17:27 last edited by
            #19

            I don't have a Mac to test on, but it should work. Just be sure to correctly specify the path to the qml file. Either via an absolute path or via a path relative to the location of your application executable (see docs for QDir).

            Nokia Certified Qt Specialist
            Interested in hearing about Qt related work

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mzimmers
              wrote on 31 Mar 2011, 18:00 last edited by
              #20

              Decisions, decisions. An absolute pathname, and I bet it won't port to other platforms. Relative pathnames seem weird here, too.

              I don't suppose Qt supplies a pathname for the project, does it? I can't see how it could, but that would solve the problem.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on 31 Mar 2011, 18:03 last edited by
                #21

                What you can do is ionstall the file besides you exe and use QCoreApplication::applicationDirPath()

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mzimmers
                  wrote on 31 Mar 2011, 18:09 last edited by
                  #22

                  What you can do is ionstall the file besides you exe and use QCoreApplication::applicationDirPath()

                  True, but then the QML file is out of the source structure. I'm trying to preserve a separation between source files (of all kinds) and makefile output. It seems like good CM practice if nothing else. I guess I'm probably stuck with the relative pathnames, huh?

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    giesbert
                    wrote on 31 Mar 2011, 18:11 last edited by
                    #23

                    Typically, you design the app so it will work on target machines with installed files, not with developer structures. Make it part of the makefile to copy the file to the out dir?

                    Nokia Certified Qt Specialist.
                    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mzimmers
                      wrote on 31 Mar 2011, 18:18 last edited by
                      #24

                      Now THAT'S a good idea, and will obviate the issue completely. But...makefiles are automatically generated, right? How can I do this in such a way that will survive blowing away the makefile and regenerating it?

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        giesbert
                        wrote on 31 Mar 2011, 18:19 last edited by
                        #25

                        read the qmake docs. I'm sure there is some possibility, but I never needed that :-)

                        Nokia Certified Qt Specialist.
                        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          mzimmers
                          wrote on 31 Mar 2011, 18:47 last edited by
                          #26

                          But...it's not really a qmake function, is it? Because this special behavior should survive the makefile. Is there a way to do this in the project file?

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            giesbert
                            wrote on 31 Mar 2011, 18:57 last edited by
                            #27

                            but the *.pro files are described in the qmake "documentation":http://doc.qt.nokia.com/latest/qmake-manual.html

                            "lmgtfy":http://www.lmgtfy.com/?q=qmake+adding+copy

                            e.g. "this page":http://paulf.free.fr/undocumented_qmake.html

                            or this on "stackoverflow":http://stackoverflow.com/questions/3984104/qmake-how-to-copy-a-file-to-the-output

                            Nokia Certified Qt Specialist.
                            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                            1 Reply Last reply
                            0
                            • Z Offline
                              Z Offline
                              ZapB
                              wrote on 31 Mar 2011, 19:08 last edited by
                              #28

                              You can do this by defining a custom target in your .pro file. Something like this will do it:

                              @
                              myresources.path = $$(MY_INSTALL_ROOT)/resources
                              myresources.files = myqmlfile.qml

                              INSTALLS += target myresources
                              @

                              The above depends upon the environment variable $MY_INSTALL_ROOT being set. However, this hardcodes the install path.

                              Instead, it is better to get rid of the $$(MY_INSTALL_ROOT) part of the path and use the DESTDIR feature of make to specify your installation root:

                              @make DESTDIR=/my/installation/path install@

                              That separates the install path from your project files.

                              Nokia Certified Qt Specialist
                              Interested in hearing about Qt related work

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                mzimmers
                                wrote on 31 Mar 2011, 19:48 last edited by
                                #29

                                Sorry if I seem a little slow on the uptake here -- I'm coping with multiple unfamiliar concepts. It's been over 20 years since I've used makefiles, and I'm still trying to figure out project files, qmake, QDir and other stuff.

                                Zap: I like the way your approach looks. I can't find anything on DESTDIR in the docs, though. It's not clear to me how this approach obviates the hardcoding issue; it seems to just postpone it. Obviously I'm not understanding the whole thing.

                                Thanks.

                                1 Reply Last reply
                                0
                                • G Offline
                                  G Offline
                                  goetz
                                  wrote on 31 Mar 2011, 20:11 last edited by
                                  #30

                                  First: Go with the Resource directory in the application bundle. That's the expected path on OS X. One should not change those things only when it is absolutely necessary.

                                  qmake has support for adding additional files to the bundle:

                                  @
                                  APP_QML_FILES.files = path/to/file1.qml path/to/file2.qml
                                  APP_QML_FILES.path = Contents/Resources
                                  QMAKE_BUNDLE_DATA += APP_QML_FILES
                                  @

                                  This installes the files to YourFancyApplication.app/Contents/Resources - just where it belongs on OS X :)

                                  EDIT: Some more background links in the new "wiki article":http://developer.qt.nokia.com/wiki/Resource_files_in_OS_X_bundle

                                  http://www.catb.org/~esr/faqs/smart-questions.html

                                  1 Reply Last reply
                                  0
                                  • M Offline
                                    M Offline
                                    mzimmers
                                    wrote on 31 Mar 2011, 20:15 last edited by
                                    #31

                                    Thanks, Volker. I realize that files should be in the application bundle, and I wasn't suggesting to do it a different way. In the back of my mind, though, I'm wondering what that bundle looks like when copied to a PC. I'm hoping it's a directory.

                                    Do I correctly assume the path/to refers to the path to the source code? Or is that the target?

                                    EDIT:

                                    I tried it two ways:
                                    @APP_QML_FILES.files = ./DemodShaperFilter.qml
                                    APP_QML_FILES.path = Contents/Resources
                                    QMAKE_BUNDLE_DATA += APP_QML_FILES
                                    @

                                    and:
                                    @APP_QML_FILES.files = DemodShaperFilter.qml
                                    APP_QML_FILES.path = Contents/Resources
                                    QMAKE_BUNDLE_DATA += APP_QML_FILES
                                    @

                                    Neither put the file into the Resources folder. It appears that the path is required, which surprises me, because I figured that the .pro file would use its own directory as the default.

                                    So now, the question is: is there some slick way to derive the current path from an environment variable or something, and plug it into the .pro file automatically?

                                    I'm not pursuing this level of automation out of laziness; it's more a matter of having one less thing to remember when stuff gets changed.

                                    Thanks.

                                    1 Reply Last reply
                                    0
                                    • G Offline
                                      G Offline
                                      goetz
                                      wrote on 31 Mar 2011, 20:45 last edited by
                                      #32

                                      [quote author="mzimmers" date="1301602502"]Thanks, Volker. I realize that files should be in the application bundle, and I wasn't suggesting to do it a different way. In the back of my mind, though, I'm wondering what that bundle looks like when copied to a PC. I'm hoping it's a directory.

                                      Do I correctly assume the path/to refers to the path to the source code? Or is that the target?[/quote]

                                      Thats the path of the source. The target path (relative to the bundle) is in the second line.

                                      If you just care about copying the Mac bundle to a windows box, then you're right, it is nothing more than an ordinary directory. On the Mac command line you just "cd" into it, like into every other directory. It's just the Finder that displays the bundle differently and if you call "open myprogram.app" on the command line, it does not open Finder (like for directories) but launches the application.

                                      Regarding deployment on Windows, that's a different beast. You'll probably consider using an installer to put everything in place. You find some hints on windows installers in "this thread":http://developer.qt.nokia.com/forums/viewthread/4498

                                      http://www.catb.org/~esr/faqs/smart-questions.html

                                      1 Reply Last reply
                                      0
                                      • M Offline
                                        M Offline
                                        mzimmers
                                        wrote on 31 Mar 2011, 20:50 last edited by
                                        #33

                                        Volker: you posted about the same time I edited my last post, so I'm not sure if you saw my new comments/questions?

                                        1 Reply Last reply
                                        0
                                        • G Offline
                                          G Offline
                                          goetz
                                          wrote on 31 Mar 2011, 21:21 last edited by
                                          #34

                                          The path is relative to the location of your .pro file.

                                          http://www.catb.org/~esr/faqs/smart-questions.html

                                          1 Reply Last reply
                                          0

                                          24/127

                                          31 Mar 2011, 18:18

                                          103 unread
                                          • Login

                                          • Login or register to search.
                                          24 out of 127
                                          • First post
                                            24/127
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved