Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved How to make a comment bar in Qt?

    General and Desktop
    3
    10
    95
    Loading More Posts
    • 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.
    • W
      Wgxzzzzzzc last edited by

      I want make a comment bar where every review comes from the database. My idea is that i use Model/View to make it, Every review will be put in a view item.But i don't kow how to make each view item to adapt its height according to the number of review. Would anyone like to help me with the answer?

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        Hi
        Im not sure how a comment bar looks like but
        cant you just adjust each row's height ?

        1 Reply Last reply Reply Quote 1
        • W
          Wgxzzzzzzc last edited by Wgxzzzzzzc

          @mrjj I can adjust ervery item's height in QTreeView, but ervery item can't switch row automatically. this is my project.
          捕获.PNG

          mrjj 1 Reply Last reply Reply Quote 0
          • mrjj
            mrjj Lifetime Qt Champion @Wgxzzzzzzc last edited by

            @Wgxzzzzzzc said in How to make a comment bar in Qt?:

            • item can't switch row automatically

            Im not sure what you mean ?
            You mean if text is very long then it wont word break within the cell or what do you mean with
            switch row ?

            W 1 Reply Last reply Reply Quote 1
            • W
              Wgxzzzzzzc @mrjj last edited by

              @mrjj my mean is that i want every view item like this picture. sorry, my english is not good.
              捕获.PNG

              mrjj 1 Reply Last reply Reply Quote 0
              • Christian Ehrlicher
                Christian Ehrlicher Lifetime Qt Champion last edited by

                So it's a simple QTextEdit?

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                1 Reply Last reply Reply Quote 2
                • mrjj
                  mrjj Lifetime Qt Champion @Wgxzzzzzzc last edited by mrjj

                  @Wgxzzzzzzc
                  Hi
                  No problem with the English. i just ask a bit more to make sure i understand.

                  Did you try to call view->resizeRowsToContents();
                  to have it expand the row ? It should do wordwrap by default.

                  W 1 Reply Last reply Reply Quote 1
                  • W
                    Wgxzzzzzzc @mrjj last edited by

                    @mrjj But my view is QTreeView and there isn't an tableWidget in the view. the picture is my code. I just want every view item's behavior like textEdit.
                    捕获.PNG

                    mrjj 1 Reply Last reply Reply Quote 0
                    • mrjj
                      mrjj Lifetime Qt Champion @Wgxzzzzzzc last edited by

                      @Wgxzzzzzzc
                      Ah sorry its a treeView. I read table :)

                      try
                      ui->mytreeview->header()->resizeSections(QHeaderView::ResizeToContents);

                      1 Reply Last reply Reply Quote 0
                      • W
                        Wgxzzzzzzc last edited by

                        @mrjj I think using QListWidget and customizing my item is a good way. but still thank you very much!

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post