How to compile QT windows for use in the Edtior?

0

So, I'm following this question on how to add a window to the editor for usage and find that in the Script Canvas Gem there exists QT ui files. I've used the latest version of QT editor (open source ver) to create a ui file with corresponding cpp/h class files. The issue is that every time I try to compile it's complaining that it cannot find "ui_<class name>.h".

Here's my wscript:

    def build(bld):
bld.DefineGem(
# Add custom build options here
includes = [bld.Path('Code/CryEngine/CryAction')],
win_features = ['crcfix'],
editor = dict(
features = ['qt5'],
use = [
'AzToolsFramework',
'AzQtComponents',
'EditorCore',
'EditorUI_QT',
'EditorCommon'
],
includes = [
bld.Path('Code/CryEngine/CryCommon'),
bld.Path('Code/Sandbox'),
bld.Path('Code/Sandbox/Editor'),
bld.Path('Code/Sandbox/Editor/Include'),
bld.Path('Code/Sandbox/Plugins/EditorCommon')
],
uselib =[
'QT5CORE',
'QT5QUICK',
'QT5QML',
'QT5GUI',
'QT5WIDGETS'
],
autod_uselib = ['QT5CORE','QT5GUI','QT5WIDGETS'],
defines = [ 'AA_EDITOR' ]
),
)

I copied what I think would need without any need for any script canvas specific stuff but it doesnt seem to compile the ui file into a "ui_<class name>.h" file...

feita há 6 anos184 visualizações
14 Respostas
0

waf_files have those 3 files included.

respondido há 6 anos
0

Hmm what does the include look like? It should probably be something like:

#include "Editor/ui/ui_alternativeaudiohelper.h"

Maybe the path is not correct?

Thanks!

respondido há 6 anos
0

Hello @REDACTEDUSER

What does you .waf_files look like? It needs to include three files:

.h

.cpp

.ui

An example to take a look at would be dev/Gems/ScriptCanvas/Code/Editor/View/Dialogs/NewGraphDialog.cpp (h, ui)

Hope that helps,

Thanks!

respondido há 6 anos
0

Same thing...

wscript:

    def build(bld):
bld.DefineGem(
# Add custom build options here
includes = [
bld.Path('Code/CryEngine/CryAction')
],
win_features = [
'crcfix'
],
editor = dict(
features = [
'qt5'
],
use = [
'AzToolsFramework',
'AzQtComponents',
'EditorCore',
'EditorUI_QT',
'EditorCommon'
],
includes = [
bld.Path('Code/CryEngine/CryCommon'),
bld.Path('Code/Sandbox'),
bld.Path('Code/Sandbox/Editor'),
bld.Path('Code/Sandbox/Editor/Include'),
bld.Path('Code/Sandbox/Plugins/EditorCommon')
],
uselib =[
'QT5CORE',
'QT5GUI',
'QT5WIDGETS'
],
defines = [
'AA_EDITOR'
]
),
)

Errors:


LNK2001	unresolved external symbol "public: virtual void * __cdecl alternativeaudiohelper::qt_metacast(char const *)" (?qt_metacast@alternativeaudiohelper@@UEAAPEAXPEBD@Z)
LNK2001	unresolved external symbol "public: virtual int __cdecl alternativeaudiohelper::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@alternativeaudiohelper@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
LNK2001	unresolved external symbol "public: virtual int __cdecl alternativeaudiohelper::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@alternativeaudiohelper@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
LNK2001	unresolved external symbol "public: virtual struct QMetaObject const * __cdecl alternativeaudiohelper::metaObject(void)const " (?metaObject@alternativeaudiohelper@@UEBAPEBUQMetaObject@@XZ)
LNK2001	unresolved external symbol "public: virtual struct QMetaObject const * __cdecl alternativeaudiohelper::metaObject(void)const " (?metaObject@alternativeaudiohelper@@UEBAPEBUQMetaObject@@XZ)
LNK2001	unresolved external symbol "public: virtual void * __cdecl alternativeaudiohelper::qt_metacast(char const *)" (?qt_metacast@alternativeaudiohelper@@UEAAPEAXPEBD@Z)
respondido há 6 anos
0

Header:


#ifndef ALTERNATIVEAUDIOHELPER_CODE_H
#define ALTERNATIVEAUDIOHELPER_CODE_H
#include <QMainWindow>
#include <QtWidgets/QListWidget>
namespace Ui {
class alternativeaudiohelper;
}
class alternativeaudiohelper : public QMainWindow {
Q_OBJECT
public:
explicit alternativeaudiohelper(QWidget *parent = 0);
~alternativeaudiohelper();
private slots:
//Config
void on_btnApplyConfig_clicked();
void on_lstConfigPlaybackLib_itemClicked(QListWidgetItem *item);
//Playback Libs
void on_lstPlaybackLibs_itemClicked(QListWidgetItem *item);
//Audio Libs
void on_lstAudioLibs_itemClicked(QListWidgetItem *item);
private:
Ui::alternativeaudiohelper *ui;
};
#endif // ALTERNATIVEAUDIOHELPER_CODE_H

Source:


#include "StdAfx.h"
#include "alternativeaudiohelper.h"
//#include "ui_alternativeaudiohelper.h"
//#include "Editor\ui\ui_alternativeaudiohelper.h"
#include "Source\Editor\UI\ui_alternativeaudiohelper.h"
alternativeaudiohelper::alternativeaudiohelper(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::alternativeaudiohelper)
{
ui->setupUi(this);
}
alternativeaudiohelper::~alternativeaudiohelper()
{
delete ui;
}
//Config
void alternativeaudiohelper::on_btnApplyConfig_clicked()
{
auto libIndex = ui->lstConfigPlaybackLib->currentIndex();
auto deviceIndex = ui->lstConfigPlaybackDevice->currentIndex();
}
void alternativeaudiohelper::on_lstConfigPlaybackLib_itemClicked(QListWidgetItem *item)
{
ui->lstConfigPlaybackDevice->clear();
auto libIndex = ui->lstConfigPlaybackLib->currentIndex();
}
//Playback Libs
void alternativeaudiohelper::on_lstPlaybackLibs_itemClicked(QListWidgetItem *item)
{
ui->lstPlaybackDevices->clear();
}
//Audio Libs
void alternativeaudiohelper::on_lstAudioLibs_itemClicked(QListWidgetItem *item)
{
ui->lstAudioLibFormats->clear();
}
respondido há 6 anos
0

Yes the include path needs to be like I suggested above. What is the error that you get? Try taking a look at the BinTemp folder to see if the ui_alternativeaudiohelper.h is being generated.

respondido há 6 anos
0

Try this: #include "Source/Editor/ui/ui_alternativeaudiohelper.h"

respondido há 6 anos
0

Here's the editor waf_file:

  {
"none": {
"Source": [
]
},
"auto": {
"Editor/Include": [
],
"Editor/Source": [
],
"Editor/Source/Components": [
"Source/Editor/AlternativeAudioEditorSystemComponent.cpp",
"Source/Editor/AlternativeAudioEditorSystemComponent.h"
],
"Editor/Source/UI": [
"Source/Editor/ui/alternativeaudiohelper.ui",
"Source/Editor/ui/alternativeaudiohelper.cpp",
"Source/Editor/ui/alternativeaudiohelper.h"
]
}
}
respondido há 6 anos
0
#include "ui_alternativeaudiohelper.h"

Which, if i manually compile the ui to h, does work.

EDIT: tried "#include <Editor/ui/ui_alternativeaudiohelper.h>", same thing. "Cannot open include file" Is there something in the wscript that i'm missing? Also, even if i do manually compile the ui to h, it gives me linking errors:


LNK2001	unresolved external symbol "public: virtual int __cdecl alternativeaudiohelper::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@alternativeaudiohelper@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
LNK2001	unresolved external symbol "public: virtual int __cdecl alternativeaudiohelper::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@alternativeaudiohelper@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
LNK2001	unresolved external symbol "public: virtual struct QMetaObject const * __cdecl alternativeaudiohelper::metaObject(void)const " (?metaObject@alternativeaudiohelper@@UEBAPEBUQMetaObject@@XZ)
LNK2001	unresolved external symbol "public: virtual struct QMetaObject const * __cdecl alternativeaudiohelper::metaObject(void)const " (?metaObject@alternativeaudiohelper@@UEBAPEBUQMetaObject@@XZ)
LNK2001	unresolved external symbol "public: virtual void * __cdecl alternativeaudiohelper::qt_metacast(char const *)" (?qt_metacast@alternativeaudiohelper@@UEAAPEAXPEBD@Z)
LNK2001	unresolved external symbol "public: virtual void * __cdecl alternativeaudiohelper::qt_metacast(char const *)" (?qt_metacast@alternativeaudiohelper@@UEAAPEAXPEBD@Z)
respondido há 6 anos
0

"BinTemp\win_x64_vs2015_profile\Gems\AlternativeAudio\Code\Source\Editor\ui" -> Only "alternativeaudiohelper.cpp.141.obj" exists.

"BinTemp\Gems\AlternativeAudio\Code\Source\Editor\ui" -> Completely empty.

respondido há 6 anos
0

Ok, that apparently worked and is giving me the errors listed above about meta fuctions and variables:


LNK2001	unresolved external symbol "public: virtual int __cdecl alternativeaudiohelper::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@alternativeaudiohelper@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)
LNK2001	unresolved external symbol "public: virtual struct QMetaObject const * __cdecl alternativeaudiohelper::metaObject(void)const " (?metaObject@alternativeaudiohelper@@UEBAPEBUQMetaObject@@XZ)
LNK2001	unresolved external symbol "public: virtual void * __cdecl alternativeaudiohelper::qt_metacast(char const *)" (?qt_metacast@alternativeaudiohelper@@UEAAPEAXPEBD@Z)
respondido há 6 anos
0

That probably means it's having linker issues. Try just using uselib and remove autod_uselib. Also you should only need QT5Core, QT5GUI, and QT5Widgets unless you require the other libs somehow. Try also removing the features property.

Let me know what you end up with and what the output looks like. It might require a deeper investigation into why it can't find the symbols.

Thanks

respondido há 6 anos
0

I think i might have found out what's wrong.

The meta stuff is because the waf system isnt generating any moc files which is needed to compile.

I found all of the QT stuff in "BinTemp/<build>/qt" folder and ScriptCanvas generates moc files and .h files for ui's but not for my gem. Wierd...

respondido há 6 anos
0

@REDACTEDUSER

So the issue is that when compiling, moc is suppose to execute on the qt header and source files to generate moc files. apparently it does execute on the script canvas gem and generates moc files but it doesnt execute on my gem. I cant seem to find out why it executes on the script canvas gem but not my gem...

respondido há 6 anos

Esta postagem está fechada: a adição de novas respostas, comentários e votos está desativada.