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. Access the UI, from multiple windows.

Access the UI, from multiple windows.

Scheduled Pinned Locked Moved Solved General and Desktop
53 Posts 4 Posters 18.9k Views 2 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #41

    You wrote the method twice: once in the header and a second time in the implementation file. That's what the compilers is complaining about. You can have only one implementation.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    L 1 Reply Last reply
    0
    • SGaistS SGaist

      You wrote the method twice: once in the header and a second time in the implementation file. That's what the compilers is complaining about. You can have only one implementation.

      L Offline
      L Offline
      Loc888
      wrote on last edited by Loc888
      #42

      @SGaist Men, this stuff is default... I just add some extra parameters... What should i remove?

      Ps. Ok, i fixed it.

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Loc888
        wrote on last edited by
        #43

        For the love of God, this stuff is not working, i lost my patience.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Loc888
          wrote on last edited by
          #44

          Can someone create just any working example?? I want it to compile it, and see if it's gonna work.

          jsulmJ 1 Reply Last reply
          0
          • L Loc888

            Can someone create just any working example?? I want it to compile it, and see if it's gonna work.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #45

            @Loc888 Come on it's simple. Just remove the method definition from the header file:

            // Header :
            
            explicit Window1(Settings_Window *TheTrueOne = 0, QWidget *parent = 0);
            
            // Source:
            
            Window1::Window1(Settings_Window *TheTrueOne,QWidget *parent) :         
                QWidget(parent),ui(new Ui::Window1),
                GivenToMe(TheTrueOne)
            {
                ui->setupUi(this);
            }
            

            Some reading about C++ would help.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            L 1 Reply Last reply
            1
            • jsulmJ jsulm

              @Loc888 Come on it's simple. Just remove the method definition from the header file:

              // Header :
              
              explicit Window1(Settings_Window *TheTrueOne = 0, QWidget *parent = 0);
              
              // Source:
              
              Window1::Window1(Settings_Window *TheTrueOne,QWidget *parent) :         
                  QWidget(parent),ui(new Ui::Window1),
                  GivenToMe(TheTrueOne)
              {
                  ui->setupUi(this);
              }
              

              Some reading about C++ would help.

              L Offline
              L Offline
              Loc888
              wrote on last edited by Loc888
              #46

              @jsulm I fixed that issue.. I mean, when i change the checkBox in the other window, nothing change, and i try like 50 times and more, and same stuff, doesn't work,and i can't understand why.

              My compiler is giving me around 50 warnings, when i create non-static data member, it is normal?

              mrjjM 1 Reply Last reply
              0
              • L Loc888

                @jsulm I fixed that issue.. I mean, when i change the checkBox in the other window, nothing change, and i try like 50 times and more, and same stuff, doesn't work,and i can't understand why.

                My compiler is giving me around 50 warnings, when i create non-static data member, it is normal?

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #47

                @Loc888
                Hi
                Nope 50 warning is not normal.
                What does warnings say ?

                Also, if nothing happens. Are you sure u are not creating a second copy/instance ?

                L 1 Reply Last reply
                0
                • mrjjM mrjj

                  @Loc888
                  Hi
                  Nope 50 warning is not normal.
                  What does warnings say ?

                  Also, if nothing happens. Are you sure u are not creating a second copy/instance ?

                  L Offline
                  L Offline
                  Loc888
                  wrote on last edited by
                  #48

                  @mrjj

                  mainwindow.h:41: Warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
                  Settings_Window* Settings_Widget = new Settings_Window;
                  ^

                  Men, i don't know about that instance.....I send you a simple project, and if you want., you can take a look, i am really tired.

                  mrjjM 1 Reply Last reply
                  0
                  • L Loc888

                    @mrjj

                    mainwindow.h:41: Warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11 [enabled by default]
                    Settings_Window* Settings_Widget = new Settings_Window;
                    ^

                    Men, i don't know about that instance.....I send you a simple project, and if you want., you can take a look, i am really tired.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #49

                    @Loc888
                    Hi
                    It gives that warning if you do

                    class xxx : whatever {
                    int var =0;
                    }
                    and not using c++ 11

                    Do you have
                    Settings_Window* Settings_Widget = new Settings_Window;
                    in a. h file ?

                    Yes, please. zip project. upload to somewhere and send me link.

                    L 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @Loc888
                      Hi
                      It gives that warning if you do

                      class xxx : whatever {
                      int var =0;
                      }
                      and not using c++ 11

                      Do you have
                      Settings_Window* Settings_Widget = new Settings_Window;
                      in a. h file ?

                      Yes, please. zip project. upload to somewhere and send me link.

                      L Offline
                      L Offline
                      Loc888
                      wrote on last edited by
                      #50

                      @mrjj

                      http://www.mediafire.com/file/n9e0d3q02soc3z5/Test_3.rar

                      Yes, it's in .h file. Correct this stuff if you can, and try to compile, because i do a lot of tries, and i don't really know how it's looks like right now.

                      mrjjM 1 Reply Last reply
                      0
                      • L Loc888

                        @mrjj

                        http://www.mediafire.com/file/n9e0d3q02soc3z5/Test_3.rar

                        Yes, it's in .h file. Correct this stuff if you can, and try to compile, because i do a lot of tries, and i don't really know how it's looks like right now.

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #51

                        @Loc888
                        Hi
                        Im not getting those warning.
                        While i look in project, you can try adding
                        CONFIG +=c++11
                        in the .pro file.
                        Delete all in build folder
                        and rebuild all

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

                          Hi
                          You do create a brand new mainwindow. so
                          that is why you dont see the checked checkbox as that is in first copy

                          void Window1::on_Check_Button_clicked()
                          {
                          
                              MainWindow* W1 = new MainWindow; // not the first one, u open settings in..
                          
                              ui->lineEdit->setText("Is not checked.");
                          
                          
                          
                          1 Reply Last reply
                          1
                          • mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #53

                            Hi
                            Here is working project.
                            Main issue was you created a NEW mainwindow so
                            the setting_Widget was NOT the same as one where u checked checkbox..

                            https://www.dropbox.com/s/nhrr9qpv76d1r07/Test_3B.zip?dl=0

                            I fixed it to give window1 as parameter and use it that way.
                            (as described higher up)

                            1 Reply Last reply
                            1

                            • Login

                            • Login or register to search.
                            • First post
                              Last post
                            0
                            • Categories
                            • Recent
                            • Tags
                            • Popular
                            • Users
                            • Groups
                            • Search
                            • Get Qt Extensions
                            • Unsolved