On Sat, Sep 19, 2009 at 5:09 PM, David Boddie <[email protected]> wrote: > > On Sat Sep 19 19:27:06 BST 2009, Kurt Schwarz wrote: > > > I'm having problems displaying a widget as a child inside a window. The > > code below should create a window that is 500 x 500 with a red box inside > > 400 x 400. > > > > If I replace self.ChildWidget = AppWidget( self ) with self.ChildWidget = > > QtGui.QWidget( self ) I get the desired result, what am I doing wrong with > > AppWidget( ) that would cause it not to display correctly? > > I don't think you're doing anything wrong. I quickly rewrote the example in > C++ and verified that it works. > > > #include <QtGui> > > class AppWidget : public QWidget > { > public: > AppWidget(QWidget *parent = 0) : QWidget(parent) {} > }; > > class AppWindow : public QMainWindow > { > public: > AppWindow() : QMainWindow() { > setGeometry( 30, 30, 500, 500 ); > > ChildWidget = new AppWidget(this); > ChildWidget->setGeometry( 10, 10, 400, 400 ); > ChildWidget->setStyleSheet( "background-color: #ff0000" ); > } > > private: > QWidget *ChildWidget; > }; > > int main(int argc, char *argv[]) > { > QApplication app(argc, argv); > AppWindow MainWindow; > MainWindow.show( ); > return app.exec( ); > } > > > In your Python version, if you change the base class of AppWidget to QFrame, > it works, so there's definitely something strange happening. > > David
Hey David thanks for trying it out in C++, I tried changing the base class to QFrame and it does appear to be working correctly on my end as well. I guess the QWidget thing is a bug. _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
