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. QTreeView and its signals, and setting directory of its QFileSystemModel
Qt 6.11 is out! See what's new in the release blog

QTreeView and its signals, and setting directory of its QFileSystemModel

Scheduled Pinned Locked Moved General and Desktop
13 Posts 2 Posters 3.6k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    Did you check if you get any error about signals and slots in the application output panel ? If not, are you sure you are printing something that currently contains something ?

    IIRC, you need to call setRootPath on your QFileSystemModel

    Hope it helps

    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
    • Y Offline
      Y Offline
      yodermk
      wrote on last edited by
      #3

      Well the setRootPath helped it be more navigable, but did not make the signals work.

      Just to be sure, I addd a qDebug("hello world") above the line printing the index value. Still I see nothing.

      Thanks!

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

        Did you check if you had any warnings on the console ?

        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
        • Y Offline
          Y Offline
          yodermk
          wrote on last edited by
          #5

          Yes - there were no warnings at all on the console.

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

            Does your QTreeWidget get populated correctly ?

            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
            • Y Offline
              Y Offline
              yodermk
              wrote on last edited by
              #7

              Seems to be. I can definitely navigate the filesystem with it.

              I am starting to wonder if only the Enter key can send these signals on Linux, and in my case Enter is closing the dialog. That wouldn't make much sense with clicked() though.

              Ultimately I want a signal to fire when a user clicks or moves the highlight through the tree with the arrow keys.

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

                Then it should be the activated signal IIRC

                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
                • Y Offline
                  Y Offline
                  yodermk
                  wrote on last edited by
                  #9

                  Yeah, that's what I thought too, and it's the first one I tried; it's just not getting fired!

                  I guess I should try to come up with a minimal example and see if it works there.

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

                    In between, what version of Qt and what OS are you using ?

                    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
                    • Y Offline
                      Y Offline
                      yodermk
                      wrote on last edited by
                      #11

                      qt 5.3.1 on Arch Linux, from the Arch repos....

                      1 Reply Last reply
                      0
                      • Y Offline
                        Y Offline
                        yodermk
                        wrote on last edited by
                        #12

                        Guess I'll eat my words here. In the slot I added this:

                        @ QMessageBox::information(this, "test", "hello we reached the slot!");
                        @

                        and changed the signal to activated(), and it did show this when I clicked on an entry! (But not on moving the selection with the arrow keys.)

                        But that leaves the perplexing question of why these did not output anything.

                        @ qDebug("hello world\n");
                        qDebug(photoSelectionModel->data(index).toString().toLatin1());@

                        I've used qDebug before in this project ...

                        Thanks!

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

                          Add some defines somewhere in your pro file ?

                          Changed Qt version ? Release VS Debug ?

                          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

                          • Login

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