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. ListWidget Text size fixed
Forum Updated to NodeBB v4.3 + New Features

ListWidget Text size fixed

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 5 Posters 3.9k 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.
  • Prince_0912P Offline
    Prince_0912P Offline
    Prince_0912
    wrote on last edited by
    #2

    Hi @amarism ,
    These 2 link will help you.

    link 1 , link 2

    A 1 Reply Last reply
    0
    • Prince_0912P Prince_0912

      Hi @amarism ,
      These 2 link will help you.

      link 1 , link 2

      A Offline
      A Offline
      amarism
      wrote on last edited by amarism
      #3

      @Prince_0912 Both links are not useful for me. they all are discussing the font size and I am asking about the text size managing

      Prince_0912P 1 Reply Last reply
      0
      • A amarism

        @Prince_0912 Both links are not useful for me. they all are discussing the font size and I am asking about the text size managing

        Prince_0912P Offline
        Prince_0912P Offline
        Prince_0912
        wrote on last edited by
        #4

        @amarism ,
        You can try like this in your code,
        setSizeHint(QSize((listWidget->width()),((listWidget->height()))));

        JonBJ 1 Reply Last reply
        0
        • Prince_0912P Prince_0912

          @amarism ,
          You can try like this in your code,
          setSizeHint(QSize((listWidget->width()),((listWidget->height()))));

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

          @Prince_0912
          I don't know whether your code does what the OP wants, nor what widget you are calling setSizeHint() on, but it won't be right to be using QListWidget::height() in particular, if anything it will need to be QListWidgetItem::height().

          1 Reply Last reply
          0
          • Prince_0912P Offline
            Prince_0912P Offline
            Prince_0912
            wrote on last edited by
            #6

            @JonB
            I'm refer from link.
            like in this way it can be solved

            JonBJ 1 Reply Last reply
            0
            • Prince_0912P Prince_0912

              @JonB
              I'm refer from link.
              like in this way it can be solved

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

              @Prince_0912
              In that link the example is:

              QListWidgetItem->setSizeHint(QSize((listWidget->width()),(listWidget->height()/4)));
              

              which is quite different because it divides the list widget's height by 4 to fit 4 QListWidgetItems vertically. If the OP uses your suggestion, it won't come out anything like he is asking for. Up to you & him.

              A 1 Reply Last reply
              0
              • JonBJ JonB

                @Prince_0912
                In that link the example is:

                QListWidgetItem->setSizeHint(QSize((listWidget->width()),(listWidget->height()/4)));
                

                which is quite different because it divides the list widget's height by 4 to fit 4 QListWidgetItems vertically. If the OP uses your suggestion, it won't come out anything like he is asking for. Up to you & him.

                A Offline
                A Offline
                amarism
                wrote on last edited by amarism
                #8

                @JonB When I use this code it will convert the whole height into 4 part. But I need to just break the text whose extra than image and print just below the main original text.
                For Example, my extra text size is this and I want to cut the red part text and print below the text.

                0_1529581110212_textsize2.png

                jsulmJ 1 Reply Last reply
                0
                • A amarism

                  @JonB When I use this code it will convert the whole height into 4 part. But I need to just break the text whose extra than image and print just below the main original text.
                  For Example, my extra text size is this and I want to cut the red part text and print below the text.

                  0_1529581110212_textsize2.png

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

                  @amarism If I undesrand you correctly you need ward wrapping. I#M not sure QListWidget supports it, maybe you can do it via styles?

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

                  1 Reply Last reply
                  1
                  • VRoninV Offline
                    VRoninV Offline
                    VRonin
                    wrote on last edited by
                    #10

                    http://doc.qt.io/qt-5/qlistview.html#wordWrap-prop

                    "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

                    JonBJ 1 Reply Last reply
                    1
                    • VRoninV VRonin

                      http://doc.qt.io/qt-5/qlistview.html#wordWrap-prop

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

                      @VRonin
                      In that doc it states:

                      Please note that even if wrapping is enabled, the cell will not be expanded to make room for the text. It will print ellipsis for text that cannot be shown, according to the view's textElideMode.

                      I wonder whether it will expand vertically given that statement?

                      VRoninV A 2 Replies Last reply
                      0
                      • JonBJ JonB

                        @VRonin
                        In that doc it states:

                        Please note that even if wrapping is enabled, the cell will not be expanded to make room for the text. It will print ellipsis for text that cannot be shown, according to the view's textElideMode.

                        I wonder whether it will expand vertically given that statement?

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

                        @JonB said in ListWidget Text size fixed:

                        I wonder whether it will expand vertically given that statement?

                        Indeed it won't that's the job of the delegate's sizeHint method

                        "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
                        • JonBJ JonB

                          @VRonin
                          In that doc it states:

                          Please note that even if wrapping is enabled, the cell will not be expanded to make room for the text. It will print ellipsis for text that cannot be shown, according to the view's textElideMode.

                          I wonder whether it will expand vertically given that statement?

                          A Offline
                          A Offline
                          amarism
                          wrote on last edited by
                          #13

                          @JonB Wrapping is work for me. Thank you

                          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