PDA

View Full Version : Qt as only Gui Module (QMainWindow Params)



radex99
29th August 2010, 08:32
Hello all!

This my first thread, I`ve just started my adventure with qt but i have problem I cannot not find the solutions.

Ok, I want to send parameter into qmainwindow, Beacuse I dont want to put my application Logic there. I will use not one, but three or four windows. I would like to have myApp manager which will call mywindows with parameter ( an object wchich holds data gathered and filled by window) to another module which will use this data and eventualy fill it and then this data will be set in Window. Is there any way to do this a i was trying to add my constructor to MainWindow but i`ve failed, Maybe to override QApplication in some way? And another thing is that i don`t want to use a singleton for my Data class.

Regards

tbscope
29th August 2010, 09:24
Create a constructor with more parameters.

radex99
30th August 2010, 16:39
I`ve trying to do this and can`t do it could you give me an example? please,
Default constructor has QWidget param which i cannot create and send beacuse its private, the only way to create mainwindow is

MainWindow w;

when i use new, i can`t send ptr to QWidget, which is used in QMainWindow class constructor as parent. I didnt manage to made MainWindow object using "new" operator and cannot made good constructor with addinational param pls help

wysota
30th August 2010, 17:20
You have to create a constructor in the code of the MainWindow class. There already is one taking a QWidget pointer as a parameter. Add another (or extend the one that is already there) that takes the parameters you want. This is basic C++!

radex99
30th August 2010, 18:13
Sorry for mess it was my stupid mistake sorry again, for close and thx