hi, im new, i have this code
this string its declared in public members in a Class names log, i need use this string in other classes, please help me, im novice in C++ and new in QT, thanks in advance, greetings
Printable View
hi, im new, i have this code
this string its declared in public members in a Class names log, i need use this string in other classes, please help me, im novice in C++ and new in QT, thanks in advance, greetings
Then you can post questions in General Programming Forum...
thnks, i was try this but i have a error in the compilation, i did this:
Code:
MainWindow.cpp #include "LogClass.h" log login; QString showme; showme=login.cuenta; ui->mostrarcuenta->setText(showtime);
the error its this:
login was not declarate in this scope
thnks
show the log class definition, also I guess there should be more errors, post them too
ok, this its:
Code:
#ifndef LOG_H #define LOG_H #include <QMainWindow> #include <QWidget> #include "mainwindow.h" #include <QSqlQuery> #include <QKeyEvent> namespace Ui { class log; } { Q_OBJECT public: QString cuenta; ~log(); private: Ui::log *ui; MainWindow m; private slots: // void funcion::keyPressEvent( QKeyEvent* ); void on_pushButton_clicked(); }; #endif // LOG_H
then, i call the Qstring cuenta so:
this code is located in mainwindow.cpp
the compiler does not show other error
first point, don't use a standard name like log (it can conflict with log() function in math.h), use a different class name.
next the error might related to Ui::log class, not ::log class (note the scope), try including "ui_log.h" (or whatever is the ui file name is) in mainwindow.cpp