设置触发时间间隔不同的定时器
int count = 0;
m_timer = new QTimer(this);
m_timer->setSingleShot(false);
connect(m_timer, SIGNAL(timeout()), this, SLOT(showPic()));
m_timer->start(1000);
showPic里count ++控制定时次数if(count ==4)m_timer ->stop;
showPic里修改定时器间隔setInterval
解决编译器堆空间不足
CONFIG += resources_big
https://blog.csdn.net/z609932088/article/details/99837463
移除CONFIG内多余的的变量,解决qmake重复执行的问题
https://blog.csdn.net/nicai_xiaoqinxi/article/details/103729119
QT pro文件的常见用法
https://blog.csdn.net/zhangle_521/article/details/83903065
编译生成动态库并调用
https://blog.csdn.net/u012372584/article/details/104345346
动态库在pro文件中的配置
https://www.cnblogs.com/findumars/p/7252074.html
Qt中的 DEPENDPATH 和 INCLUDEPATH 的区别
https://blog.csdn.net/My__God/article/details/111517166
设置弹框在页面居中跟随页面移动
void Class::setFixedSize(int w, int h)
{
this->setParent(your parent widget);
QRect rc=FramelessWindow::getAppRect();
QDialog::setFixedSize(rc.width(),rc.height());
move (0,0);
this->setContentsMargins(value,value,value,value);
//void QWidget::setContentsMargins(int left, int top, int right, int bottom)
}
响应弹窗的拖动事件
QPoint dragPosition;
bool leftbuttonpressed;
void Class::mouseMoveEvent(QMouseEvent *e)
{
if (leftbuttonpressed) {
move(e->globalPos() - dragPosition);
}
e->accept();
}
void Class::mousePressEvent(QMouseEvent *e)
{
if(e->button() & Qt::LeftButton) {
if(!isMaximized()){
dragPosition = e->globalPos() - frameGeometry().topLeft();
leftbuttonpressed = true;
}
}
e->accept();
}
void Class::mouseReleaseEvent(QMouseEvent *e)
{
leftbuttonpressed = false;
e->accept();
}
void Class::keyPressEvent(QKeyEvent *e)
{
if (e->key() != Qt::Key_Escape) {
QDialog::keyPressEvent(e);
}
}
QML 弹力效果(Flickable)
https://blog.csdn.net/weixin_42948436/article/details/117364325
取消Flickable里ListView的拖拽效果,设置interactive: false
去掉后缀获取文件名直到最后一个.
QFileInfo fileInfo(stringPath);
fileInfo.completeBaseName();
fileInfo.baseName();只会取到第一个.
QT使用例子
https://segmentfault.com/a/1190000004620577
//用QLabel显示图片,图片填充QLabel大小
QLabel *logoTop = new QLabel(this);//HitPaw
QPixmap topPixmap = QPixmap::fromImage(QImage(":/image/logo.png"));
logoTop->setFixedSize(52,22);
logoTop->setPixmap(topPixmap.scaled(logoTop->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
logoTop->move(22+m_borderMargin,14+m_borderMargin);
//QT常用字体
https://blog.csdn.net/lxj362343/article/details/104553316/