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. turn off elide in column of qtablewidget
Forum Updated to NodeBB v4.3 + New Features

turn off elide in column of qtablewidget

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 4 Posters 2.5k Views
  • 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.
  • S sawarsi

    @eyllanesc ok i will see if i can setup a simple example

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

    @sawarsi Also before you start put a breakpoint/debug message into your code to make 100% sure your override is getting called.

    S 2 Replies Last reply
    0
    • JonBJ JonB

      @sawarsi Also before you start put a breakpoint/debug message into your code to make 100% sure your override is getting called.

      S Offline
      S Offline
      sawarsi
      wrote on last edited by
      #10

      @JonB yes it is getting hit.

      1 Reply Last reply
      1
      • JonBJ JonB

        @sawarsi Also before you start put a breakpoint/debug message into your code to make 100% sure your override is getting called.

        S Offline
        S Offline
        sawarsi
        wrote on last edited by
        #11

        @JonB what i did notice in the debugger is that each of the cells in the second column i have put in text but when i print the text in initStyleOption then it is always "".

        so is setItemDelegateForColumn(1,...) the correct way of doing this?

        1 Reply Last reply
        0
        • S sawarsi

          @eyllanesc ok i will see if i can setup a simple example

          S Offline
          S Offline
          sawarsi
          wrote on last edited by
          #12

          @sawarsi nevermind it was my fault your suggestion is flawless.

          1 Reply Last reply
          0
          • eyllanescE eyllanesc

            @sawarsi Could you provide a minimum reproducible example? Maybe the error is another.

            S Offline
            S Offline
            sawarsi
            wrote on last edited by
            #13

            @eyllanesc thanks for the help.

            1 Reply Last reply
            0
            • S sawarsi

              @eyllanesc ok i will see if i can setup a simple example

              S Offline
              S Offline
              sawarsi
              wrote on last edited by
              #14

              @sawarsi one thing i did notice is that this works just fine in linux but fails on windows any hints?

              eyllanescE 1 Reply Last reply
              0
              • eyllanescE eyllanesc

                @sawarsi Could you provide a minimum reproducible example? Maybe the error is another.

                S Offline
                S Offline
                sawarsi
                wrote on last edited by
                #15

                @eyllanesc one thing i did notice is that this works just fine in linux but fails on windows any hints?

                1 Reply Last reply
                0
                • S sawarsi

                  @sawarsi one thing i did notice is that this works just fine in linux but fails on windows any hints?

                  eyllanescE Offline
                  eyllanescE Offline
                  eyllanesc
                  wrote on last edited by
                  #16

                  @sawarsi As can be seen in the source code of "paint", the QStyle is used to make the painting, so the style probably does not use some option properties, a possible solution is to use another style like: app.setStyle("fusion" );

                  If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

                  S 1 Reply Last reply
                  0
                  • eyllanescE eyllanesc

                    @sawarsi As can be seen in the source code of "paint", the QStyle is used to make the painting, so the style probably does not use some option properties, a possible solution is to use another style like: app.setStyle("fusion" );

                    S Offline
                    S Offline
                    sawarsi
                    wrote on last edited by
                    #17

                    @eyllanesc i tried all the Windows styles (Windows and Fusion) and neither worked it may be that Windows mandates ellipses. i am not sure anyway, i am going to mark this solved.

                    1 Reply Last reply
                    0
                    • eyllanescE eyllanesc

                      @sawarsi You have to override the initStyleOption method

                      class StyledItemDelegate: public QStyledItemDelegate
                      {
                      public:
                          using QStyledItemDelegate::QStyledItemDelegate;
                      protected:
                          void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override
                          {
                              QStyledItemDelegate::initStyleOption(option, index);
                              option->textElideMode = Qt::ElideNone;
                          }
                      };
                      
                      C Offline
                      C Offline
                      CEO.
                      wrote on last edited by
                      #18

                      @eyllanesc I admire you a lot. This is one of the best ways for an informed person to respond to a question. Anyone asking question is usually confused and an illustrative answer is the best. I notice you always go out of your way to give a practical example. Honestly if you have a class where you teach students, I would love to be one of your students.

                      Thank you very much.

                      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