Hi,
I am new to using QT and am in need of some guidence.
I want to create an interface that returns a list of pointers to objects, and then the classes that implement this interface should be able to both set and get the objects in the list.
Where I am getting confused is that I want a general interface that allows me to be able to get any items from any of the derived classes.
I don't understand how I should be handling converting the specialized datatypes like
QList<newsChannelItem*> items;
QList<newsChannelItem*> items;
To copy to clipboard, switch view to plain text mode
back via the interface
QList<QObject*> getItems();
QList<QObject*> getItems();
To copy to clipboard, switch view to plain text mode
class ChannelInterface
{
public:
virtual QList<QObject*> getItems() = 0;
}
class ChannelInterface
{
public:
virtual QList<QObject*> getItems() = 0;
}
To copy to clipboard, switch view to plain text mode
classes that then implement this interface
class storeChannel
: public QObject,
public ChannelInterface
{
QList<storeChannelItem*> items;
public:
QList<QObject*> getItems(); // I want to be able to return a list of storeChannelItem's
class newsChannel
: public QObject,
public ChannelInterface
{
QList<newsChannelItem*> items;
public:
QList<QObject*> getItems(); // I want to be able to return a list of newsChannelItem's
class storeChannel : public QObject, public ChannelInterface
{
QList<storeChannelItem*> items;
public:
QList<QObject*> getItems(); // I want to be able to return a list of storeChannelItem's
class newsChannel : public QObject, public ChannelInterface
{
QList<newsChannelItem*> items;
public:
QList<QObject*> getItems(); // I want to be able to return a list of newsChannelItem's
To copy to clipboard, switch view to plain text mode
I appreciate any help on this, as I am pretty stuck.
thanks in advance
Guus Davidson
Bookmarks