您的位置:首页 > 编程语言 > Qt开发

QT 控件基础

2015-12-03 18:01 645 查看
//屏幕分辨率:
QDesktopWidget* desktopWidget = QApplication::desktop();
QRect screenRect = desktopWidget->screenGeometry();
int g_nActScreenW = screenRect.width();
int g_nActScreenH = screenRect.height();
//固定控件的大小:	setFixedSize(90,60);
QPoint GlobalPoint(ui.widgetGameArea->mapToGlobal(QPoint(0, 0)));//获取控件在窗体中的坐标
int x = GlobalPoint.x();
int y = GlobalPoint.y();//重新调节控件位置
void CGameChatRoomDlg::resizeEvent( QResizeEvent *e )
{
if (!m_hwndGame)
return ;
QPoint GlobalPoint(ui.widgetGameArea->mapToGlobal(QPoint(0, 0)));//获取控件在窗体中的坐标
int x = GlobalPoint.x();
int y = GlobalPoint.y();
QRect rect = ui.widgetGameArea->geometry() ;
QPoint point = mapTo(nativeParentWidget(), QPoint (rect.x(), rect.y())) ;
SetWindowPos(m_hwndGame,NULL,point.x(), point.y(), 0,0,SWP_NOSIZE | SWP_NOACTIVATE);
Log(LL_DEBUG,TAG(L"GameWindowsPostion"),L"resizeEvent X:%d,Y:%d",point.x(), point.y());
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: