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. ptrinting content in text edit

ptrinting content in text edit

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 271 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.
  • K Offline
    K Offline
    kook
    wrote on last edited by
    #1

    Greetings....
    i have a list widget when i press on the listwidget item its content should get printed in the text edit
    void MainWindow::on_listWidget_itemPressed(QListWidgetItem *item)
    {

    ui->textEdit->setText("Messagename = ");
    ui->textEdit->append(item->text());
    

    }
    i want the item->text to be printed after the message =
    like this Messagename = message1

    since i am using append its getting printed in the next line but i want it to get printed beside "Messagename = " i dont know how to do that someone please suggest a way

    thanks in advance

    jsulmJ 1 Reply Last reply
    0
    • K kook

      Greetings....
      i have a list widget when i press on the listwidget item its content should get printed in the text edit
      void MainWindow::on_listWidget_itemPressed(QListWidgetItem *item)
      {

      ui->textEdit->setText("Messagename = ");
      ui->textEdit->append(item->text());
      

      }
      i want the item->text to be printed after the message =
      like this Messagename = message1

      since i am using append its getting printed in the next line but i want it to get printed beside "Messagename = " i dont know how to do that someone please suggest a way

      thanks in advance

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

      @kook

      void MainWindow::on_listWidget_itemPressed(QListWidgetItem *item)
      {
          ui->textEdit->setText(QString("Messagename = %1").arg(item->text()));
      }
      

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

      K 1 Reply Last reply
      1
      • jsulmJ jsulm

        @kook

        void MainWindow::on_listWidget_itemPressed(QListWidgetItem *item)
        {
            ui->textEdit->setText(QString("Messagename = %1").arg(item->text()));
        }
        
        K Offline
        K Offline
        kook
        wrote on last edited by
        #3

        @jsulm thank you so much it works :)

        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