当前位置: 首页>>代码示例>>C++>>正文


C++ Drawing::acceptScreenEvents方法代码示例

本文整理汇总了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;
    }
  }
}
开发者ID:Makoto-Sasahara,项目名称:opentoonz,代码行数:55,代码来源:screenboard.cpp


注:本文中的Drawing::acceptScreenEvents方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。