QWinWidget unter Qt 4.1
-
Hallo,
auf http://lists.trolltech.com/qt-interest/2003-03/thread00373-0.html habe ich die Deklaration einer QWinWidget-Klasse entdeckt, allerdings für Qt3. Nuni st meine Absicht eine Anwendung mit dem Win32-API und Qt Open-Source 4.1 zu schreiben. Genau dafür fehlt mir aber entweder das kommerzielle Qt/MFC Migration Framework oder eine QWinWidget-Klasse, die sich unter Qt 4.1 übersetzten lässt. Das ist mein Dilemma.
Hier noch mal die Klasse aus o.g. Quelle:
class QWinWidget : public QWidget { public: QWinWidget( HWND hParentWnd, QObject *parent = 0, const char *name = 0 ) : QWidget( 0, name ), hParent( hParentWnd ) { if ( parent ) parent->insertChild( this ); // make the widget window style be WS_CHILD so SetParent will work SetWindowLong(winId(), GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS ); SetParent(winId(), hParentWnd); topData()->ftop = 0; topData()->fleft = 0; topData()->fbottom = 0; topData()->fright = 0; setBackgroundMode( QWidget::NoBackground ); } void childEvent( QChildEvent *e ) { QObject *obj = e->child(); if ( e->inserted() ) { if ( obj->isWidgetType() ) { QWidget *w = (QWidget*)obj; if ( w->isModal() ) { EnableWindow( hParent, FALSE ); w->installEventFilter( this ); } } } else { EnableWindow( hParent, TRUE ); } } protected: bool eventFilter( QObject *o, QEvent *e ) { if ( e->type() == QEvent::Hide ) EnableWindow( hParent, TRUE ); return QWidget::eventFilter( o, e ); } private: HWND hParent; };
Bin für jeden Tipp dankbar,
Thomas