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. I want to get directory address

I want to get directory address

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 1.4k 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
    Armin
    wrote on last edited by
    #1

    Hi
    I want to get directory address ( like g:\document\armin\qt ) by getExistingDirectoryUrl.
    I don't get error but i don't have any address from directory i did choose.

    void MainWindow::on_toolButton_clicked()
    {
      urll = QFileDialog::getExistingDirectoryUrl();
    }
    
    void MainWindow::on_pushButton_3_clicked()
    {
        ui->label_14->text() = urll.toString();
    
    }
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      You must tell more about what is not working.
      if I run your code it does give me path
      Like

      "file:///C:/Windows/debug"
      
      1 Reply Last reply
      2
      • A Offline
        A Offline
        Armin
        wrote on last edited by
        #3

        @mrjj Thanks
        I want to save file in directory which selected by getExistingDirectoryUrl() function .

        jsulmJ 1 Reply Last reply
        0
        • A Armin

          @mrjj Thanks
          I want to save file in directory which selected by getExistingDirectoryUrl() function .

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Armin And what is the problem?Is this urll the same in both slots? Is on_toolButton_clicked() executed before on_pushButton_3_clicked() ? How do you store the file?

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          1
          • A Offline
            A Offline
            Armin
            wrote on last edited by
            #5

            @jsulm Thank you
            For example : you want to determine which where your file be save , so you should determine a directory url , for instance : c:/document/arminfolder
            So i use a button which open my directory in windows. but i can't save directory in variable

            jsulmJ 1 Reply Last reply
            0
            • A Armin

              @jsulm Thank you
              For example : you want to determine which where your file be save , so you should determine a directory url , for instance : c:/document/arminfolder
              So i use a button which open my directory in windows. but i can't save directory in variable

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Armin Are you aware that this is wrong?

              ui->label_14->text() = urll.toString();
              

              If you want to set text in a label then you need to do:

              ui->label_14->setText(urll.toString());
              

              It is all in the documentation.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              3
              • A Offline
                A Offline
                Armin
                wrote on last edited by
                #7

                @jsulm oh sorry , i forget
                You right and my problem solve
                Thanks

                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