HI
I'm trying to creat an Object that will contains some data and that will be avaliable to multiple Widgets. Also, if one Widget changes some data in the Object, next time some other Widget reads the data from Object, it will have the new chaged data.
For example.
Lets say we have
// more QWidgets are in my program, but for example purpose, we will use two widgets
// Both widgets are sepereate dialogs, widgets, mainWindows and have theier own classes and *.h and *.cpp files
// And some QObject that also has its own class and and *.h and *.cpp file
// And in the sharedData, lets say we have some public items (declared in the header file):
int number
QWidget widgetA
QWidget widgetB
// more QWidgets are in my program, but for example purpose, we will use two widgets
// Both widgets are sepereate dialogs, widgets, mainWindows and have theier own classes and *.h and *.cpp files
// And some QObject that also has its own class and and *.h and *.cpp file
QObject sharedData
// And in the sharedData, lets say we have some public items (declared in the header file):
QString string
QString stringTwo
int number
To copy to clipboard, switch view to plain text mode
What I wnat to do, is when widgetA changes some part of the sharedData Object,
// in the widgetA, some sharedData items are chaged like
sharedData->string = "apple";
sharedData->num = 10;
// in the widgetA, some sharedData items are chaged like
sharedData->string = "apple";
sharedData->num = 10;
To copy to clipboard, switch view to plain text mode
I need to be able that widgetB would read the changes made by widgetA
// lets say
qDebug()<<sharedData->string;
//will return "apple" and not an emtpy string
// lets say
qDebug()<<sharedData->string;
//will return "apple" and not an emtpy string
To copy to clipboard, switch view to plain text mode
My question is how do i set up my object and how do I implament this object withing widgets
. I know, I have to use pointers, but I have problem in initial setup.
Thanks to all. Hope to here from some one.
Bookmarks