Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. How can I send output to a widget
Forum Updated to NodeBB v4.3 + New Features

How can I send output to a widget

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
23 Posts 6 Posters 9.3k Views 4 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
    DocDJ
    wrote on last edited by
    #1

    I am building a trivial "desk calculator" to learn ho w to use QT. It has 2 dialog boxes for inputting 2 numbers to be multiplied. It has a QtextEdit called "answerbox". I cannot figure out how to get the reqult into the answerbox. When I compile, I get the error, "answerbox is a non-class type QTextEdit".

    M 1 Reply Last reply
    0
    • D DocDJ

      I am building a trivial "desk calculator" to learn ho w to use QT. It has 2 dialog boxes for inputting 2 numbers to be multiplied. It has a QtextEdit called "answerbox". I cannot figure out how to get the reqult into the answerbox. When I compile, I get the error, "answerbox is a non-class type QTextEdit".

      M Offline
      M Offline
      mostefa
      wrote on last edited by
      #2

      @DocDJ said in How can I send output to a widget:

      I am building a trivial "desk calculator" to learn ho w to use QT. It has 2 dialog boxes for inputting 2 numbers to be multiplied. It has a QtextEdit called "answerbox". I cannot figure out how to get the reqult into the answerbox. When I compile, I get the error, "answerbox is a non-class type QTextEdit".

      Hi @DocDJ can you share your code ? or at least a sample?

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

        Hi,

        Didn't you forgot to #include <QTextEdit> in the file where you use that class ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        D 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Didn't you forgot to #include <QTextEdit> in the file where you use that class ?

          D Offline
          D Offline
          DocDJ
          wrote on last edited by
          #4

          @SGaist Thanks for the quick reply. The #include <QTextEdit> is present. Here's my code:
          #include <QtGui>
          #include "djdialog1.h"
          #include <sstream>
          #include <string>
          #include <QTextEdit>

          int int1, int2, answer;
          djdialog1::djdialog1(QWidget *parent)
          : QDialog(parent)
          {
          connect(int1box, SIGNAL(textChanged(const QString &)),
          this, SLOT(on_int1box_textChanged()));
          connect(int2box, SIGNAL(textChanged(const QString &)),
          this, SLOT(on_int2box_textChanged()));
          connect(GoButton, SIGNAL(clicked()), this, SLOT(accept()));
          }
          void djdialog1::on_GoButton_clicked()
          {
          QString qreply;
          qreply=QString::number(answer);
          answerbox.setText(qreply);
          }
          void djdialog1::on_int1box_textChanged(const QString &arg)
          {bool ok;
          int1 = arg.toInt(&ok,10);
          }
          void djdialog1::on_int2box_textChanged(const QString &arg)
          {bool ok;
          int2 = arg.toInt(&ok,10);
          }

          jsulmJ FlotisableF J.HilkJ 3 Replies Last reply
          0
          • D DocDJ

            @SGaist Thanks for the quick reply. The #include <QTextEdit> is present. Here's my code:
            #include <QtGui>
            #include "djdialog1.h"
            #include <sstream>
            #include <string>
            #include <QTextEdit>

            int int1, int2, answer;
            djdialog1::djdialog1(QWidget *parent)
            : QDialog(parent)
            {
            connect(int1box, SIGNAL(textChanged(const QString &)),
            this, SLOT(on_int1box_textChanged()));
            connect(int2box, SIGNAL(textChanged(const QString &)),
            this, SLOT(on_int2box_textChanged()));
            connect(GoButton, SIGNAL(clicked()), this, SLOT(accept()));
            }
            void djdialog1::on_GoButton_clicked()
            {
            QString qreply;
            qreply=QString::number(answer);
            answerbox.setText(qreply);
            }
            void djdialog1::on_int1box_textChanged(const QString &arg)
            {bool ok;
            int1 = arg.toInt(&ok,10);
            }
            void djdialog1::on_int2box_textChanged(const QString &arg)
            {bool ok;
            int2 = arg.toInt(&ok,10);
            }

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

            @DocDJ Can you show the header file, so we can see how answerbox is declared. Also can you please post the whole error message?

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

            1 Reply Last reply
            0
            • D DocDJ

              @SGaist Thanks for the quick reply. The #include <QTextEdit> is present. Here's my code:
              #include <QtGui>
              #include "djdialog1.h"
              #include <sstream>
              #include <string>
              #include <QTextEdit>

              int int1, int2, answer;
              djdialog1::djdialog1(QWidget *parent)
              : QDialog(parent)
              {
              connect(int1box, SIGNAL(textChanged(const QString &)),
              this, SLOT(on_int1box_textChanged()));
              connect(int2box, SIGNAL(textChanged(const QString &)),
              this, SLOT(on_int2box_textChanged()));
              connect(GoButton, SIGNAL(clicked()), this, SLOT(accept()));
              }
              void djdialog1::on_GoButton_clicked()
              {
              QString qreply;
              qreply=QString::number(answer);
              answerbox.setText(qreply);
              }
              void djdialog1::on_int1box_textChanged(const QString &arg)
              {bool ok;
              int1 = arg.toInt(&ok,10);
              }
              void djdialog1::on_int2box_textChanged(const QString &arg)
              {bool ok;
              int2 = arg.toInt(&ok,10);
              }

              FlotisableF Offline
              FlotisableF Offline
              Flotisable
              wrote on last edited by
              #6

              @DocDJ
              can you provide the header code?

              D 1 Reply Last reply
              0
              • D DocDJ

                @SGaist Thanks for the quick reply. The #include <QTextEdit> is present. Here's my code:
                #include <QtGui>
                #include "djdialog1.h"
                #include <sstream>
                #include <string>
                #include <QTextEdit>

                int int1, int2, answer;
                djdialog1::djdialog1(QWidget *parent)
                : QDialog(parent)
                {
                connect(int1box, SIGNAL(textChanged(const QString &)),
                this, SLOT(on_int1box_textChanged()));
                connect(int2box, SIGNAL(textChanged(const QString &)),
                this, SLOT(on_int2box_textChanged()));
                connect(GoButton, SIGNAL(clicked()), this, SLOT(accept()));
                }
                void djdialog1::on_GoButton_clicked()
                {
                QString qreply;
                qreply=QString::number(answer);
                answerbox.setText(qreply);
                }
                void djdialog1::on_int1box_textChanged(const QString &arg)
                {bool ok;
                int1 = arg.toInt(&ok,10);
                }
                void djdialog1::on_int2box_textChanged(const QString &arg)
                {bool ok;
                int2 = arg.toInt(&ok,10);
                }

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                @DocDJ

                Hi,

                seems like you created the QTextEdit answerbox in the QT-Designer, Drag & Drop onto your MainWidget?

                That is fine, and really, the normal way to do it. But to access elements of your Designer you have to reference them.
                The default in QT-classes is a UI-Pointer in your case most likly ui, therefore:

                //Change it to this:
                ui->answerbox->setText(qreply);
                

                And you should not get the error any more.


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                1 Reply Last reply
                0
                • FlotisableF Flotisable

                  @DocDJ
                  can you provide the header code?

                  D Offline
                  D Offline
                  DocDJ
                  wrote on last edited by DocDJ
                  #8

                  @Flotisable
                  Here is my header code:

                  #ifndef djdialog1_H
                  #define djdialog1_H

                  #include <QDialog>
                  #include "ui_djdialog1.h"

                  class djdialog1 : public QDialog, public Ui::djdialog1
                  {
                  Q_OBJECT
                  public:
                  djdialog1(QWidget *parent = 0);
                  private slots:
                  void on_int1box_textChanged(const QString &);
                  void on_int2box_textChanged(const QString &);
                  void on_GoButton_clicked();
                  };
                  #endif

                  and here is the entire error message:
                  djdialog1.cpp:43:: error: request for member 'setText' in '((djdialog1*)this)->
                  djdialog1::<anonymous>.Ui::djdialog1::<anonymous>.Ui_djdialog1::answerbox'
                  which is of non-class type 'QTextEdit*'

                  I also tried: ui->answerbox->setText(qreply) and that said, "ui was not declared in this scope".

                  M 1 Reply Last reply
                  0
                  • D DocDJ

                    @Flotisable
                    Here is my header code:

                    #ifndef djdialog1_H
                    #define djdialog1_H

                    #include <QDialog>
                    #include "ui_djdialog1.h"

                    class djdialog1 : public QDialog, public Ui::djdialog1
                    {
                    Q_OBJECT
                    public:
                    djdialog1(QWidget *parent = 0);
                    private slots:
                    void on_int1box_textChanged(const QString &);
                    void on_int2box_textChanged(const QString &);
                    void on_GoButton_clicked();
                    };
                    #endif

                    and here is the entire error message:
                    djdialog1.cpp:43:: error: request for member 'setText' in '((djdialog1*)this)->
                    djdialog1::<anonymous>.Ui::djdialog1::<anonymous>.Ui_djdialog1::answerbox'
                    which is of non-class type 'QTextEdit*'

                    I also tried: ui->answerbox->setText(qreply) and that said, "ui was not declared in this scope".

                    M Offline
                    M Offline
                    mostefa
                    wrote on last edited by mostefa
                    #9

                    @DocDJ said in How can I send output to a widget:

                    @Flotisable
                    Here is my header code:

                    #ifndef djdialog1_H
                    #define djdialog1_H

                    #include <QDialog>
                    #include "ui_djdialog1.h"

                    class djdialog1 : public QDialog, public Ui::djdialog1
                    {
                    Q_OBJECT
                    public:
                    djdialog1(QWidget *parent = 0);
                    private slots:
                    void on_int1box_textChanged(const QString &);
                    void on_int2box_textChanged(const QString &);
                    void on_GoButton_clicked();
                    };
                    #endif

                    and here is the entire error message:
                    djdialog1.cpp:43:: error: request for member 'setText' in '((djdialog1*)this)->
                    djdialog1::<anonymous>.Ui::djdialog1::<anonymous>.Ui_djdialog1::answerbox'
                    which is of non-class type 'QTextEdit*'

                    I also tried: ui->answerbox->setText(qreply) and that said, "ui was not declared in this scope".

                    Your problem is due to a missing namespace Ui, normally this namespace is generated with qtcreator when new designer form class is added, why do you delete them?

                    http://doc.qt.io/qt-5/designer-using-a-ui-file.html

                    To fix your problem you can add these lines ,

                    on your .h

                    #ifndef djdialog1_H
                    #define djdialog1_H
                    
                    #include <QDialog>
                    #include "ui_djdialog1.h"
                    
                    
                    // add namespace Ui to your .H
                    namespace Ui {
                        class djdialog1;
                    }
                    class djdialog1 : public QDialog, public Ui::djdialog1
                    {
                    Q_OBJECT
                    public:
                    djdialog1(QWidget *parent = 0);
                    private slots:
                    void on_int1box_textChanged(const QString &);
                    void on_int2box_textChanged(const QString &);
                    void on_GoButton_clicked();
                    
                    private:
                        Ui::djdialog1 *ui;//Add uiVar member
                    };
                    #endif
                    

                    And your .cpp

                    #include <QtGui>
                    #include "djdialog1.h"
                    #include <sstream>
                    #include <string>
                    #include <QTextEdit>
                    
                    int int1, int2, answer;
                    djdialog1::djdialog1(QWidget *parent)
                        : QDialog(parent),
                          ui(new Ui::djdialog1)// initialize ui
                    {
                    ui->setupUi(this);//setup Ui
                    connect(int1box, SIGNAL(textChanged(const QString &)),
                    this, SLOT(on_int1box_textChanged()));
                    connect(int2box, SIGNAL(textChanged(const QString &)),
                    this, SLOT(on_int2box_textChanged()));
                    connect(GoButton, SIGNAL(clicked()), this, SLOT(accept()));
                    }
                    void djdialog1::on_GoButton_clicked()
                    {
                    QString qreply;
                    qreply=QString::number(answer);
                    ui->answerbox->setText(qreply);//anserbox from ui
                    }
                    void djdialog1::on_int1box_textChanged(const QString &arg)
                    {bool ok;
                    int1 = arg.toInt(&ok,10);
                    }
                    void djdialog1::on_int2box_textChanged(const QString &arg)
                    {bool ok;
                    int2 = arg.toInt(&ok,10);
                    }
                    

                    But i advice you to clean this class and add correctly a new designer form class:

                    https://www.youtube.com/watch?v=Gpp6dHx4mVw

                    Hope this can help ,

                    Best regards !

                    D 1 Reply Last reply
                    1
                    • M mostefa

                      @DocDJ said in How can I send output to a widget:

                      @Flotisable
                      Here is my header code:

                      #ifndef djdialog1_H
                      #define djdialog1_H

                      #include <QDialog>
                      #include "ui_djdialog1.h"

                      class djdialog1 : public QDialog, public Ui::djdialog1
                      {
                      Q_OBJECT
                      public:
                      djdialog1(QWidget *parent = 0);
                      private slots:
                      void on_int1box_textChanged(const QString &);
                      void on_int2box_textChanged(const QString &);
                      void on_GoButton_clicked();
                      };
                      #endif

                      and here is the entire error message:
                      djdialog1.cpp:43:: error: request for member 'setText' in '((djdialog1*)this)->
                      djdialog1::<anonymous>.Ui::djdialog1::<anonymous>.Ui_djdialog1::answerbox'
                      which is of non-class type 'QTextEdit*'

                      I also tried: ui->answerbox->setText(qreply) and that said, "ui was not declared in this scope".

                      Your problem is due to a missing namespace Ui, normally this namespace is generated with qtcreator when new designer form class is added, why do you delete them?

                      http://doc.qt.io/qt-5/designer-using-a-ui-file.html

                      To fix your problem you can add these lines ,

                      on your .h

                      #ifndef djdialog1_H
                      #define djdialog1_H
                      
                      #include <QDialog>
                      #include "ui_djdialog1.h"
                      
                      
                      // add namespace Ui to your .H
                      namespace Ui {
                          class djdialog1;
                      }
                      class djdialog1 : public QDialog, public Ui::djdialog1
                      {
                      Q_OBJECT
                      public:
                      djdialog1(QWidget *parent = 0);
                      private slots:
                      void on_int1box_textChanged(const QString &);
                      void on_int2box_textChanged(const QString &);
                      void on_GoButton_clicked();
                      
                      private:
                          Ui::djdialog1 *ui;//Add uiVar member
                      };
                      #endif
                      

                      And your .cpp

                      #include <QtGui>
                      #include "djdialog1.h"
                      #include <sstream>
                      #include <string>
                      #include <QTextEdit>
                      
                      int int1, int2, answer;
                      djdialog1::djdialog1(QWidget *parent)
                          : QDialog(parent),
                            ui(new Ui::djdialog1)// initialize ui
                      {
                      ui->setupUi(this);//setup Ui
                      connect(int1box, SIGNAL(textChanged(const QString &)),
                      this, SLOT(on_int1box_textChanged()));
                      connect(int2box, SIGNAL(textChanged(const QString &)),
                      this, SLOT(on_int2box_textChanged()));
                      connect(GoButton, SIGNAL(clicked()), this, SLOT(accept()));
                      }
                      void djdialog1::on_GoButton_clicked()
                      {
                      QString qreply;
                      qreply=QString::number(answer);
                      ui->answerbox->setText(qreply);//anserbox from ui
                      }
                      void djdialog1::on_int1box_textChanged(const QString &arg)
                      {bool ok;
                      int1 = arg.toInt(&ok,10);
                      }
                      void djdialog1::on_int2box_textChanged(const QString &arg)
                      {bool ok;
                      int2 = arg.toInt(&ok,10);
                      }
                      

                      But i advice you to clean this class and add correctly a new designer form class:

                      https://www.youtube.com/watch?v=Gpp6dHx4mVw

                      Hope this can help ,

                      Best regards !

                      D Offline
                      D Offline
                      DocDJ
                      wrote on last edited by
                      #10

                      @mostefa Thanks for the lines to add. I do not have QtCreator, because a package for it is not available on the Linux platform I am using (ClefOS 6.6) on an older IBM z390 mainframe system that does not have the hardware support for the newer ClefOS system.

                      M 1 Reply Last reply
                      0
                      • D DocDJ

                        @mostefa Thanks for the lines to add. I do not have QtCreator, because a package for it is not available on the Linux platform I am using (ClefOS 6.6) on an older IBM z390 mainframe system that does not have the hardware support for the newer ClefOS system.

                        M Offline
                        M Offline
                        mostefa
                        wrote on last edited by
                        #11

                        @DocDJ said in How can I send output to a widget:

                        @mostefa Thanks for the lines to add. I do not have QtCreator, because a package for it is not available on the Linux platform I am using (ClefOS 6.6) on an older IBM z390 mainframe system that does not have the hardware support for the newer ClefOS system.

                        Ok ,

                        So your app work for now?

                        D 1 Reply Last reply
                        0
                        • M mostefa

                          @DocDJ said in How can I send output to a widget:

                          @mostefa Thanks for the lines to add. I do not have QtCreator, because a package for it is not available on the Linux platform I am using (ClefOS 6.6) on an older IBM z390 mainframe system that does not have the hardware support for the newer ClefOS system.

                          Ok ,

                          So your app work for now?

                          D Offline
                          D Offline
                          DocDJ
                          wrote on last edited by
                          #12

                          @mostefa Still does not work. NO errors, but no results in answerbox.

                          M 1 Reply Last reply
                          0
                          • D DocDJ

                            @mostefa Still does not work. NO errors, but no results in answerbox.

                            M Offline
                            M Offline
                            mostefa
                            wrote on last edited by
                            #13

                            @DocDJ said in How can I send output to a widget:

                            @mostefa Still does not work. NO errors, but no results in answerbox.

                            Your signal is not ok, your answer does not contain the result of any operation

                            Your signal

                            textChanged(const QString &) does not exist for QTextEdit

                            Have a look at available signals:

                            http://doc.qt.io/qt-4.8/qtextedit.html#signals

                            You have to use

                            textChanged();

                            So i changed your code and multiplication work for me:

                            Your header:

                            #ifndef djdialog1_H
                            #define djdialog1_H
                            
                            #include <QDialog>
                            #include "ui_djdialog1.h"
                            
                            
                            // add namespace Ui to your .H
                            namespace Ui {
                            class djdialog1;
                            }
                            class djdialog1 : public QDialog, public Ui::djdialog1
                            {
                                Q_OBJECT
                            public:
                                djdialog1(QWidget *parent = 0);
                            
                            private slots:
                                void onInt1boxTextChanged();// slot without arg
                                void onInt2boxTextChanged();// slot without arg
                            
                            you don't need an arg ui->int1box , ui->int2box will be ok
                            
                                void onGoButtonclicked();//just changed the name of the slot
                            
                            private:
                                Ui::djdialog1 *ui;//Add uiVar member
                            };
                            #endif
                            
                            #include <QtGui>
                            #include "djdialog1.h"
                            #include <sstream>
                            #include <string>
                            #include <QTextEdit>
                            
                            int int1, int2, answer;
                            djdialog1::djdialog1(QWidget *parent)
                                : QDialog(parent),
                                  ui(new Ui::djdialog1)// initialize ui
                            {
                                ui->setupUi(this);//setup Ui
                                connect(ui->int1box, SIGNAL(textChanged()),
                                        this, SLOT(onInt1boxTextChanged()));
                                connect(ui->int2box, SIGNAL(textChanged()),
                                        this, SLOT(onInt2boxTextChanged()));
                                connect(ui->GoButton, SIGNAL(clicked()), this, SLOT(onGoButtonclicked()));
                            }
                            void djdialog1::onGoButtonclicked()
                            {
                                QString qreply;
                            
                                answer = int1*int2;// your mathematic operation here
                                qreply=QString::number(answer);
                                ui->answerbox->setText(qreply);//anserbox from ui
                            }
                            void djdialog1::onInt1boxTextChanged()
                            {bool ok;
                                int1 = ui->int1box->toPlainText().toInt(&ok,10);
                            }
                            void djdialog1::onInt2boxTextChanged()
                            {bool ok;
                                int2 = ui->int2box->toPlainText().toInt(&ok,10);
                            }
                            

                            Hope this can help!

                            D 1 Reply Last reply
                            0
                            • M mostefa

                              @DocDJ said in How can I send output to a widget:

                              @mostefa Still does not work. NO errors, but no results in answerbox.

                              Your signal is not ok, your answer does not contain the result of any operation

                              Your signal

                              textChanged(const QString &) does not exist for QTextEdit

                              Have a look at available signals:

                              http://doc.qt.io/qt-4.8/qtextedit.html#signals

                              You have to use

                              textChanged();

                              So i changed your code and multiplication work for me:

                              Your header:

                              #ifndef djdialog1_H
                              #define djdialog1_H
                              
                              #include <QDialog>
                              #include "ui_djdialog1.h"
                              
                              
                              // add namespace Ui to your .H
                              namespace Ui {
                              class djdialog1;
                              }
                              class djdialog1 : public QDialog, public Ui::djdialog1
                              {
                                  Q_OBJECT
                              public:
                                  djdialog1(QWidget *parent = 0);
                              
                              private slots:
                                  void onInt1boxTextChanged();// slot without arg
                                  void onInt2boxTextChanged();// slot without arg
                              
                              you don't need an arg ui->int1box , ui->int2box will be ok
                              
                                  void onGoButtonclicked();//just changed the name of the slot
                              
                              private:
                                  Ui::djdialog1 *ui;//Add uiVar member
                              };
                              #endif
                              
                              #include <QtGui>
                              #include "djdialog1.h"
                              #include <sstream>
                              #include <string>
                              #include <QTextEdit>
                              
                              int int1, int2, answer;
                              djdialog1::djdialog1(QWidget *parent)
                                  : QDialog(parent),
                                    ui(new Ui::djdialog1)// initialize ui
                              {
                                  ui->setupUi(this);//setup Ui
                                  connect(ui->int1box, SIGNAL(textChanged()),
                                          this, SLOT(onInt1boxTextChanged()));
                                  connect(ui->int2box, SIGNAL(textChanged()),
                                          this, SLOT(onInt2boxTextChanged()));
                                  connect(ui->GoButton, SIGNAL(clicked()), this, SLOT(onGoButtonclicked()));
                              }
                              void djdialog1::onGoButtonclicked()
                              {
                                  QString qreply;
                              
                                  answer = int1*int2;// your mathematic operation here
                                  qreply=QString::number(answer);
                                  ui->answerbox->setText(qreply);//anserbox from ui
                              }
                              void djdialog1::onInt1boxTextChanged()
                              {bool ok;
                                  int1 = ui->int1box->toPlainText().toInt(&ok,10);
                              }
                              void djdialog1::onInt2boxTextChanged()
                              {bool ok;
                                  int2 = ui->int2box->toPlainText().toInt(&ok,10);
                              }
                              

                              Hope this can help!

                              D Offline
                              D Offline
                              DocDJ
                              wrote on last edited by
                              #14

                              @mostefa It still does not produce output. The only difference I can see between your version and mine is that my slot names have the _ character in them (e.g.; on_GoButton_textChanged). Could this make a difference? There are no compiler error or warning messages.

                              jsulmJ M 2 Replies Last reply
                              0
                              • D DocDJ

                                @mostefa It still does not produce output. The only difference I can see between your version and mine is that my slot names have the _ character in them (e.g.; on_GoButton_textChanged). Could this make a difference? There are no compiler error or warning messages.

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

                                @DocDJ Underscores doesn't matter.
                                You should really check whether all connect calls succeed.
                                Can you post your header and cpp file?

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

                                D 1 Reply Last reply
                                0
                                • D DocDJ

                                  @mostefa It still does not produce output. The only difference I can see between your version and mine is that my slot names have the _ character in them (e.g.; on_GoButton_textChanged). Could this make a difference? There are no compiler error or warning messages.

                                  M Offline
                                  M Offline
                                  mostefa
                                  wrote on last edited by
                                  #16

                                  @DocDJ said in How can I send output to a widget:

                                  @mostefa It still does not produce output. The only difference I can see between your version and mine is that my slot names have the _ character in them (e.g.; on_GoButton_textChanged). Could this make a difference? There are no compiler error or warning messages.

                                  I tested the code beofre i posted here and it work, looks like there is something you're doing wrong

                                  You said :
                                  There are no compiler error or warning messages.

                                  Ok

                                  But is there any output (errors/informations) when your app is running?

                                  1 Reply Last reply
                                  0
                                  • D Offline
                                    D Offline
                                    DocDJ
                                    wrote on last edited by
                                    #17

                                    Sorry I couldn't reply sooner. There are no error messages (compiling or running) , no output of any kind and my GUI window just sits there.

                                    1 Reply Last reply
                                    0
                                    • jsulmJ jsulm

                                      @DocDJ Underscores doesn't matter.
                                      You should really check whether all connect calls succeed.
                                      Can you post your header and cpp file?

                                      D Offline
                                      D Offline
                                      DocDJ
                                      wrote on last edited by
                                      #18

                                      @jsulm I have modified my code to be exactly like that posted by @mostefa

                                      M 1 Reply Last reply
                                      0
                                      • D DocDJ

                                        @jsulm I have modified my code to be exactly like that posted by @mostefa

                                        M Offline
                                        M Offline
                                        mostefa
                                        wrote on last edited by
                                        #19

                                        @DocDJ said in How can I send output to a widget:

                                        @jsulm I have modified my code to be exactly like that posted by @mostefa

                                        Could you share with us the content of your .ui file?

                                        D 1 Reply Last reply
                                        0
                                        • M mostefa

                                          @DocDJ said in How can I send output to a widget:

                                          @jsulm I have modified my code to be exactly like that posted by @mostefa

                                          Could you share with us the content of your .ui file?

                                          D Offline
                                          D Offline
                                          DocDJ
                                          wrote on last edited by
                                          #20

                                          @mostefa Here is my .ui file:
                                          <?xml version="1.0" encoding="UTF-8"?>
                                          <ui version="4.0">
                                          <class>djdialog1</class>
                                          <widget class="QDialog" name="djdialog1">
                                          <property name="windowModality">
                                          <enum>Qt::ApplicationModal</enum>
                                          </property>
                                          <property name="geometry">
                                          <rect>
                                          <x>0</x>
                                          <y>0</y>
                                          <width>334</width>
                                          <height>300</height>
                                          </rect>
                                          </property>
                                          <property name="windowTitle">
                                          <string>DJs-Dialog</string>
                                          </property>
                                          <widget class="QTextEdit" name="int1box">
                                          <property name="geometry">
                                          <rect>
                                          <x>73</x>
                                          <y>10</y>
                                          <width>61</width>
                                          <height>41</height>
                                          </rect>
                                          </property>
                                          <property name="toolTip">
                                          <string>int 1 here</string>
                                          </property>
                                          </widget>
                                          <widget class="QTextEdit" name="int2box">
                                          <property name="geometry">
                                          <rect>
                                          <x>73</x>
                                          <y>70</y>
                                          <width>61</width>
                                          <height>41</height>
                                          </rect>
                                          </property>
                                          </widget>
                                          <widget class="QLabel" name="label">
                                          <property name="geometry">
                                          <rect>
                                          <x>160</x>
                                          <y>10</y>
                                          <width>60</width>
                                          <height>31</height>
                                          </rect>
                                          </property>
                                          <property name="text">
                                          <string>first int</string>
                                          </property>
                                          <property name="alignment">
                                          <set>Qt::AlignCenter</set>
                                          </property>
                                          </widget>
                                          <widget class="QLabel" name="label_2">
                                          <property name="geometry">
                                          <rect>
                                          <x>160</x>
                                          <y>70</y>
                                          <width>91</width>
                                          <height>21</height>
                                          </rect>
                                          </property>
                                          <property name="text">
                                          <string>second int</string>
                                          </property>
                                          <property name="alignment">
                                          <set>Qt::AlignCenter</set>
                                          </property>
                                          </widget>
                                          <widget class="QTextEdit" name="answerbox">
                                          <property name="geometry">
                                          <rect>
                                          <x>70</x>
                                          <y>150</y>
                                          <width>104</width>
                                          <height>41</height>
                                          </rect>
                                          </property>
                                          </widget>
                                          <widget class="QLabel" name="label_3">
                                          <property name="geometry">
                                          <rect>
                                          <x>0</x>
                                          <y>80</y>
                                          <width>60</width>
                                          <height>31</height>
                                          </rect>
                                          </property>
                                          <property name="styleSheet">
                                          <string notr="true">color: rgb(0, 0, 255);
                                          font: 16pt "Bitstream Charter";</string>
                                          </property>
                                          <property name="text">
                                          <string>+</string>
                                          </property>
                                          <property name="alignment">
                                          <set>Qt::AlignCenter</set>
                                          </property>
                                          </widget>
                                          <widget class="QPushButton" name="GoButton">
                                          <property name="geometry">
                                          <rect>
                                          <x>90</x>
                                          <y>230</y>
                                          <width>87</width>
                                          <height>27</height>
                                          </rect>
                                          </property>
                                          <property name="text">
                                          <string>Compute</string>
                                          </property>
                                          </widget>
                                          <widget class="QPushButton" name="clearbutton">
                                          <property name="geometry">
                                          <rect>
                                          <x>200</x>
                                          <y>230</y>
                                          <width>87</width>
                                          <height>27</height>
                                          </rect>
                                          </property>
                                          <property name="text">
                                          <string>Clear data</string>
                                          </property>
                                          </widget>
                                          </widget>
                                          <resources/>
                                          <connections/>
                                          </ui>

                                          M 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