[PyKDE] QTable setBackgroundOrigin problem

Dave S eric3 at pusspaws.net
Sun Sep 17 09:48:57 BST 2006


...mmm ... hitting a lot of problems.

My plan - to have a properly scaled background to my QTable with logo on it 
that re-sizes as my window resizes. Thanks to help from you guys I can now 
display my PNG :) but I have hit multiple problems. Splitting them up :

Problem 1: The following code displays multiple unscaled copies of my PNG 
inside the QTable but the top LHS corner origin of QTable does not display 
the top LHS corner of my image, it starts displaying my image at about 1/3 of 
the way down. It is as if the top LHS origin is actually the top LHS origin 
of the parent main window not the QTable itself

        backgnd_png = self.config.get('files','background') 
        self.table1.setBackgroundOrigin(QWidget)
        image = QImage(backgnd_png)
       
        self.table1.setPaletteBackgroundPixmap(QPixmap(image))

I made sure that 'WidgetOrigin' is set and am unsure where I have gone wrong. 
I have looked at Qpoint but this does not seem applicable.

Problem 2: The scaling of my image with the following code does not appear 
correct though I cannot be sure until I have sorted problem 1 :) The image 
appears broken up to fit the QTable


        table_frame  = self.table1.frameSize()
        table_pxwidth = table_frame.width() 
        table_pxheight = table_frame.height() 
        
        print table_pxwidth,table_pxheight
        self.table1.setBackgroundOrigin(QWidget.WidgetOrigin)
        image = QImage(backgnd_png)
	self.table1.setPaletteBackgroundPixmap(QPixmap(image.scale(table_pxwidth, 
table_pxheight, QImage.ScaleFree)))

Any suggestions

Thanks in advance

Dave






More information about the PyQt mailing list