本文介绍了Qt关于匹配函数的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 大家好。 当我读完这本书时:Qt GUI编程与Qt4,第二版;看到我在我的Ubuntu上实现它的一个例子,但它没有编译...... 当我尝试制作时给出的错误是: finddialog.cpp:26:40:错误:没有匹配函数来调用'QVBoxLayout :: addWidget(QHBoxLayout *&)' finddialog.cpp:26:40:注意:候选者是: /usr/include/qt4/QtGui/qboxlayout.h:85:10:注意:void QBoxLayout :: addWidget(QWidget *,int,Qt :: Alignment) / usr / include / qt4 / QtGui / qboxlayout.h:85:10:注意:参数1从'QHBoxLayout *'到'QWidget *'没有已知的转换 虽然我不操纵代码! 我知道错误的本质,但我不知道如何解决它... 代码有这个错误的是: QHBoxLayout * topLeftLayout = new QHBoxLayout; topLeftLayout-> addWidget(label); topLeftLayout-> addWidget(lineEdit); QVBoxLayout * leftLayout = new QVBoxLayout; leftLayout-> addWidget(topLeftLayout); // 此行有错误 - >注意: // 没有匹配的函数来调用 // 'QVBoxLayout :: addWidget(QHBoxLayout *&)' // 注意:候选人是: // /usr/include/qt4/QtGui/qboxlayout.h:85:10:注意: // void QBoxLayout :: addWidget(QWidget *,int,Qt :: Alignment) 有什么问题?如何解决? 谢谢大家。 --- finddialog.h - > http://ubuntuone.com/0burFhFtN2mJbJhowBM51b [ ^ ] finddialog.cpp - > http://ubuntuone.com/2WhfmK2hLPb0HrQCH2EwXp [ ^ ] main.cpp - > http://ubuntuone.com/5Q23kS6xHcNUlB3Z0zYsgn [ ^ ] 终端输出 - > http://ubuntuone.com/6ve3wygjYu31rYLlOgO8KJ [ ^ ] 解决方案 Hello everybody.When I have been studying this book : "Qt GUI Programming with Qt4, Second Edition"; saw an example which I implemented it on my Ubuntu, but it NOT compiled ...And the given error when I try to make it, is :finddialog.cpp:26:40: error: no matching function for call to ‘QVBoxLayout::addWidget(QHBoxLayout*&)’finddialog.cpp:26:40: note: candidate is:/usr/include/qt4/QtGui/qboxlayout.h:85:10: note: void QBoxLayout::addWidget(QWidget*, int, Qt::Alignment)/usr/include/qt4/QtGui/qboxlayout.h:85:10: note: no known conversion for argument 1 from ‘QHBoxLayout*’ to ‘QWidget*’Although I don't manipulation the codes!I know the nature of the error, but I don't know how to solve it ...The codes that have beed this error are :QHBoxLayout *topLeftLayout = new QHBoxLayout; topLeftLayout->addWidget(label); topLeftLayout->addWidget(lineEdit); QVBoxLayout *leftLayout = new QVBoxLayout; leftLayout->addWidget(topLeftLayout); // this line have an error -> note: // no matching function for call to // ‘QVBoxLayout::addWidget(QHBoxLayout*&)’ // note: candidate is: // /usr/include/qt4/QtGui/qboxlayout.h:85:10: note: // void QBoxLayout::addWidget(QWidget*, int, Qt::Alignment)what is the problem? and how to solve it?Thanks everybody.---finddialog.h -> http://ubuntuone.com/0burFhFtN2mJbJhowBM51b[^]finddialog.cpp -> http://ubuntuone.com/2WhfmK2hLPb0HrQCH2EwXp[^]main.cpp -> http://ubuntuone.com/5Q23kS6xHcNUlB3Z0zYsgn[^]terminal output -> http://ubuntuone.com/6ve3wygjYu31rYWlLgO8KJ[^] 解决方案 这篇关于Qt关于匹配函数的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-01 18:57