How to use object of one class in another one
Unsolved
General and Desktop
-
in my project I have two classes: "MainWindow" and "secwindow"
my MainWindow.h:#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QtNetwork/QFtp> #include "secwindow.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: . . . private: Ui::MainWindow *ui; SecWindow *secWindow; QFtp *ftp; . . }; #endif // MAINWINDOW_H
my secwindow.h:
#ifndef SECWINDOW_H #define SECWINDOW_H #include <QDialog> #include <QFile> //#include "mainwindow.h" namespace Ui { class SecWindow; } class SecWindow : public QDialog { Q_OBJECT public: explicit SecWindow(QWidget *parent = 0); ~SecWindow(); private slots: void on_pushButton_write_values_clicked(); private: Ui::SecWindow *ui; QFile *myfile; QString s1,s2,s3,s4,s5,s6,s7,s8,s9; }; #endif // SECWINDOW_H
How I can use "ftp" in secwindow?
-
You question "How I can use "ftp" in secwindow?" is rather vague. Depending on your needs you can use pointers or references to pass the "ftp" object to "SecWindow" . If you don't need a reference to the object you can definitely take a look at VRonin's answer in more detail here http://doc.qt.io/archives/qt-4.8/signalsandslots.html .