#include "dialog.h"
Dialog::Dialog(QWidget *parent)
: QDialog(parent)
{
setWindowTitle(tr("Geometry"));
xLabel =new QLabel(tr("x():"));
xValueLabel =new QLabel;
yLabel =new QLabel (tr ("y():"));
yValueLabel =new QLabel;
FrmLabel =new QLabel(tr("Frame:"));
FrmValueLabel =new QLabel;
posLabel =new QLabel (tr ("pos():"));
posValueLabel =new QLabel;
geoLabel =new QLabel (tr("geometry():"));
geoValueLabel =new QLabel;
widthLabel =new QLabel (tr ("width():"));
widthValueLabel =new QLabel;
heightLabel =new QLabel (tr ("height():"));
heightValueLabel =new QLabel;
rectLabel =new QLabel (tr ("rect():"));
rectValueLabel =new QLabel;
sizeLabel =new QLabel (tr ("size():"));
sizeValueLabel =new QLabel;
mainLayout =new QGridLayout(this);
mainLayout->addWidget(xLabel,0,0);
mainLayout->addWidget(xValueLabel,0,1);
mainLayout->addWidget(yLabel,1,0);
mainLayout->addWidget(yValueLabel,1,1);
mainLayout->addWidget(posLabel,2,0);
mainLayout->addWidget(posValueLabel,2,1);
mainLayout->addWidget(FrmLabel,3,0);
mainLayout->addWidget(FrmValueLabel,3,1);
mainLayout->addWidget(geoLabel,4,0);
mainLayout->addWidget(geoValueLabel,4,1);
mainLayout->addWidget(widthLabel,5,0);
mainLayout->addWidget(widthValueLabel,5,1);
mainLayout->addWidget(heightLabel,6,0);
mainLayout->addWidget(heightValueLabel,6,1);
mainLayout->addWidget(rectLabel,7,0);
mainLayout->addWidget(rectValueLabel,7,1);
mainLayout->addWidget(sizeLabel,8,0);
mainLayout->addWidget(sizeValueLabel,8,1);
updateLabel ();
}
Dialog::~Dialog()
{
}
void Dialog::updateLabel()
{
QString xStr; //获得x()函数的结果并显示
xValueLabel->setText(xStr.setNum(x()));
QString yStr; //获得y()函数的结果并显示
yValueLabel->setText (yStr. setNum (y ()));
QString frameStr; ///获得 frameGeometry ()函数的结果井显示
QString tempStr1,tempStr2,tempStr3,tempStr4;
frameStr = tempStr1.setNum(frameGeometry() .x())+","+
tempStr2. setNum (frameGeometry () . y ()) +", "+
tempStr3. setNum (frameGeometry () . width ()) +", "+
tempStr4.setNum(frameGeometry().height());
FrmValueLabel->setText(frameStr);
QString positionStr; //获得pos()函数的结果并显示
QString tempStrl1,tempStrl2;
positionStr =tempStrl1. setNum (pos () .x ()) +", "+
tempStrl2. setNum (pos () . y ()) ;
posValueLabel->setText(positionStr);
QString geoStr; //获得geometry()函数的结果并显示
QString tempStr21,tempStr22,tempStr23,tempStr24;
geoStr=tempStr21.setNum(geometry().x())+","+
tempStr22.setNum(geometry().y())+","+
tempStr23.setNum(geometry().width())+","+
tempStr24.setNum(geometry() . height ());
geoValueLabel->setText(geoStr);
QString wStr, hStr; //获得width(),height()函数的结果并显示
widthValueLabel->setText(wStr.setNum(width()));
heightValueLabel->setText (hStr. setNum (height()));
QString rectStr; //获得rect()函数的结果并显示
QString tempStr31,tempStr32,tempStr33,tempStr34;
rectStr =tempStr31. setNum (rect().x()) +", "+
tempStr32.setNum( rect ().y()) +", "+
tempStr33. setNum(/*rect (). width()*/width()) +", "+
tempStr34.setNum(height()/*rect().height()*/);
rectValueLabel->setText(rectStr);
QString sizeStr; //获得size()函数的结果并显示
QString tempStr41,tempStr42;
sizeStr=tempStr41.setNum (size() .width()) +","+tempStr42.setNum(size().height());
sizeValueLabel->setText(sizeStr);
}
void Dialog::moveEvent(QMoveEvent *)
{
updateLabel();
}
void Dialog::resizeEvent(QResizeEvent *)
{
updateLabel();
}
Geometry.rar
需积分: 6 173 浏览量
2022-09-08
22:29:13
上传
评论
收藏 4KB RAR 举报
东.'
- 粉丝: 9270
- 资源: 14
最新资源
- 520马上到了两款动态爱心表白HTML代码(附源码)李峋同款爱心,快送给你爱的她或(他)吧12 情侣纪念日代码.zip
- 电子设计竞赛的单相不间断电源设计
- cutcamera1715961370938.png
- 基于MATLAB的图像处理课程设计报告.doc
- tensorflow-gpu-2.6.0-cp38-cp38-manylinux2010-x86-64.whl
- mmexport1715960553858.png
- tensorflow-gpu-2.6.0-cp37-cp37m-manylinux2010-x86-64.whl
- 通过 .NET 应用程序中的源代码查找 SQL 注入
- 电子设计竞赛2007年B题 无线识别装置.doc
- Wox全局搜索工具,一款win下的全局搜索软件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0