Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

MS Visual Studio Community 2015



  • The following code has been tested on Qt Creator 4.2.1
    file t.cpp
    #include "t.h"
    #include "ui_t.h"
    #include <QLineEdit>
    #include <QMessageBox>
    #include <QString>
    #include <QDialog>

    void T::on_pushButton_2_clicked(){
    QString i_QText = ui->lineEdit_i->text();
    QString j_QText = ui->lineEdit_j->text();
    double ij = i_QText.toDouble() + j_QText.toDouble();
    QString ij_Qtext;
    ij_Qtext.sprintf("%f", ij);
    ui->label->setText(ij_Qtext)
    ui->label_4->setText("done"); cout << "\n\t hello is printed on Window GUI";
    }
    I have ported the code to MS VS 2015,, my code looks like
    #include <QtWidgets/QLineEdit>
    #include <QtWidgets/QMessageBox>
    #include <QString>
    #include <QDialog> // on the stack

    void X::pushButton_X() {
    QString i_QText = ui.lineEdit_rows->text();
    QString j_QText = ui.lineEdit_cols->text();
    double ij = i_QText.toDouble() + j_QText.toDouble();
    QString ij_Qtext;
    ij_Qtext.sprintf("%f", ij);
    ui.label_rc->setText(ij_Qtext);
    ui.label_2->setText("Se genero Exsan");
    }
    I have no compile errors but It does not show the expected result

    am I missing any particular #include ?
    thanks for the help


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    What do you mean by porting ?

    Qt Creator is just an IDE.

    What version of Qt did you install and used to build your application ?

    What do you get ? What was expected ?


Log in to reply