[SOLVED] QT5: Promoting widget inside a promoted form class
-
wrote on 29 Jan 2013, 11:27 last edited by
Yes, it's all ok.
form1.h
@#ifndef FORM1_H
#define FORM1_H#include <QWidget>
namespace Ui {
class Form1;
}class Form1 : public QWidget
{
Q_OBJECTpublic:
explicit Form1(QWidget *parent = 0);
~Form1();private:
Ui::Form1 *ui;
};#endif // FORM1_H
@form2.h
@#ifndef FORM2_H
#define FORM2_H#include <QWidget>
namespace Ui {
class Form2;
}class Form2 : public QWidget
{
Q_OBJECTpublic:
explicit Form2(QWidget *parent = 0);
~Form2();private:
Ui::Form2 *ui;
};#endif // FORM2_H
@MainWindows contains a widget. This widget is promoted to Form1, wich contains a widget promoted to Form2.
What should I check now?
-
wrote on 29 Jan 2013, 12:07 last edited by
Which IDE & compiler do you use? I have same construction(promoted widget in promoted widget) and it works in VS(msvc) & QtCreator(gcc). But your linker somhow can't find object file with Form2... Try to include Form2 header in Form1 header to ensure it will be compiled....
-
wrote on 29 Jan 2013, 12:10 last edited by
Can you attach an image of the Object Inspector/Explorer of the MainWindow .
-
wrote on 29 Jan 2013, 15:46 last edited by
AcerExtensa, I have VS & QTCreator(vc). I have tried including form2.h in form1.h, but the same result.
Sam, this is the image:
"https://docs.google.com/file/d/0B0QWPtcmBoNIRDBmM1p0QVBPOVU/edit":https://docs.google.com/file/d/0B0QWPtcmBoNIRDBmM1p0QVBPOVU/edit -
wrote on 29 Jan 2013, 15:56 last edited by
Nops not this image . open mainwindow.ui the object inspector is on extreme right just above the property explorer.
-
wrote on 29 Jan 2013, 16:09 last edited by
-
wrote on 29 Jan 2013, 16:11 last edited by
Here is project with promoted widget in promoted widget of main widget. It works in QtCreator(gcc) and in MSVC: "PromoWidget.tar.gz":http://xplatforms.de/PromoWidget.tar.gz
Test it in your Environment.
-
wrote on 29 Jan 2013, 16:38 last edited by
I'll get crazy with this. Your project works perfect! I have been comparing file by file and all seems exactly the same. But mine keeps giving me this error.
This is my project (ultra basic, just like yours):
"https://docs.google.com/file/d/0B0QWPtcmBoNIdHFxZ1dHSVpTX0U/edit":https://docs.google.com/file/d/0B0QWPtcmBoNIdHFxZ1dHSVpTX0U/editThanks for all your responses and your time!
-
wrote on 29 Jan 2013, 19:42 last edited by
I can compile and run your project without problems whatsoever. Have you tried cleaning your project and rerunning qmake? Sometimes hitting rebuild isn't enough.
-
wrote on 30 Jan 2013, 06:27 last edited by
I don't know what you mean with "clean" but I have deleted the debug folder and recompile... and it worked! Thanks everyone! I'll change the post to "solved"!
-
wrote on 30 Jan 2013, 06:32 last edited by
[quote author="Jufa" date="1359527268"]I don't know what you mean with "clean" [/quote]
Right Click on your Project Tree there is an option in the context Menu "Clean" , which will clear the moc files generated by the compiler in debug and release folder of your project. -
wrote on 4 Feb 2013, 11:52 last edited by
Thanks! That made the trick!
thread marked as solved.
12/14