Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to create a QWidget with a Tk window as parent?
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 897 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vladbogo
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved