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. QFileDialog::getOpenFileName linux doesn't work
Forum Updated to NodeBB v4.3 + New Features

QFileDialog::getOpenFileName linux doesn't work

Scheduled Pinned Locked Moved General and Desktop
qfiledialoglinux
6 Posts 3 Posters 4.2k 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.
  • B Offline
    B Offline
    bejard
    wrote on last edited by
    #1

    Hello
    I have a problem using QFileDialog::getOpenFileName and it does the same for QFileDialog in general.

    I have linux ubuntu 12.04 64 bits, Qt Creator 2.4.1 , Qt 4.8.0 (64 bit).

    I have a simple code with one button:

    void MainWindow::on_pushButton_3_clicked()
    {

    QString cheminFichier = QFileDialog::getOpenFileName(this, "Ouvrir un fichier", QString(), "Text file (*.txt)",0,QFileDialog::DontResolveSymlinks|QFileDialog::DontUseNativeDialog|QFileDialog::DontUseSheet );
    

    }

    There are no errors in compilation , no crashes , but when I press the button , nothing happens. I tried with other QFileDialog function and it doesn't work also.

    (When I try to use QFileDialog on windows 7 64 bit , QT crashes during compilation)

    Could you help me to solve this , to open FileDialog window on linux ? Maybe there are other solutions.
    thanks :)

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

      Hi and welcome to devnet,

      The question might be silly but: are you sure that this slot is called ?

      You should also consider updating your Qt version, the latest (and last) version of Qt 4 is 4.8.7.

      What version of Qt are you using on Windows ? What do you mean by crash during compilation ?

      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
      0
      • B Offline
        B Offline
        bejard
        wrote on last edited by
        #3

        Problem solved , thanks to your silly question :p

        In deed the slot wasn't called because before I probably put an other button that I deleted with the same name .
        So I changed name here and deleted the previous switch case of the previous button in "moc_mainwindow.cpp".

        On windows I have Qt5.5 and I meant that Qt is frozen. Probably with the right file now it won't do anymore.

        Thanks :)

        jsulmJ 1 Reply Last reply
        0
        • B bejard

          Problem solved , thanks to your silly question :p

          In deed the slot wasn't called because before I probably put an other button that I deleted with the same name .
          So I changed name here and deleted the previous switch case of the previous button in "moc_mainwindow.cpp".

          On windows I have Qt5.5 and I meant that Qt is frozen. Probably with the right file now it won't do anymore.

          Thanks :)

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

          @bejard You should never edit moc_*.cpp files, they are generated during compilation!
          What do you mean by "Qt is frozen"? Do you mean QtCreator is frozen? Qt is a framework, it cannot be frozen during compilation.

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

          B 1 Reply Last reply
          0
          • jsulmJ jsulm

            @bejard You should never edit moc_*.cpp files, they are generated during compilation!
            What do you mean by "Qt is frozen"? Do you mean QtCreator is frozen? Qt is a framework, it cannot be frozen during compilation.

            B Offline
            B Offline
            bejard
            wrote on last edited by
            #5

            @jsulm yes but as I deleted in wrong way the previous button I had still it in this file and it did some errors ^^ now it works I saved it.
            I meant QtCreator yes : loading loading loading at middle of compilation ...then "not responding"
            Forced to kill the task

            1 Reply Last reply
            0
            • jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Instead of editing the moc file you can just rebuild you project completely (you can delete the build folder before you rebuild).

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

              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