Problem with QTabWidget and QX11EmbedWidget, keyboard stops working



  • Hi, in my applicatin I have two widgets constructed separately. Using QX11EmbedContainer + QProcess I can execute the second widget inside the first, and it works fine.

    The problem is when I stop the second when it has the focus and I change the actual tab(First widget has a QtabWidget), the keyboard simply stop working.

    I have no idea what might be happening.

    This is my code:

    First Widget:

    @#include "mainwindow.h"

    MainWindow::MainWindow(QWidget *parent) : QWidget(parent), ui(new Ui::Prototype_tab)
    {
    showMaximized();

    ui->setupUi(this);
    
    connect(ui->startButton, SIGNAL(pressed()), this, SLOT(startPrototype()));
    connect(ui->stopButton, SIGNAL(pressed()), this, SLOT(stopPrototype()));
    

    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow::startPrototype() {
    ui->startButton->setEnabled(false);
    ui->label_screenshot->hide();
    container = new QX11EmbedContainer(ui->tabWidget);
    container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    container->setMinimumSize(600, 600);
    ui->gridLayout->addWidget(container,1,1);
    myProcess = new QProcess(container);
    myProcess->setWorkingDirectory("../../simpleX11Embed/build");
    myProcess->start("./simpleX11Embed", QStringList() << "-into" << QString().setNum(container->winId()));
    ui->stopButton->setEnabled(true);
    connect(myProcess, SIGNAL(finished(int)), this, SLOT(enableStartButton()));
    }

    void MainWindow::stopPrototype() {
    myProcess->close();
    }

    void MainWindow::enableStartButton() {
    container->close();
    ui->label_screenshot->show();
    ui->stopButton->setEnabled(false);
    ui->startButton->setEnabled(true);
    }

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec&#40;&#41;;
    

    }@

    Second Widget :

    @#include "simpleX11Embed.h"

    MainWindow::MainWindow(QWidget *parent) : QX11EmbedWidget(parent) {

    QTextEdit *textBrowser = new QTextEdit();
    textBrowser->setFocusPolicy(Qt::StrongFocus);
    textBrowser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    
    QVBoxLayout *widlayout = new QVBoxLayout(this);
    widlayout->addWidget(textBrowser);
    

    }

    int main(int argc, char *argv[]){
    QApplication app(argc, argv);

    if(app.arguments().count() > 2)
        if (app.arguments()[1] == "-into") {
            QString windowId(app.arguments()[2]);
            MainWindow window;
            window.embedInto(windowId.toULong());
            window.show();
            return app.exec();
         }
    
    MainWindow w;
    w.show();
    return app.exec();
    

    }@

    My thread in qtcentre forum with the source code to download: "http://www.qtcentre.org/threads/36608-Problem-with-QTabWidget-and-QX11EmbedWidget-keyboard-stops-working":http://www.qtcentre.org/threads/36608-Problem-with-QTabWidget-and-QX11EmbedWidget-keyboard-stops-working



  • No prompt answer, but I'd suggest to try debugging


Log in to reply
 

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