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. How to add space to QLabel

How to add space to QLabel

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 3.4k 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.
  • B Offline
    B Offline
    Bharth
    wrote on last edited by
    #1

    hi guys,,

    im trying to do chat,,
    if i type message in textedit and enter send button its showing in Qlabel but if give space between two text its considering next line , i want that in same line
    please help me0_1551332181273_1551332130780.JPEG

    thanks in advance

    jsulmJ 1 Reply Last reply
    0
    • B Bharth

      hi guys,,

      im trying to do chat,,
      if i type message in textedit and enter send button its showing in Qlabel but if give space between two text its considering next line , i want that in same line
      please help me0_1551332181273_1551332130780.JPEG

      thanks in advance

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

      @Bharth Set this to false: https://doc.qt.io/qt-5/qlabel.html#wordWrap-prop

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

      1 Reply Last reply
      6
      • B Offline
        B Offline
        Bharth
        wrote on last edited by
        #3

        thank you so much now woking fine

        one more doubt please help me
        how to delete entire row i gave popUp option next to message like copy,edit,delete

        jsulmJ 1 Reply Last reply
        0
        • B Bharth

          thank you so much now woking fine

          one more doubt please help me
          how to delete entire row i gave popUp option next to message like copy,edit,delete

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

          @Bharth said in How to add space to QLabel:

          how to delete entire row i gave popUp option next to message like copy,edit,delete

          Sorry, I don't understand. What row do you want to remove and from where?

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

          1 Reply Last reply
          1
          • B Offline
            B Offline
            Bharth
            wrote on last edited by
            #5

            i have to delete message from listwidget(selected message should delete)
            ex: hi message is in above list right,,i have to delete that one

            jsulmJ 1 Reply Last reply
            0
            • B Bharth

              i have to delete message from listwidget(selected message should delete)
              ex: hi message is in above list right,,i have to delete that one

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

              @Bharth I'm sure you can. How exactly depends on how all this is implemented. Where are these QLabels inserted?

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

              1 Reply Last reply
              1
              • B Offline
                B Offline
                Bharth
                wrote on last edited by
                #7

                in Qlistwidet,,,, i created separete widget class for label then im adding that to qlistwidget,,,
                this is the class for qlabel and for copy ,edit im passing string but what to pass for delete entire row
                ..................................................
                connect(pCopyText, &QAction::triggered, this
                {
                (dynamic_cast<ChatPage*>(m_pParentWidget))->copyText(p_mstr);
                });
                connect(pDeleteText, &QAction::triggered, this
                {
                (dynamic_cast<ChatPage*>(m_pParentWidget))->deleteText();
                });
                connect(pEditText, &QAction::triggered, this
                {
                (dynamic_cast<ChatPage*>(m_pParentWidget))->editText(p_mstr);
                });

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

                  Hi,

                  Why are you using QLabel if you have a QListWidget anyway ?

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

                    we can directly insert meassage to Qlistwidget,,,for server integration, we must need qlist object to save datas from server. so i created separate cell for sender side and reciver side then i added these to Qlistwidget

                    jsulmJ 1 Reply Last reply
                    0
                    • B Bharth

                      we can directly insert meassage to Qlistwidget,,,for server integration, we must need qlist object to save datas from server. so i created separate cell for sender side and reciver side then i added these to Qlistwidget

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

                      @Bharth I think what @SGaist wants to say is that you already can add text entries to a QListWidget without the need to create QLabel (see https://doc.qt.io/qt-5/qlistwidget.html#addItem and https://doc.qt.io/qt-5/qlistwidget.html#addItems). So, still not clear why you create and insert QLabel instances.
                      To remove a row use https://doc.qt.io/qt-5/qlistwidget.html#takeItem

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

                      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