{
// Attributes
public:
protected:
private:
//Methods
public:
qreal xPos,
qreal yPos,
};
class CommunityDisplay : public QGraphicsRectItem
{
// Attributes
public:
protected:
QListWidget *m_pListView;
private:
QGraphicsRectItem *m_pNameRectItem;
QGraphicsRectItem *m_pListRectItem;
QGraphicsTextItem *m_pName;
//Methods
public:
CommunityDisplay(QGraphicsScene *pParentScene,
qreal xPos,
qreal yPos,
QString strName);
};
To copy to clipboard, switch view to plain text mode
qreal xPos,
qreal yPos,
{
// Set up the Outer Rectangle for the shape
setRect(xPos, yPos, 225.0, 250.0);
// Set up the inner QGraphicsRectItem for the Name area
m_pNameRectItem->setRect(Rect.x() + 5.0,
Rect.y() + 5.0,
Rect.width() - 10.0,
45.0);
// Set up the inner QGraphicsRectItem for the List
m_pListRectItem->setRect(Rect.x() + 5.0,
Rect.y() + 55.0,
Rect.width() - 10.0,
Rect.height() - m_pNameRectItem->rect().height() - 15.0);
// Set up the Name Text Item
m_pName->setPos(m_pNameRectItem->rect().x() + 5.0,
m_pNameRectItem->rect().y() + 2.0);
// Set up the List Widget within the bounds of its QGraphicsRectItem
m_pListView
= new QListWidget(dynamic_cast<QWidget
*>
(m_pListRectItem
));
m_pListView->setBaseSize(m_pListRectItem->rect().width() - 4,
m_pListRectItem->rect().height() - 4);
m_pListView
->setViewMode
(QListView::ListMode);
m_pListView
->setFlow
(QListView::TopToBottom);
m_pListView
->setSelectionMode
(QListView::SingleSelection);
// m_pListView->setViewport(dynamic_cast<QWidget *>(m_pCryptosListRectItem));
point.setX((int)(m_pCryptosListRectItem->rect().x() + 2));
point.setY((int)(m_pCryptosListRectItem->rect().y() + 2));
m_pListView->mapToParent(point);
m_pListView->setEnabled(true);
m_pListView->setShown(true);
m_pListView->setVisible(true);
// DEBUG Attempt to see if the list widget will be displayed
m_pListView->addItem("Unit1");
setActive(true);
setEnabled(true);
}
CommunityDisplay::CommunityDisplay(QGraphicsScene *pParentScene,
qreal xPos,
qreal yPos,
QString strName)
{
// Set up the Outer Rectangle for the shape
setRect(xPos, yPos, 225.0, 250.0);
QRectF Rect = rect();
QPoint point;
// Set up the inner QGraphicsRectItem for the Name area
m_pNameRectItem = new QGraphicsRectItem(this, pParentScene);
m_pNameRectItem->setRect(Rect.x() + 5.0,
Rect.y() + 5.0,
Rect.width() - 10.0,
45.0);
// Set up the inner QGraphicsRectItem for the List
m_pListRectItem = new QGraphicsRectItem(this, pParentScene);
m_pListRectItem->setRect(Rect.x() + 5.0,
Rect.y() + 55.0,
Rect.width() - 10.0,
Rect.height() - m_pNameRectItem->rect().height() - 15.0);
// Set up the Name Text Item
m_pName = new QGraphicsTextItem(strName, this, pParentScene);
m_pName->setPos(m_pNameRectItem->rect().x() + 5.0,
m_pNameRectItem->rect().y() + 2.0);
// Set up the List Widget within the bounds of its QGraphicsRectItem
m_pListView = new QListWidget(dynamic_cast<QWidget *>(m_pListRectItem));
m_pListView->setBaseSize(m_pListRectItem->rect().width() - 4,
m_pListRectItem->rect().height() - 4);
m_pListView->setViewMode(QListView::ListMode);
m_pListView->setFlow(QListView::TopToBottom);
m_pListView->setSelectionMode(QListView::SingleSelection);
// m_pListView->setViewport(dynamic_cast<QWidget *>(m_pCryptosListRectItem));
point.setX((int)(m_pCryptosListRectItem->rect().x() + 2));
point.setY((int)(m_pCryptosListRectItem->rect().y() + 2));
m_pListView->mapToParent(point);
m_pListView->setEnabled(true);
m_pListView->setShown(true);
m_pListView->setVisible(true);
// DEBUG Attempt to see if the list widget will be displayed
m_pListView->addItem("Unit1");
setActive(true);
setEnabled(true);
setFlag(QGraphicsItem::ItemIsMovable);
setFlag(QGraphicsItem::ItemIsSelectable);
}
To copy to clipboard, switch view to plain text mode
Bookmarks