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. QToolTip::showText() for tree view
Forum Updated to NodeBB v4.3 + New Features

QToolTip::showText() for tree view

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 4 Posters 1.3k 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 Ayush Gupta

    @mrjj said in QToolTip::showText() for tree view:

    cellRect

    I tried with this code but still the text is showing in wrong position i.e in upper left corner of treeview

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #7

    @Ayush-Gupta
    Confirm (debug out) what the cellRect.topLeft() is returning for you?

    1 Reply Last reply
    3
    • A Offline
      A Offline
      Ayush Gupta
      wrote on last edited by
      #8

      it shows
      QPoint(0,0)

      mrjjM 1 Reply Last reply
      0
      • A Ayush Gupta

        it shows
        QPoint(0,0)

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #9

        @Ayush-Gupta

        I would guess you then use an invalid index.
        so please check your index before use with
        index.isValid()

        If you ask visualRect(index); for an invalid index, you get invalid rect and hence 0,0

        So that is most likely what you are seeing.

        1 Reply Last reply
        2
        • A Offline
          A Offline
          Ayush Gupta
          wrote on last edited by
          #10

          @mrjj I tried
          index.isValid() it returns true for me.

          JonBJ mrjjM 2 Replies Last reply
          0
          • A Ayush Gupta

            @mrjj I tried
            index.isValid() it returns true for me.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #11
            This post is deleted!
            1 Reply Last reply
            0
            • A Ayush Gupta

              @mrjj I tried
              index.isValid() it returns true for me.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #12

              @Ayush-Gupta

              Without your actual code and details
              i cannot guess why it does not work for you
              since it worked well in a sample.

              1 Reply Last reply
              3
              • A Offline
                A Offline
                Ayush Gupta
                wrote on last edited by
                #13

                I am using QSortFilterProxyModel also in my tree view with my custom model?
                Would it be a cause ?

                mrjjM 1 Reply Last reply
                0
                • A Ayush Gupta

                  I am using QSortFilterProxyModel also in my tree view with my custom model?
                  Would it be a cause ?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  @Ayush-Gupta

                  Yes it might
                  and would explain the index be valid but has no
                  VisualRect we can count on.

                  I did not test it.

                  Please see if using
                  proxy->mapToSource(Index);

                  Does return a valid cell rect.
                  Look the returned QRect and see if it has valid values or not.

                  1 Reply Last reply
                  2
                  • A Offline
                    A Offline
                    Ayush Gupta
                    wrote on last edited by
                    #15

                    doing that I got
                    ASSERT: "!"QSortFilterProxyModel: index from wrong model passed to mapToSource

                    mrjjM 1 Reply Last reply
                    0
                    • A Ayush Gupta

                      doing that I got
                      ASSERT: "!"QSortFilterProxyModel: index from wrong model passed to mapToSource

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #16

                      @Ayush-Gupta

                      ok, please consult the docs and make sure you are using it as intended. :)
                      also check the index you use is valid etc.

                      1 Reply Last reply
                      2

                      • Login

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