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. STRANGE BEHAVIOUR OF QTableView and QFileDialog
Forum Updated to NodeBB v4.3 + New Features

STRANGE BEHAVIOUR OF QTableView and QFileDialog

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 1.8k 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
    base_load
    wrote on last edited by
    #1

    **Hi. I have this application that is supposed to operate on at least two custom data repositories. The app handles them through a Qt's model/view famework where the main repository is linked to the only table view provided. The second repository is linked to the said tableview-model implementation through some sort of signals and slots and the two models are dependent on the tableview and on the overall application operations. i.e the data rendered/edited by the table view is from/to both repositories.
    Data is loaded through a QFileDialog that allows selection of the two repositories. However, I have encountered two strange behaviours that i would like someone to help understand what is happening.

    1). When the QFileDialog loads and one fails to select any file by way of canceling or closing the dialog window, control is not returned gracefully to the main application, but the whole application crashes and the windows system throws a segmentation error. I haven't been able to figure out whether the bug is in my codebase or with the Qt framework itself but I have so far debugged my code sufficiently.

    2). Secondly, the table view is also manifesting a strange behaviour too. In the table view, dynamic resizing has not yet been handled appropriately in the application in relation to the probable data sizes. However, the default behaviour of showing tiny table when the data rows are too few is undesirable so I had to dictate a temporary size so that the table view is at least the desired size. In a case where the data rows are too few, there is an empty white space that is rendered after the last row. Everything works fine with the application and more specifically rendering of data elements in the table view until one CLICKS the empty unoccupied white space of the table view. The application immediately crashes. I have inspected and included appropriate guard conditions to ascertain that execution of data in the repositories only occurs for valid indices. On checking the Qt Creator application building logs, there is an error that indicates that " index out range" error has occured for QList <T>::at() . This is not in my code; I am very sure about that. I am wondering if it is a thing to do with internal implementation of the QTableView class. I mean the way it resolves the indices of the selected items on the view so that when the said empty space is clicked for selection, an undefined behaviour occurs or a bug manifestation suffices. For this application, the empty white space is critical and useful, supposing that there is work around this behavour of crashing.

    PLEASE SOMEONE HELP. THANK YOU.**

    K VRoninV 2 Replies Last reply
    0
    • B base_load

      **Hi. I have this application that is supposed to operate on at least two custom data repositories. The app handles them through a Qt's model/view famework where the main repository is linked to the only table view provided. The second repository is linked to the said tableview-model implementation through some sort of signals and slots and the two models are dependent on the tableview and on the overall application operations. i.e the data rendered/edited by the table view is from/to both repositories.
      Data is loaded through a QFileDialog that allows selection of the two repositories. However, I have encountered two strange behaviours that i would like someone to help understand what is happening.

      1). When the QFileDialog loads and one fails to select any file by way of canceling or closing the dialog window, control is not returned gracefully to the main application, but the whole application crashes and the windows system throws a segmentation error. I haven't been able to figure out whether the bug is in my codebase or with the Qt framework itself but I have so far debugged my code sufficiently.

      2). Secondly, the table view is also manifesting a strange behaviour too. In the table view, dynamic resizing has not yet been handled appropriately in the application in relation to the probable data sizes. However, the default behaviour of showing tiny table when the data rows are too few is undesirable so I had to dictate a temporary size so that the table view is at least the desired size. In a case where the data rows are too few, there is an empty white space that is rendered after the last row. Everything works fine with the application and more specifically rendering of data elements in the table view until one CLICKS the empty unoccupied white space of the table view. The application immediately crashes. I have inspected and included appropriate guard conditions to ascertain that execution of data in the repositories only occurs for valid indices. On checking the Qt Creator application building logs, there is an error that indicates that " index out range" error has occured for QList <T>::at() . This is not in my code; I am very sure about that. I am wondering if it is a thing to do with internal implementation of the QTableView class. I mean the way it resolves the indices of the selected items on the view so that when the said empty space is clicked for selection, an undefined behaviour occurs or a bug manifestation suffices. For this application, the empty white space is critical and useful, supposing that there is work around this behavour of crashing.

      PLEASE SOMEONE HELP. THANK YOU.**

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      @base_load said in STRANGE BEHAVIOUR OF QTableView and QFileDialog:

      **Hi. I have this application that is supposed to operate on at least two custom data repositories. The app handles them through a Qt's model/view famework where the main repository is linked to the only table view provided. The second repository is linked to the said tableview-model implementation through some sort of signals and slots and the two models are dependent on the tableview and on the overall application operations. i.e the data rendered/edited by the table view is from/to both repositories.
      Data is loaded through a QFileDialog that allows selection of the two repositories. However, I have encountered two strange behaviours that i would like someone to help understand what is happening.

      1). When the QFileDialog loads and one fails to select any file by way of canceling or closing the dialog window, control is not returned gracefully to the main application, but the whole application crashes and the windows system throws a segmentation error. I haven't been able to figure out whether the bug is in my codebase or with the Qt framework itself but I have so far debugged my code sufficiently.

      Did you check out the documentation on QFileDialog?
      It says:
      This is a convenience static function that returns an existing file selected by the user. If the user presses Cancel, it returns a null string.
      Therefore the assumption is that you are not checking the return value, most likely a null string. Most actions on null strings are causing crashes.
      The rest is crystal ball reading.

      2). Secondly, the table view is also manifesting a strange behaviour too. In the table view, dynamic resizing has not yet been handled appropriately in the application in relation to the probable data sizes. However, the default behaviour of showing tiny table when the data rows are too few is undesirable so I had to dictate a temporary size so that the table view is at least the desired size. In a case where the data rows are too few, there is an empty white space that is rendered after the last row. Everything works fine with the application and more specifically rendering of data elements in the table view until one CLICKS the empty unoccupied white space of the table view. The application immediately crashes. I have inspected and included appropriate guard conditions to ascertain that execution of data in the repositories only occurs for valid indices. On checking the Qt Creator application building logs, there is an error that indicates that " index out range" error has occured for QList <T>::at() . This is not in my code; I am very sure about that. I am wondering if it is a thing to do with internal implementation of the QTableView class. I mean the way it resolves the indices of the selected items on the view so that when the said empty space is clicked for selection, an undefined behaviour occurs or a bug manifestation suffices. For this application, the empty white space is critical and useful, supposing that there is work around this behavour of crashing.

      PLEASE SOMEONE HELP. THANK YOU.**

      You probably need to post code sections describing your problem. Most likely you have a mismatch of rows and/or columns in your code.

      BTW captial letters are interpret as shouting throughout the internet. Not sure if everybody is liking your shouting of the title and the end of your email.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      3
      • B Offline
        B Offline
        base_load
        wrote on last edited by
        #3

        Thank you for the correction about using uppercase letters. About my code, let me try checking your suggestion and also compose a comprehensive report about those problems I am encountering. (on a light note, I am not a speaking English as my first language. I may make a lot of grammatical errors too)

        K 1 Reply Last reply
        0
        • B base_load

          Thank you for the correction about using uppercase letters. About my code, let me try checking your suggestion and also compose a comprehensive report about those problems I am encountering. (on a light note, I am not a speaking English as my first language. I may make a lot of grammatical errors too)

          K Offline
          K Offline
          koahnig
          wrote on last edited by
          #4

          @base_load said in STRANGE BEHAVIOUR OF QTableView and QFileDialog:

          (on a light note, I am not a speaking English as my first language. I may make a lot of grammatical errors too)

          Welcome to the club. Probably 80-90% are no native English speakers. Therefore, do not worry about the grammatical challenges of English. ;)

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • B base_load

            **Hi. I have this application that is supposed to operate on at least two custom data repositories. The app handles them through a Qt's model/view famework where the main repository is linked to the only table view provided. The second repository is linked to the said tableview-model implementation through some sort of signals and slots and the two models are dependent on the tableview and on the overall application operations. i.e the data rendered/edited by the table view is from/to both repositories.
            Data is loaded through a QFileDialog that allows selection of the two repositories. However, I have encountered two strange behaviours that i would like someone to help understand what is happening.

            1). When the QFileDialog loads and one fails to select any file by way of canceling or closing the dialog window, control is not returned gracefully to the main application, but the whole application crashes and the windows system throws a segmentation error. I haven't been able to figure out whether the bug is in my codebase or with the Qt framework itself but I have so far debugged my code sufficiently.

            2). Secondly, the table view is also manifesting a strange behaviour too. In the table view, dynamic resizing has not yet been handled appropriately in the application in relation to the probable data sizes. However, the default behaviour of showing tiny table when the data rows are too few is undesirable so I had to dictate a temporary size so that the table view is at least the desired size. In a case where the data rows are too few, there is an empty white space that is rendered after the last row. Everything works fine with the application and more specifically rendering of data elements in the table view until one CLICKS the empty unoccupied white space of the table view. The application immediately crashes. I have inspected and included appropriate guard conditions to ascertain that execution of data in the repositories only occurs for valid indices. On checking the Qt Creator application building logs, there is an error that indicates that " index out range" error has occured for QList <T>::at() . This is not in my code; I am very sure about that. I am wondering if it is a thing to do with internal implementation of the QTableView class. I mean the way it resolves the indices of the selected items on the view so that when the said empty space is clicked for selection, an undefined behaviour occurs or a bug manifestation suffices. For this application, the empty white space is critical and useful, supposing that there is work around this behavour of crashing.

            PLEASE SOMEONE HELP. THANK YOU.**

            VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by VRonin
            #5

            @base_load said in STRANGE BEHAVIOUR OF QTableView and QFileDialog:

            This is not in my code; I am very sure about that.

            Still in the "denial" stage of grief, I see. Don't worry, we've all been there.

            Regarding the 2 crashes posting the stack trace would help us a lot in guessing what the problem might be.

            Regarding the sizing problem, what layout are you using and/or did you call setSizeAdjustPolicy on the view?

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            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