Results 1 to 2 of 2

Thread: Problem with QTabWidget and QX11EmbedWidget, keyboard stops working

  1. #1
    Join Date
    Sep 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default 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:

    Qt Code:
    1. #include "mainwindow.h"
    2.  
    3. MainWindow::MainWindow(QWidget *parent) : QWidget(parent), ui(new Ui::Prototype_tab)
    4. {
    5. showMaximized();
    6.  
    7. ui->setupUi(this);
    8.  
    9. connect(ui->startButton, SIGNAL(pressed()), this, SLOT(startPrototype()));
    10. connect(ui->stopButton, SIGNAL(pressed()), this, SLOT(stopPrototype()));
    11. }
    12.  
    13. MainWindow::~MainWindow()
    14. {
    15. delete ui;
    16. }
    17.  
    18. void MainWindow::startPrototype() {
    19. ui->startButton->setEnabled(false);
    20. ui->label_screenshot->hide();
    21. container = new QX11EmbedContainer(ui->tabWidget);
    22. container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    23. container->setMinimumSize(600, 600);
    24. ui->gridLayout->addWidget(container,1,1);
    25. myProcess = new QProcess(container);
    26. myProcess->setWorkingDirectory("../../simpleX11Embed/build");
    27. myProcess->start("./simpleX11Embed", QStringList() << "-into" << QString().setNum(container->winId()));
    28. ui->stopButton->setEnabled(true);
    29. connect(myProcess, SIGNAL(finished(int)), this, SLOT(enableStartButton()));
    30. }
    31.  
    32. void MainWindow::stopPrototype() {
    33. myProcess->close();
    34. }
    35.  
    36. void MainWindow::enableStartButton() {
    37. container->close();
    38. ui->label_screenshot->show();
    39. ui->stopButton->setEnabled(false);
    40. ui->startButton->setEnabled(true);
    41. }
    42.  
    43. int main(int argc, char *argv[])
    44. {
    45. QApplication a(argc, argv);
    46. MainWindow w;
    47. w.show();
    48.  
    49. return a.exec();
    50. }
    To copy to clipboard, switch view to plain text mode 

    Second Widget :

    Qt Code:
    1. #include "simpleX11Embed.h"
    2.  
    3. MainWindow::MainWindow(QWidget *parent) : QX11EmbedWidget(parent) {
    4.  
    5. QTextEdit *textBrowser = new QTextEdit();
    6. textBrowser->setFocusPolicy(Qt::StrongFocus);
    7. textBrowser->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    8.  
    9. QVBoxLayout *widlayout = new QVBoxLayout(this);
    10. widlayout->addWidget(textBrowser);
    11. }
    12.  
    13. int main(int argc, char *argv[]){
    14. QApplication app(argc, argv);
    15.  
    16. if(app.arguments().count() > 2)
    17. if (app.arguments()[1] == "-into") {
    18. QString windowId(app.arguments()[2]);
    19. MainWindow window;
    20. window.embedInto(windowId.toULong());
    21. window.show();
    22. return app.exec();
    23. }
    24.  
    25. MainWindow w;
    26. w.show();
    27. return app.exec();
    28. }
    To copy to clipboard, switch view to plain text mode 

    I'm attaching the source too.

    To get on my error when executing the SimpleX11Container:

    press start button, press tab, press tab again, type anything int the text edit, press stop button and press the right arrow to change tab, then the keyboard stop.
    Attached Files Attached Files

  2. #2
    Join Date
    Sep 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QTabWidget and QX11EmbedWidget, keyboard stops working

    Please guys, nobody has a suggestion? I need a clue to solve this problem.

    I think the problem is with my QX11EmbedWidget, because if I test my program with the xterm everything works fine, but I don't know where to start.

    Or maybe is a bug with Qt.

    I'm using Ubuntu 10.10 64 bits and qtCreator 2.0.1

Similar Threads

  1. Application stops working unexpectedly
    By baluk in forum Newbie
    Replies: 16
    Last Post: 20th November 2010, 16:06
  2. Not Working - USB Keyboard Plugin in Qt-Embedded
    By augusbas in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 16th July 2009, 10:57
  3. tab stops ?
    By ixM in forum Qt Programming
    Replies: 4
    Last Post: 28th May 2009, 14:11
  4. On Screen Keyboard Problem
    By cutie.monkey in forum Qt Programming
    Replies: 1
    Last Post: 16th July 2008, 14:28
  5. Keyboard shortcuts problem.
    By Lemming in forum Qt Programming
    Replies: 4
    Last Post: 5th April 2006, 17:12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.