How to create a QWidget with a Tk window as parent?



  • I am trying to embed Qt in a Tk window. After researching I found out that this should be possible with the QWidget::create function, but I haven't been successful yet. Here is what I tried:

    @
    class QTkMainWindow: public QWidget {
    public:
    QTkMainWindow(WId win):QWidget() {
    create(win, false, true);
    }
    };

    void open(int argc, char*argv) {
    /
    create the Tk window - win */
    ...
    Window w = Tk_WindowId(win);
    QApplication *qapp = new QApplication(argc, argv);
    QTkMainWindow *w = new QTkMainWindow(w);
    w->show();
    Tk_MapWindow(win);
    }
    @

    The problem is that instead of setting the QWidget's window as the Tk one, I simply get 2 windows.What am I doing wrong?

    Thanks!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.