Important: Please read the Qt Code of Conduct -

Unable to add widgets to the newly navigated window

  • hai everybody , thanks for your help. Now i am able to navigate from one window to other.
    I need to add some widgets in the navigated window. But when i am adding it is not seen in the new window. Can anybody help in this. Advance thanks to all

  • It will be helpuful if you can share your code .

  • Maybe you are missing on

    void QWidget::setLayout ( QLayout * layout )


  • sorry for the late reply. I am attaching the code. as the code is having more .cpp and .h files, i am attaching only the page for which the clarification is needed. once again i will tell the aim of the program is listed below:
    (1) i want to access the serially transmitted datas from another computer
    (2) As soon as the datas are received the same should be displyed in a oscilloscope.

    Problem to be solved:
    (1) I am able to display one window and able to collect the data through serial port. I have placed a push button in that window. wen the push button is clicked i want to generate a new window in which the qwt oscilloscope window has to be displayed.
    (2) I will show the line of code which i have written in this program for the same

    connect(ui->openCloseButton, SIGNAL(clicked()), SLOT(osci()));

    after the same i have called the osci() function as the one below.
    void MainWindow::osci()
    QMainWindow *osci = new QMainWindow(this);
    osci->show(); }

    Now wen i am clicking a new window is displaying . My question is how to add the components into that new window. or how to include the oscilloscope program of qwt to it .
    I was not able to post the entire code here as it is showing exceeding of 6000 characters
    I will really gratefull if anybody can give the solution for the one above.
    I am conveying my advance thanks to all.

    expecting a postive reply

  • Hi Sanoop,
    Instead of a regular QMainWindow, create your own window subclassed from a QMainWindow.

    class osciWindow : public QMainWindow
    ..... // define your elements
    QPushButton *button1;
    QPushButton *button2;

    In your slot, display the above window.....
    osciWindow *osci = new osciWindow(this);

    Follow the Qt examples, they are very good.

  • thanks alot . i will try the same and get back to you

Log in to reply