Batfly

13
reputation
6

Programmer: Matlab level : 12/20 C Level : 10/20 C++ level : 13/20 Python Level : 11/20 R level : 8/20

Scientist: Physics : 15/20 (Optics : 18/20 , Colorimetry : 20/20) Computer: 12/20 (+ Optics = Computer Vision : 15/20 ) Astronomy: 12/20 (Lost my passion a long time ago... I'll catch back sooner or later)

Let's improve that!

NOTE SAVE FOR LATER

Dynamic value and function don't show the value from QLineEdit.... why ? I make a function, precisely a method in a class called "read", reading in a text file to take a value.

From my main, I decide to use this function and take the value using the method "Read::readTxtFiile()" to display it from the widget "QLineEdit mValue" .

I verify and yes, the method read the good value, but the QLineEdit don't display it.... why ?

Is that a problem of Dynamic/Static I use on the instance Value ?

Ihm.h

Class Ihm : public Plugin
{
  (…)
  
  QWidget* mainWidget{nullptr};
  QLineEdit* mValue{nullptr};
  Read Value;

  (…)
}

Ihm.cpp

    QWidget* Ihm::setupUi()
    {
      mainWidget = new QWidget;
      QVboxLayout* mainLayout = new QVboxLayout(mainWidget);
      {
        mValue = new QLineEdit;
        mValue->setReadOnly(true);
        mValue->setText(“NA”);
        mainLayout->addWidget(mValue);
      }

      showValue();
      (...)
    }

  
Void Ihm::showValue()
{
  QString filePath = “C:/value.txt”;
  Read reader;
  reader.Read::readTxtFile(filePath);

  mValue->setText(Value.Read::mValue); // It don’t show the value read by the function. why ?
 }

Read.h

Class Read
{
  Void readTxtFile(QString path);
  QString mValue;
}

Read.cpp

Void Read::readTxtFile(QString path)
{
  (…)
  Foreach (word)
  {
    (…)

     if (…)
    
     mValue = word;  // it read perfectly the value in the text file

    (…)

  }