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. Unable to add widgets to the newly navigated window
Qt 6.11 is out! See what's new in the release blog

Unable to add widgets to the newly navigated window

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 2.7k 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.
  • S Offline
    S Offline
    sanoop
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sam
      wrote on last edited by
      #2

      It will be helpuful if you can share your code .

      1 Reply Last reply
      0
      • A Offline
        A Offline
        amban
        wrote on last edited by
        #3

        Maybe you are missing on

        @
        void QWidget::setLayout ( QLayout * layout )
        @

        ?

        1 Reply Last reply
        0
        • S Offline
          S Offline
          sanoop
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • A Offline
            A Offline
            amban
            wrote on last edited by
            #5

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

            Example
            @
            class osciWindow : public QMainWindow
            {
            Q_OBJECT
            ..... // define your elements
            QPushButton *button1;
            QPushButton *button2;
            }
            @

            In your slot, display the above window.....
            @
            MainWindow::osci()
            {
            osciWindow *osci = new osciWindow(this);
            osci->show();
            }
            @

            Follow the Qt examples, they are very good.

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sanoop
              wrote on last edited by
              #6

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

              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