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

Access the UI, from multiple windows.

Scheduled Pinned Locked Moved Solved General and Desktop
53 Posts 4 Posters 15.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.
  • S Offline
    S Offline
    SGaist
    Lifetime Qt Champion
    wrote on 4 Feb 2018, 22:07 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 4 Feb 2018, 23:11
    0
    • S SGaist
      4 Feb 2018, 22:07

      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 4 Feb 2018, 23:11 last edited by Loc888 2 Apr 2018, 23:18
      #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 5 Feb 2018, 00:48 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 5 Feb 2018, 04:17 last edited by
          #44

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

          J 1 Reply Last reply 5 Feb 2018, 05:42
          0
          • L Loc888
            5 Feb 2018, 04:17

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

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 5 Feb 2018, 05:42 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 5 Feb 2018, 18:27
            1
            • J jsulm
              5 Feb 2018, 05:42

              @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 5 Feb 2018, 18:27 last edited by Loc888 2 May 2018, 18:28
              #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?

              M 1 Reply Last reply 5 Feb 2018, 18:35
              0
              • L Loc888
                5 Feb 2018, 18:27

                @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?

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 5 Feb 2018, 18:35 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 5 Feb 2018, 19:07
                0
                • M mrjj
                  5 Feb 2018, 18:35

                  @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 5 Feb 2018, 19:07 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.

                  M 1 Reply Last reply 5 Feb 2018, 19:10
                  0
                  • L Loc888
                    5 Feb 2018, 19:07

                    @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.

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 5 Feb 2018, 19:10 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 5 Feb 2018, 19:32
                    0
                    • M mrjj
                      5 Feb 2018, 19:10

                      @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 5 Feb 2018, 19:32 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.

                      M 1 Reply Last reply 5 Feb 2018, 19:37
                      0
                      • L Loc888
                        5 Feb 2018, 19:32

                        @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.

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 5 Feb 2018, 19:37 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
                        • M Offline
                          M Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on 5 Feb 2018, 19:39 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
                          • M Offline
                            M Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on 5 Feb 2018, 19:49 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

                            41/53

                            4 Feb 2018, 22:07

                            • Login

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