/** * @brief 마우스 커서가 MainWindow의 탭영역(1,2,3)에 올라가있는지 확인한다. * * +-------------------------------+-+-+-+ * | TITLE BAR |_|O|X| * +----------+----------+---------+-+-+-+ * |##1(Tab)##|##2(Tab)##|###3(Empty)####| * +----------+----------+---------------+ * | | * | 4 | * | | * +-------------------------------------+ * * TabBar::geometry()는 1,2영역을 나타내고, TabWidget::geometry()는 1,2,3,4영역을 나타낸다. * 이 두 geometry()를 연산해서 1,2,3 영역을 찾는다. * * @param mainWindow 대상 메인 윈도 * @return bool * */ bool CWindowManager::isCursorOnTabWithEmptyArea(MainWindow *mainWindow) { QRect barRect; QRect barRectG; QRect widgetRect; QRect widgetRectG; QTabBar* tabBar = 0; QTabWidget* tabWidget = 0; if(!mainWindow) return false; tabBar = mainWindow->getTabBar(); tabWidget = mainWindow->getTabWidget(); barRect = tabBar->geometry(); widgetRect = tabWidget->geometry(); barRectG.setTopLeft(tabBar->mapToGlobal(barRect.topLeft())); barRectG.setBottomRight(tabBar->mapToGlobal(barRect.bottomRight())); widgetRectG.setTopLeft(tabWidget->mapToGlobal(widgetRect.topLeft())); widgetRectG.setBottomRight(tabWidget->mapToGlobal(widgetRect.bottomRight())); widgetRectG.setTopLeft(QPoint(widgetRectG.topLeft().x(), barRectG.topLeft().y())); widgetRectG.setBottomRight(QPoint(widgetRectG.bottomRight().x(), barRectG.bottomRight().y())); return widgetRectG.contains(QCursor::pos()); }