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. Problem with QTabWidget and QX11EmbedWidget, keyboard stops working
QtWS25 Last Chance

Problem with QTabWidget and QX11EmbedWidget, keyboard stops working

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.7k Views
  • 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.
  • J Offline
    J Offline
    J_ocaetano
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • I Offline
      I Offline
      infoctopus
      wrote on last edited by
      #2

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

      Qt rulez

      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