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. Connection
Forum Updated to NodeBB v4.3 + New Features

Connection

Scheduled Pinned Locked Moved General and Desktop
signalqwidgetqmainwindow
6 Posts 3 Posters 2.0k Views 3 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.
  • G Offline
    G Offline
    Gillou_beginqt
    wrote on last edited by Gillou_beginqt
    #1

    How is it possible to connect a widget from the main window to a different widget created with qt designer

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      Hi and welcome to devnet

      Probably you have to give some more details of you like to do. Possibly also some code would be good.

      Basically you have to decide where to make your connect. Then you need to have pointers to the main window and the other widget.
      Alternatively, you may also be able to connect signals and slots directly in designer.

      Did you follow some tutorial and some of the examples?

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • G Offline
        G Offline
        Gillou_beginqt
        wrote on last edited by
        #3

        I have two different form: a main windows and a widget. On the main windows I just placed a button and on the widget a line edit and a calender widget. What I want is that when you click on on the button in the main windows, the second form appears. How to connect them using signal and slots

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          "How to connect them using signal and slots "

          Not sure here what you want to connect. :)

          To show another "form", you can just create an instance - when you need it and
          tell it to be shown.

          There are different ways of showing such form.
          it can be like a dialog and block the other window
          or they can both be active. show() vs exec()

          so to show your other "form"

          Add a variable to MainWin to hold your pointer

          OtherWindow  *Mywin;
          

          then in the constructor

          MainWin::MainWin...
              Mywin = new OtherWindow ( this );       
          

          create an instance.
          then to show it

          void MainWin::on_pushButton_clicked()
          {
                  Mywin->show();
          }
          
          1 Reply Last reply
          0
          • G Offline
            G Offline
            Gillou_beginqt
            wrote on last edited by Gillou_beginqt
            #5

            I tried that one but still not working.
            Basically I went to connect two different qmainwindows using a button. The button will be one the first main windows. If the button is pressed the second main windows appear

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Hmm, it should work.

              Can you post the code?

              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