Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. SIGSEGV when trying to open a file using QFileDialog::getOpenFileName

SIGSEGV when trying to open a file using QFileDialog::getOpenFileName

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 3 Posters 603 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
    AB_TrP
    wrote on last edited by AB_TrP
    #1

    Hi,

    I am facing a fatal problem with QFileDialog::getOpenFileName(). I want to open and read a text file but whenever I call the function the program crashes.

    Within a QML file (which is not the main window) I have a QML item and a button, which when clicked it calls a function that has the following line :

    QString fileName = QFileDialog::getOpenFileName(this, tr("Open Text file"), "", tr("Text Files (*.txt )"));

    whenever the program gets to this line, it crashes and in debugger mode i get the SIGSEGV signal message....any ideas why this might be happening?

    It seems like this problem happened to a few people but there is no mention of the solution anywhere on Google :(

    Thanks for your help

    jsulmJ 1 Reply Last reply
    0
    • A AB_TrP

      Hi,

      I am facing a fatal problem with QFileDialog::getOpenFileName(). I want to open and read a text file but whenever I call the function the program crashes.

      Within a QML file (which is not the main window) I have a QML item and a button, which when clicked it calls a function that has the following line :

      QString fileName = QFileDialog::getOpenFileName(this, tr("Open Text file"), "", tr("Text Files (*.txt )"));

      whenever the program gets to this line, it crashes and in debugger mode i get the SIGSEGV signal message....any ideas why this might be happening?

      It seems like this problem happened to a few people but there is no mention of the solution anywhere on Google :(

      Thanks for your help

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

      @AB_TrP On which platform is this happening?

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

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AB_TrP
        wrote on last edited by
        #3

        Hi jsulm

        Im working on Linux...I just fixed it using the help found in https://forum.qt.io/topic/80130/sigsegv-after-adding-qfiledialog-getopenfilename-to-the-program/7
        I used Q_NULLPTR as suggested and that worked for me :D

        Pablo J. RoginaP 1 Reply Last reply
        0
        • A AB_TrP

          Hi jsulm

          Im working on Linux...I just fixed it using the help found in https://forum.qt.io/topic/80130/sigsegv-after-adding-qfiledialog-getopenfilename-to-the-program/7
          I used Q_NULLPTR as suggested and that worked for me :D

          Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #4

          @AB_TrP said in SIGSEGV when trying to open a file using QFileDialog::getOpenFileName:

          that worked for me :D

          great you found a solution. So please don't forget to mark your post as solved.

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          A 1 Reply Last reply
          1
          • Pablo J. RoginaP Pablo J. Rogina

            @AB_TrP said in SIGSEGV when trying to open a file using QFileDialog::getOpenFileName:

            that worked for me :D

            great you found a solution. So please don't forget to mark your post as solved.

            A Offline
            A Offline
            AB_TrP
            wrote on last edited by
            #5

            @Pablo-J-Rogina thank your for reminding me :)

            1 Reply Last reply
            1

            • Login

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