Qt备忘录

安装完qt-vs-tools-msvc2013-2.0.0.vsix后,重启vs2013,工程项目右键菜单上qt功能选项为灰色无效,怎么办?
打开.vcxproj修改

1
<Keyword>Win32Proj</Keyword>

1
<Keyword>Qt4VSv1.0</Keyword>

再重启vs,在工程上右键菜单上点击“Convert Project to Qt VS Tools Project”。
refer to: https://blog.csdn.net/ermzdy2/article/details/99692954

生成要翻译的语言文件

1
2
lupdate hello.pro -ts zh_hans.ts
lrelease zh_hans.ts -qm zh_hans.qm

refer to: https://blog.csdn.net/aaa123524457/article/details/80582978

窗口上画矩形

1
2
3
4
5
6
7
void DlgTst01::paintEvent(QPaintEvent *e)
{
    QPainter painter(this);
    painter.setBrush(Qt::red);
    painter.setPen(Qt::red);
    painter.drawRect(QRect(0, 0, this->width(), this->height()));
}

refer to: http://www.myexception.cn/qt/1119616.html

嵌入子对话框

1
setWindowFlags(Qt::CustomizeWindowHint|Qt::FramelessWindowHint);