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. align to right
Qt 6.11 is out! See what's new in the release blog

align to right

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 3 Posters 744 Views 2 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 Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    Can somebody PLEASE suggest how to align the "appendPlainText " text to the right ?

       if(m_TAB_Connect)
        {
            // pass to debug window
            text = "Serial port      ";
            text += m_currentSettings.name;
            m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
    
            text = "Baud rate       ";
            text += QString::number(m_currentSettings.baudRate);
            m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
            text = "Data bits       ";
            text += QString::number(m_currentSettings.baudRate);
            m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
    
            text = "Parity         ";
            text += QString::number(m_currentSettings.baudRate);
            m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
    
            text = "Stop bits       ";
            text += m_ui->parityBox->currentText();
            m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
    
            text = "Flow control    ";
            text += m_ui->flowControlBox->currentText();
            m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
    
    
    
    
        }
        else
        {
    
        }
    

    ce1e0cf1-da01-4592-93f5-e7dd200f99c2-image.png

    Thank you.

    1 Reply Last reply
    0
    • A Anonymous_Banned275

      @AnneRanch ADDENDUM

      I think I found the solution, it needs tweaking...

          // BUG runs twice  ??
          if(m_TAB_Connect)
          {
              // pass to debug window
              text = "Serial port      ";
              int TextLenght = text.size();
      
              text += m_currentSettings.name;
              m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
      
              int FullTextLenght = text.size();
              if( FullTextLenght >TextLenght  )
               {
                  // BUG process
                  text = "  BUG process    ";
      
                  text = "Baud rate       ";
                  QString Temp =  QString::number(m_currentSettings.baudRate);
      
      TODO HERE 
                  Temp = Temp.rightJustified(FullTextLenght," ");''
      
      TODO HERE 
                  text += Temp;
                  //text += QString::number(m_currentSettings.baudRate);
                  m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
                  QString s = "apple";
                  QString t = s.rightJustified(8, '.');    // t == "...apple"
      
      
              }
      
      
      A Offline
      A Offline
      Anonymous_Banned275
      wrote on last edited by
      #6

      @AnneRanch SOLVED

      5bf6bc92-6cce-470c-8fc2-e342dbcd01dc-image.png

      1 Reply Last reply
      0
      • hskoglundH Online
        hskoglundH Online
        hskoglund
        wrote on last edited by hskoglund
        #2

        Hi, right-aligning I think does not help so much:
        Screenshot 2024-04-25 at 18.40.23.png Instead, perhaps you need to split them into 2 columns.

        A 1 Reply Last reply
        0
        • hskoglundH hskoglund

          Hi, right-aligning I think does not help so much:
          Screenshot 2024-04-25 at 18.40.23.png Instead, perhaps you need to split them into 2 columns.

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

          @hskoglund Whops,,, wrong description on my part
          I need this
          Serial port portUSB0
          Baud rate align 110

          align the value (110 ) with (portUSB0) on the right ( so the zeros are in same location - in this example ) , BUT "it" won't let me to type it in aligned...

          I thing I need to count the characters , get maximum count and then... what ?

          A 1 Reply Last reply
          0
          • Axel SpoerlA Offline
            Axel SpoerlA Offline
            Axel Spoerl
            Moderators
            wrote on last edited by
            #4

            You are appending plain text. The word plain implies that it can’t be formatted. See here, how it works. Reading documentation is always good.

            Software Engineer
            The Qt Company, Oslo

            1 Reply Last reply
            0
            • A Anonymous_Banned275

              @hskoglund Whops,,, wrong description on my part
              I need this
              Serial port portUSB0
              Baud rate align 110

              align the value (110 ) with (portUSB0) on the right ( so the zeros are in same location - in this example ) , BUT "it" won't let me to type it in aligned...

              I thing I need to count the characters , get maximum count and then... what ?

              A Offline
              A Offline
              Anonymous_Banned275
              wrote on last edited by
              #5

              @AnneRanch ADDENDUM

              I think I found the solution, it needs tweaking...

                  // BUG runs twice  ??
                  if(m_TAB_Connect)
                  {
                      // pass to debug window
                      text = "Serial port      ";
                      int TextLenght = text.size();
              
                      text += m_currentSettings.name;
                      m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
              
                      int FullTextLenght = text.size();
                      if( FullTextLenght >TextLenght  )
                       {
                          // BUG process
                          text = "  BUG process    ";
              
                          text = "Baud rate       ";
                          QString Temp =  QString::number(m_currentSettings.baudRate);
              
              TODO HERE 
                          Temp = Temp.rightJustified(FullTextLenght," ");''
              
              TODO HERE 
                          text += Temp;
                          //text += QString::number(m_currentSettings.baudRate);
                          m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
                          QString s = "apple";
                          QString t = s.rightJustified(8, '.');    // t == "...apple"
              
              
                      }
              
              
              A 1 Reply Last reply
              0
              • A Anonymous_Banned275

                @AnneRanch ADDENDUM

                I think I found the solution, it needs tweaking...

                    // BUG runs twice  ??
                    if(m_TAB_Connect)
                    {
                        // pass to debug window
                        text = "Serial port      ";
                        int TextLenght = text.size();
                
                        text += m_currentSettings.name;
                        m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
                
                        int FullTextLenght = text.size();
                        if( FullTextLenght >TextLenght  )
                         {
                            // BUG process
                            text = "  BUG process    ";
                
                            text = "Baud rate       ";
                            QString Temp =  QString::number(m_currentSettings.baudRate);
                
                TODO HERE 
                            Temp = Temp.rightJustified(FullTextLenght," ");''
                
                TODO HERE 
                            text += Temp;
                            //text += QString::number(m_currentSettings.baudRate);
                            m_TAB_Connect->ui->plainTextEdit->appendPlainText(text);
                            QString s = "apple";
                            QString t = s.rightJustified(8, '.');    // t == "...apple"
                
                
                        }
                
                
                A Offline
                A Offline
                Anonymous_Banned275
                wrote on last edited by
                #6

                @AnneRanch SOLVED

                5bf6bc92-6cce-470c-8fc2-e342dbcd01dc-image.png

                1 Reply Last reply
                0
                • A Anonymous_Banned275 has marked this topic as solved on

                • Login

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