I am really stuck at the moment.. My Application can create (animation) frames with a click, these frames can either be moved, deleted or edited. I want some kind of right-click context menu to delete them.
My attempt now is creating a QListWidget, and insert QListWidgetItems (the frames) in there. I can put these Items in there, but ofcourse i have no idea on how to store the frames then.
I tried to make a new class, derived from QListWidgetItem like this:
#pragma once
#include <qobject.h>
#include <QtGui>
#include <Frame.h>
class FrameItem : public QListWidgetItem
{
public:
FrameItem();
Frame frame;
void setFrame(Frame f);
Frame getFrame();
int id;
void setId(int id);
int getId();
};
This would actually work, but the itemClicked() signal does not trigger anymore.
void itemClicked(QListWidgetItem* item)
{
std::cout << item->text().toStdString() << std::endl;
};
If I change the parameter of itemClicked(QListWidgetItem* item) to itemClicked(FrameItem* item) the signal does not fire anymore.
Do I need to overwrite the itemClicked() slot? If yes, how? Is there a better approach to store much data, and give them a right-click contextmenu?