Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Signal and Slot with two different UI class in QT
Rhutu last edited by
I have a button in main ui window, where on click event Slot of different classes which contains QTablewidget's data.
Thanks in advance.
When I tried with from main class
OtherClass *Obj=new OtherClass ();
As it calls WriteToFile() with new object,data got vanished from QTablewidget.
I want to have modified data on signal ui.writeToFileButton,How can I get? Note: I have entered data through another widget in the table and able to connect signal and slot in the same class having QTableWidget ui.
JonB last edited by JonB
Nothing should "vanish". If you overwrite what is in
QTableWidgetwith something not as you intended then obviously it will cease to show whatever it showed before.
If you need to pass additional data from your main window to the slot, you can either do it via a C++ lambda for the slot, or put a slot which is in the main window instead of
Obj,SLOT(WriteToFile()), and have that call
Stop using old-style
SLOT()macros for signals/slots, use https://wiki.qt.io/New_Signal_Slot_Syntax, it's better and it will help you connect correct things.