Есть у меня класс EditorToolBar, наследник QWidget. И есть класс EditorToolBarAssistant, наследник EditorToolBar. То есть, EditorToolBarAssistant - это второй потомок QWidget.
И не компилируется метод addWidget в следующем коде:
editorMainLayer=new QGridLayout(editorMainScreen);
editorMainLayer->addWidget(editorToolBarAssistant, 0,0, 1,2);
Где editorToolBarAssistant - это экземпляр класса EditorToolBarAssistant.
Ошибка такая:
../mytetra/src/views/record/MetaEditor.cpp: In member function 'void MetaEditor::metaAssembly()':
../mytetra/src/views/record/MetaEditor.cpp:143:80: error: no matching function for call to 'QGridLayout::addWidget(EditorToolBarAssistant*&, int, int, int, int)'
editorMainLayer->addWidget(editorToolBarAssistant, 0,0, 1,2);
^
../mytetra/src/views/record/MetaEditor.cpp:143:80: note: candidates are:
In file included from /media/wd_640_part_2/opt/Qt_5_4_2/5.4/gcc/include/QtWidgets/qlayout.h:166:0,
from /media/wd_640_part_2/opt/Qt_5_4_2/5.4/gcc/include/QtWidgets/qboxlayout.h:37,
from /media/wd_640_part_2/opt/Qt_5_4_2/5.4/gcc/include/QtWidgets/QBoxLayout:1,
from ../mytetra/src/views/record/MetaEditor.cpp:1:
/media/wd_640_part_2/opt/Qt_5_4_2/5.4/gcc/include/QtWidgets/qgridlayout.h:95:17: note: void QGridLayout::addWidget(QWidget*)
inline void addWidget(QWidget *w) { QLayout::addWidget(w); }
^
/media/wd_640_part_2/opt/Qt_5_4_2/5.4/gcc/include/QtWidgets/qgridlayout.h:95:17: note: candidate expects 1 argument, 5 provided
/media/wd_640_part_2/opt/Qt_5_4_2/5.4/gcc/include/QtWidgets/qgridlayout.h:96:10: note: void QGridLayout::addWidget(QWidget*, int, int, Qt::Alignment)
void addWidget(QWidget *, int row, int column, Qt::Alignment = 0);
^
/media/wd_640_part_2/opt/Qt_5_4_2/5.4/gcc/include/QtWidgets/qgridlayout.h:96:10: note: candidate expects 4 arguments, 5 provided
/media/wd_640_part_2/opt/Qt_5_4_2/5.4/gcc/include/QtWidgets/qgridlayout.h:97:10: note: void QGridLayout::addWidget(QWidget*, int, int, int, int, Qt::Alignment)
void addWidget(QWidget *, int row, int column, int rowSpan, int columnSpan, Qt::Alignment = 0);
^
/media/wd_640_part_2/opt/Qt_5_4_2/5.4/gcc/include/QtWidgets/qgridlayout.h:97:10: note: no known conversion for argument 1 from 'EditorToolBarAssistant*' to 'QWidget*'
Вот я не пойму в чем проблема. То ли в наследовании (интеррфейс EditorToolBarAssistant не содержит интерфейса QWidget) то ли не может закомпилится класс EditorToolBarAssistant. Ибо далее в другом месте ошибка следующая:
../mytetra/src/views/record/MetaEditor.cpp: In member function 'void MetaEditor::clearAll()':
../mytetra/src/views/record/MetaEditor.cpp:232:24: error: invalid use of incomplete type 'class EditorToolBarAssistant'
editorToolBarAssistant->switchAttachIconExists(false);
^
In file included from ../mytetra/src/views/record/MetaEditor.h:8:0,
from ../mytetra/src/views/record/MetaEditor.cpp:8:
../mytetra/src/libraries/wyedit/Editor.h:47:7: error: forward declaration of 'class EditorToolBarAssistant'
class EditorToolBarAssistant;
^
Makefile:11979: recipe for target 'build/MetaEditor.o' failed
По какой-то причине имеем
incomplete type 'class EditorToolBarAssistant', а в самом классе EditorToolBarAssistant компилятор ошибок не оказывает.
В чем может быть проблема?
Исходники:
https://github.com/xintrea/mytetra_dev/commits/editorModificationКоммит:
0c1b073a21bc10635671666c44c96c3820c1dc7f