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()); }
相关文章推荐
- QT中QListView中放置自定义控件并添加滚动条
- QT中编译问题
- Qt汉字转拼音
- QT 相关问题
- 第一个PyQt程序
- QT显示框架嵌入Vs控制台工程
- Qwt在Qt中的安装
- Qt浅谈之三十四仿登录界面
- PyQt类库介绍
- VC调用QT的dll 问题解决
- i.MX6Q OpenCL with QT4.8.4
- Qt对文件的操作,QTextStream
- ubuntu下Qt cannot find -lGL错误的解决方法
- Qt调用打印机
- Qt创建函数注意事项
- Qt4转Qt5遇到的问题
- Qt5中文乱码解决方法
- QT+CUDA7.5+UBUNTU14.04
- qt pro 里面变量的引用
- QTextEdit/QTextBrowser添加彩色文字与图片