Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. loadUi from outside directory

loadUi from outside directory

Scheduled Pinned Locked Moved Unsolved Qt for Python
qt for pythonpython
8 Posts 3 Posters 1.3k Views
  • 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.
  • Q Offline
    Q Offline
    Qt-Bot05
    wrote on last edited by
    #1

    How do I loadUi files from outside of current directory?

    JonBJ 1 Reply Last reply
    0
    • Q Qt-Bot05

      How do I loadUi files from outside of current directory?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Qt-Bot05
      Did you try specifying the path to the .ui file(s)?

      Q 1 Reply Last reply
      0
      • JonBJ JonB

        @Qt-Bot05
        Did you try specifying the path to the .ui file(s)?

        Q Offline
        Q Offline
        Qt-Bot05
        wrote on last edited by Qt-Bot05
        #3

        @JonB Well, The .ui file is outside the folder where I'm trying to load it. Should I start with "C:/Users/..."?

        JonBJ 1 Reply Last reply
        0
        • Q Qt-Bot05

          @JonB Well, The .ui file is outside the folder where I'm trying to load it. Should I start with "C:/Users/..."?

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #4

          @Qt-Bot05
          If that is its absolute path then yes, you can do that, at least try it. However this is not very robust going forward. If you distribute your application to someone else, or you move where it is stored on your own computer, it will break.

          The first thing is that I presume wherever it is it is within your project. If not you have a problem: how is it related, and how is your app supposed to locate it at runtime? Assuming it is within your project, consider using a relative path. For example, you can [go] upwards via ../something or you can go downwards via something/. This is preferable because so long as your project structure remains the same if moved or distributed it will continue to work.

          First get it working maybe with an absolute path to make sure it works, then look at what relative path could be used instead.

          Q JonBJ 3 Replies Last reply
          1
          • JonBJ JonB

            @Qt-Bot05
            If that is its absolute path then yes, you can do that, at least try it. However this is not very robust going forward. If you distribute your application to someone else, or you move where it is stored on your own computer, it will break.

            The first thing is that I presume wherever it is it is within your project. If not you have a problem: how is it related, and how is your app supposed to locate it at runtime? Assuming it is within your project, consider using a relative path. For example, you can [go] upwards via ../something or you can go downwards via something/. This is preferable because so long as your project structure remains the same if moved or distributed it will continue to work.

            First get it working maybe with an absolute path to make sure it works, then look at what relative path could be used instead.

            Q Offline
            Q Offline
            Qt-Bot05
            wrote on last edited by
            #5

            @JonB Oh ok .../ is to go upwards, This might be the solution. I'll try it right now.

            1 Reply Last reply
            0
            • JonBJ JonB

              @Qt-Bot05
              If that is its absolute path then yes, you can do that, at least try it. However this is not very robust going forward. If you distribute your application to someone else, or you move where it is stored on your own computer, it will break.

              The first thing is that I presume wherever it is it is within your project. If not you have a problem: how is it related, and how is your app supposed to locate it at runtime? Assuming it is within your project, consider using a relative path. For example, you can [go] upwards via ../something or you can go downwards via something/. This is preferable because so long as your project structure remains the same if moved or distributed it will continue to work.

              First get it working maybe with an absolute path to make sure it works, then look at what relative path could be used instead.

              Q Offline
              Q Offline
              Qt-Bot05
              wrote on last edited by
              #6

              @JonB Unfortunately, it didn't work, It gave me a file not found error. I think it's taking "..." as a literal folder

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi,

                The number of points is important.
                One = current folder
                Two = previous folder
                Three = folder named "..." in the current folder.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • JonBJ JonB

                  @Qt-Bot05
                  If that is its absolute path then yes, you can do that, at least try it. However this is not very robust going forward. If you distribute your application to someone else, or you move where it is stored on your own computer, it will break.

                  The first thing is that I presume wherever it is it is within your project. If not you have a problem: how is it related, and how is your app supposed to locate it at runtime? Assuming it is within your project, consider using a relative path. For example, you can [go] upwards via ../something or you can go downwards via something/. This is preferable because so long as your project structure remains the same if moved or distributed it will continue to work.

                  First get it working maybe with an absolute path to make sure it works, then look at what relative path could be used instead.

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #8

                  @Qt-Bot05

                  @JonB said in loadUi from outside directory:

                  you can [go] upwards via ../something

                  1 Reply Last reply
                  0

                  • Login

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