[Solved] Self contained objects
-
Ok,
here it is : "link ":http://dl.dropbox.com/u/33544011/testAlfah.zip
This is what I did :
I made a new GUI QDialog based project
I opened the ui file and added a QTabWidget to it and a layout.Then I added a class based on a ui : myCalendar
I opened the myCalendar.ui file in Qt Creator and added 3 buttons with a layout.
Now this class is ready to be used elsewhere.In the constructor of the dialog class I added the following code :
@ myCalendar * cal = new myCalendar(); //make an instance of my class
QVBoxLayout* lay = new QVBoxLayout(ui->tab); //add a layout
lay ->addWidget(cal);@
When you run you will see your myCalendar class in the first tab.If you have any questions, please use this example to ask specific questions.
-
im goin through the code. will get back to you :)
alfah
-
ok questions :)
- Dialog class has Qwidget as parent right. now if i have a class named , say , myForm which has QMainWindows as parent. would this be still possible???
- When i run application on C7, it jus fills half the screen, is it cuz Dialog has widget as parent?. Can this be solved by making QMainWindows as the parent of Dialog
alfah
-
I think you are mixing up things. parent is not the same as inheriting from...
@Dialog::Dialog(QWidget *parent) :
QDialog(parent), // this can be a QMainWindow
ui(new Ui::Dialog)@The dialog class is derived from QDialog. You could use a QmainWindow for that of course.
-
Hi Alfah,
You are lucky I came back here. I notice you have added a question in your previous post. Please use the "Post a reply" editor to ask more questions, otherwise we probably will not see them. ;)
Anyway about your second question :
bq. 2. When i run application on C7, it jus fills half the screen, is it cuz Dialog has widget as parent?. Can this be solved by making QMainWindows as the parent of Dialog
I didn't see until now you were using mobile.
It's better to use a mobile based project instead of the GUI one I suggested you before. In that case your window will be maximized automatically for you. I tested it with Symbian^3 and the emulator since I don't have a C7. But the general principles you learned are the same. -
oops sorry :)
I tried to create a new application jus like the example with MainWindow.cpp,MainWindow.ui and MainWindow.h and form1.cpp,form1.ui,form1.h.
These are of QMainWindow. I have pulled in a tabwidget into MainWindow.ui.
The problem is im not able to use tabWidget.
u;.tabwidget is not recognized :( :(
when ui-> is typed i get only options like centralWidget,MainWindow.So im stuck. Feel like its some silly error
:(
-
bq. The problem is im not able to use tabWidget.
have you other projects open in Qt Creator? Close them and try to use ui. again. I noticed Qt Creator sometimes looks in other ui files which have been opened.
-
I have filed a bug report "QTCREATORBUG-5730":https://bugreports.qt.nokia.com/browse/QTCREATORBUG-5730 for this behaviour .
I you encounter that too, please vote for it to get it resolved.
-
ahhhhhhhhhhh exactlyy :) i closed and opened the creator and I got the widgets!!!!
got it right :)
annd yeaaaa it runsssssssss :)
now im back to my own project tryin to implement what you've taught :)
thanks
alfah
-
for voting i can use the same username and password to login??
EDIT: i signed up :) -
Great!
To vote you have to register first. unfortunately you cannot use the same username and password as in the devnet forum.
bq. i closed and opened the creator and I got the widgets!!!!
did you have any other projects open in Qt Creator? I ask to analyse a bit more when this occurs.
And could you please set the title to solved by editing it and adding [Solved] in front of it?
-
:) i had the testalfah project opened along with my new project :)
But even after closing the testalfah project I could not get the widgets. -
bq. But even after closing the testalfah project I could not get the widgets.
Thanks for the feedback.