c++ - Qt conversion error when connecting slots and signals -
i have class inherits qlistwidget called menu
, trying connect class' signals widget's slots.
class menu : qlistwidget { q_object public: menu(config &config, qwidget *parent = 0); ~menu(); public slots: void itemchanged(qlistwidgetitem *item); signals: void clickeditemchanged(std::string item); private: std::vector<qlistwidgetitem*> items; }; // in widget connect signals , slots connect(menu, signal(clickeditemchanged(std::string)), this, slot(menuitemchanged(std::string)));
but compilation failed, saying cannot cast 'menu' private base class 'const qobject'. signature of slot matches of signal, , widget class slot belongs holds reference menu
. caused problem , how should solve it?
Comments
Post a Comment