本文整理汇总了C++中CustomItem::setAcceptHoverEvents方法的典型用法代码示例。如果您正苦于以下问题:C++ CustomItem::setAcceptHoverEvents方法的具体用法?C++ CustomItem::setAcceptHoverEvents怎么用?C++ CustomItem::setAcceptHoverEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomItem
的用法示例。
在下文中一共展示了CustomItem::setAcceptHoverEvents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addItemToScene
//Shows image on view.
void CustomGraphicsView::addItemToScene(QString strEmfFile)
{
//Calculate maximum column to be displayed in a view.
m_nMaxColumn = (m_nWidth - (m_nOffsetX + (m_nOffsetX / 2))) / (nItemWidth + m_nItemSpace);
CustomItem* pImageLabel = new CustomItem(strEmfFile, ++nViewItem);
pImageLabel->setPos(m_nOffsetX + (m_nColoumn * (nItemWidth + m_nItemSpace)), m_nOffsetY + (m_nRow * (nItemHeight + m_nItemSpace)));
pImageLabel->setAcceptHoverEvents(true);
m_graphicsScene.addItem(pImageLabel);
if ((0 == m_nRow)
&&
(0 == m_nColoumn))
{
m_sceneRect.setX(0);
m_sceneRect.setY(0);
//m_sceneRect.setWidth(m_nOffsetX + (m_nOffsetX / 2) + nItemWidth);
m_sceneRect.setHeight(m_nOffsetY + (m_nOffsetY / 2) + nItemHeight);
}
else if (0 == m_nColoumn)
{
m_sceneRect.setHeight(m_sceneRect.height() + nItemHeight + m_nItemSpace);
}
m_graphicsScene.setSceneRect(m_sceneRect);
if (m_nColoumn < (m_nMaxColumn - 1))
{
m_nColoumn++;
}
else
{
m_nRow++;
m_nColoumn = 0;
}
if (m_sceneRect.height() < m_nHeight)
{
m_sceneRect.setHeight(m_nHeight);
m_graphicsScene.setSceneRect(m_sceneRect);
}
QList<QGraphicsItem*> visibleItems = this->items(viewport()->rect());
if ((visibleItems.contains(pImageLabel))
&&
(false == timer->isActive()))
{
emit loadImage(visibleItems);
}
}