太原营销网站建设制作平台,品牌宝免费网站,wordpress rewrite规则,怎么注册域名经常看到有的同学说网上的教程都是假的#xff0c;巴拉巴拉#xff0c;看看人家发布时间#xff0c;Qt官方的API都会有所变动#xff0c;多搜索#xff0c;多总结#xff0c;再修改记录。
下次遇到问题多这样搜索 QT 4/5/6 xxx document#xff0c;对比一下就知道…
经常看到有的同学说网上的教程都是假的巴拉巴拉看看人家发布时间Qt官方的API都会有所变动多搜索多总结再修改记录。
下次遇到问题多这样搜索 QT 4/5/6 xxx document对比一下就知道变动了 1.endl was not declared in this scope
qDebug()data.toHex()endl;
endl改成Qt::endl
qDebug()data.toHex()Qt::endl;
2.Qt6移除了QDesktopWidget的问题 ..\..\mainwidget.h:6:10: fatal error: QDesktopWidget: No such file or directory
修改前
//头文件
#include QDesktopWidget//CPP文件QDesktopWidget* desktopWidget QApplication::desktop();QRect screenRect desktopWidget-screenGeometry();currentScreenWid (screenRect.width());currentScreenHei (screenRect.height() - 100);this-setFixedSize(currentScreenWid,currentScreenHei);
改成
//头文件
#if QT_VERSION QT_VERSION_CHECK(6, 0, 0)
#include QScreen
#else
#include QDesktopWidget
#endif//CPP文件
#if QT_VERSION QT_VERSION_CHECK(6, 0, 0)QScreen *pScreen QApplication::primaryScreen();currentScreenWid (pScreen-geometry().width());currentScreenHei (pScreen-geometry().height() - 100);
#elseQDesktopWidget* desktopWidget QApplication::desktop();QRect screenRect desktopWidget-screenGeometry();
// currentScreenWid (screenRect.width()*3/4);
// currentScreenHei (screenRect.height()*4/5 - 100);currentScreenWid (screenRect.width());currentScreenHei (screenRect.height() - 100);
#endifthis-setFixedSize(currentScreenWid,currentScreenHei);
3.error: class QGridLayout has no member named setMargin 使用setContentsMargins替代 gridlayout_left-setContentsMargins(0,25,0,20);gridlayout_right-setContentsMargins(0,25,0,20);
4.调用的库是32位的 QT6下载的编译器都是64位的把32位库文件换成64位。 OK运行了
5.部分信号与槽没反应估计是Qt4格式的过时了
qt.core.qobject.connect: QObject::connect: No such signal QButtonGroup::buttonClicked(int) in ..\..\menubarwid.cpp:82
connect(pushButtonGroup, SIGNAL(buttonClicked(int)), this, SLOT(slot_btnGroupClicked(int)));
好家伙居然还是用的Qt4的信号 Qt5就已经过时了但是调用依然有效 Qt6彻底删了 修改位idClicked(int)后正常
connect(pushButtonGroup, SIGNAL(idClicked(int)), this, SLOT(slot_btnGroupClicked(int)));
后面有啥问题再记录吧