PDA

View Full Version : Creating And Destoying composite Widgets



morraine
30th August 2008, 10:47
hello, i'm trying to build an application which can dynamically load and destroy pages with in the app. but I'm having problems rendering loaded pages properly.

i have attached some screen shots to show what i mean.

i first open the application which has the page loaded in the middle with some tab widgets and lineeditors and a tableView. then i press the delete page button which destroys the widget containing all the aforementioned parts and then i press add page which is meant to create the page again in memory, but i now does not render the page properly. I've done this in pyqt and this it the code for the add page function and delete page function.



def SearchAndAddCustomer(self):
//this is the new object from the class which creates the search customer widget and all its contents
self.SearchAndAdd = customerSearch(self)
// this is the widget which holds the search customer widget on the main app back (the dark grey area) which is a Stacked widget called doubleContent
self.mainApplicationStack = centralHolder2(self)
// layout onto the dark grey area
self.mainApplicationStackLayout = QGridLayout (self.mainApplicationStack.centralCanvas)

self.mainApplicationStackLayout.addWidget(self.Sea rchAndAdd)
self.mainApplicationStackLayout.setContentsMargins (0,0,0,0)
self.mainApplicationStackLayout.setSpacing(0)
//add the pages to the stack widget
self.doubleContent.insertWidget(0,self.mainApplica tionStack)


def SearchAndAddCustomerDelete(self):
self.SearchAndAdd.destroy()
self.doubleContent.removeWidget(self.mainApplicati onStack)
self.mainApplicationStack.destroy()


how can i render a page properly which is not in memory at the start of the application?
I'm i missing some thing?
you input on this will be very grateful

wysota
30th August 2008, 14:15
What is wrong exactly? Those screenshots don't say anything by themselves.

morraine
30th August 2008, 16:45
i thought the screen shot was obvious that there is some thing wrong.

Basically in the first screen shot then application is first loaded with the middle page from the start.
then i activate a function to delete the central page which in screen shot 2 you will see the middle nit is now gone and it is a dark grey background.
then i activate a function to load it again and the page does not render properly. the table view scroll bar wont work the combobox has gone but for a little square and the tab widgets back grounds have disappeared letting the dark grey through.

basically when i destroy and load the page again it does not render like it should like how it renders the first time when the application is loaded .

do you know why this is happening?

wysota
31st August 2008, 16:57
Do you use layouts while creating those pages?