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. update Text in LineEdit on the Go
Forum Updated to NodeBB v4.3 + New Features

update Text in LineEdit on the Go

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.1k 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.
  • D Offline
    D Offline
    davelnx
    wrote on last edited by
    #1

    I am trying to update the text on my linedit every time I get a frame, but my program crash. I tried doing the same with a loop, but the window shows only after the loop has finished. setH() is my slot, in Debug mode it run perfectly, the problem is when trying to update the text in LineEdit while the programm is running(the mainwindow is on the screen) . Thank you
    void MainWindow::updatehand(){
    if (controller.isConnected()){
    int hc =frame.hands().count();
    QString hndc= QString::number(hc);
    emit hChanged(hndc);
    }
    }void MainWindow::setH(const QString hndc){
    MainWindow::handsRead->setText(hndc);
    m_hands++;
    updatehand();

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

      Hi and welcome to devnet,

      Did you properly initialize handsRead ?

      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
      • D Offline
        D Offline
        davelnx
        wrote on last edited by
        #3

        Thank you for the answer,
        I initialize in the mainwindwo.h file
        QLineEdit *handsRead;

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

          You are declaring a pointer to a QLineEdit, that's not the initialization.

          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
          • D Offline
            D Offline
            davelnx
            wrote on last edited by
            #5

            (Have only one post every 5 minutes, I am new Here)
            Yes, I did.
            connect(this, SIGNAL(hChanged(const QString)),
            this, SLOT(setH(const QString)));
            handsRead = new QLineEdit();
            handsRead->setMaximumWidth(40);
            handsRead->setDisabled(1);
            the text is updated only before the mainwindow is shown, after that if I try to update handsRead, the program crash, it is receiving information constantly

            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