本文整理汇总了C++中Drawing::acceptScreenEvents方法的典型用法代码示例。如果您正苦于以下问题:C++ Drawing::acceptScreenEvents方法的具体用法?C++ Drawing::acceptScreenEvents怎么用?C++ Drawing::acceptScreenEvents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drawing
的用法示例。
在下文中一共展示了Drawing::acceptScreenEvents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: reallocScreenWidgets
// Refresh the screen widgets pool, depending on stored drawings
void ScreenBoard::reallocScreenWidgets() {
QDesktopWidget *desktop = QApplication::desktop();
int i, screensCount = desktop->numScreens();
// Delete exceeding screens and resize to screensCount
for (i = screensCount; i < m_screenWidgets.size(); ++i) {
m_screenWidgets[i]->hide();
m_screenWidgets[i]->deleteLater(); // Ensures no event about it is pending.
// Note that updates may be invoked in event handlers.
}
m_screenWidgets.resize(desktop->numScreens());
// Re-initialize the screen widgets list
for (i = 0; i < screensCount; ++i) {
ScreenWidget *screenWidget = m_screenWidgets[i];
if (screenWidget) screenWidget->drawings().clear();
}
// Turn on a ScreenWidget for each screen crossed by any drawing
int j, drawingsCount = m_drawings.size();
for (i = 0; i < screensCount; ++i) {
ScreenWidget *screenWidget = m_screenWidgets[i];
const QRect &screenGeom = desktop->screenGeometry(i);
for (j = 0; j < drawingsCount; ++j) {
Drawing *drawing = m_drawings[j];
if (drawing->acceptScreenEvents(screenGeom)) {
// Allocate the associated screen widget if necessary
if (!screenWidget) {
m_screenWidgets[i] = screenWidget = new ScreenWidget(0, m_grabbing);
if (m_grabbing) screenWidget->setCursor(m_cursor);
screenWidget->setGeometry(screenGeom);
screenWidget->show();
}
// Add the drawing to the widget
screenWidget->drawings().push_back(drawing);
}
}
}
// Remove screens without drawings
for (i = 0; i < screensCount; ++i) {
ScreenWidget *screenWidget = m_screenWidgets[i];
if (screenWidget && screenWidget->drawings().empty()) {
screenWidget->hide();
screenWidget->deleteLater();
m_screenWidgets[i] = 0;
}
}
}