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. [SOLVED]Need help with combining GUI
Forum Updated to NodeBB v4.3 + New Features

[SOLVED]Need help with combining GUI

Scheduled Pinned Locked Moved General and Desktop
guiformsmainwindow
18 Posts 4 Posters 5.2k 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.
  • Z Offline
    Z Offline
    zhihaowu
    wrote on 1 Oct 2015, 07:52 last edited by zhihaowu 10 Jan 2015, 11:23
    #1

    Greetings to all Qt'er,

    This is my first post. So please excuses me for me for not knowing the topic rules.

    I just got into Qt recently for doing a project and I am not familiar with the user interface and tools. Would like to get some help here.

    Can someone show me an example of combining two Qt GUI project together?

    Greetings,

    Zhihao

    #update1: Forgot to mention that I just started learning C++

    1 Reply Last reply
    0
    • G Offline
      G Offline
      GrahamL
      wrote on 1 Oct 2015, 07:55 last edited by
      #2

      Hi
      Welcome to Qt

      Please explain what you mean by 'Combine Qt Projects'

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zhihaowu
        wrote on 1 Oct 2015, 08:18 last edited by
        #3

        Hi GrahamL,

        I just succeeded adding 2 project together. but I can't take info from other project. Take a look at this.

        double freq = StatusWindow::AngularVelocities.gimbalNS1Vel;

        C:\Users\Zhihao\Documents\SourceTree Repos\qtlearning\NISimpleTest - Zhihao Version\stepperwindow.cpp:122: error: expected primary-expression before '.' token
        double freq = StatusWindow::AngularVelocities.gimbalNS1Vel;

        I am not that experience either. Would be real nice if you can help me out.

        Greetings,

        Zhihao

        M 1 Reply Last reply 1 Oct 2015, 08:21
        0
        • Z zhihaowu
          1 Oct 2015, 08:18

          Hi GrahamL,

          I just succeeded adding 2 project together. but I can't take info from other project. Take a look at this.

          double freq = StatusWindow::AngularVelocities.gimbalNS1Vel;

          C:\Users\Zhihao\Documents\SourceTree Repos\qtlearning\NISimpleTest - Zhihao Version\stepperwindow.cpp:122: error: expected primary-expression before '.' token
          double freq = StatusWindow::AngularVelocities.gimbalNS1Vel;

          I am not that experience either. Would be real nice if you can help me out.

          Greetings,

          Zhihao

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 1 Oct 2015, 08:21 last edited by
          #4

          @zhihaowu

          In stepperwindow.cpp , did you include the .H file where StatusWindow lives ?

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zhihaowu
            wrote on 1 Oct 2015, 08:23 last edited by
            #5

            @mrjj Yes, I did. When I start typing Qt shows me the available namespace and instants.

            M 2 Replies Last reply 1 Oct 2015, 08:25
            0
            • Z zhihaowu
              1 Oct 2015, 08:23

              @mrjj Yes, I did. When I start typing Qt shows me the available namespace and instants.

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 1 Oct 2015, 08:25 last edited by
              #6

              @zhihaowu said:

              Ok?!
              if you place cursor on AngularVelocities and press F2, it can go to the definition ?

              1 Reply Last reply
              1
              • Z zhihaowu
                1 Oct 2015, 08:23

                @mrjj Yes, I did. When I start typing Qt shows me the available namespace and instants.

                M Offline
                M Offline
                mrjj
                Lifetime Qt Champion
                wrote on 1 Oct 2015, 08:31 last edited by
                #7

                Depending on where the files are located, you might need to add paths to the .PRO file

                like
                INCLUDEPATH += ../../Common/CONET
                ../../Common/Exception
                ../../Common/FileStream
                ../../Common/HAL

                HEADERS += AppStyle.h
                ../../Common/Types/AbstractTypes.h
                ../../Common/Types/PedaxTypes.h
                ../../Common/Types/Variant.h
                ../../Common/XML/pugixml-1.5/src/pugiconfig.hpp
                ../../Common/XML/pugixml-1.5/src/pugixml.hpp

                1 Reply Last reply
                1
                • Z Offline
                  Z Offline
                  zhihaowu
                  wrote on 1 Oct 2015, 08:37 last edited by
                  #8

                  This is a part of the header file:

                  class StatusWindow : public QMainWindow {
                  Q_OBJECT

                  public:
                  explicit StatusWindow(QWidget *parent = 0);
                  ~StatusWindow();
                  SolTrack soltrack;
                  SolTrack::Position oldPosition;

                  typedef struct {
                    double hhRefVel, decRefVel;
                    double azVel, altRefVel;
                    double gimbalNS1Vel,gimbalNS2Vel, gimbalEW1Vel,gimbalEW2Vel;
                  } AngularVelocities;
                  

                  AngularVelocities angVels;

                  private:
                  Ui::StatusWindow *ui;

                  void updateStatusScreen();
                  void computeAngularVelocities(SolTrack::Position sunPos, SolTrack::Position oldPos, AngularVelocities* angVels);

                  private slots:
                  void updateStatusScreenCurrent();
                  void on_actionAbout_Qt_triggered();
                  void on_actionAbout_SolTraQ_triggered();
                  void on_actionClose_triggered();
                  void on_actionHelp_triggered();
                  };

                  I need to get the data from the gimbals

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 1 Oct 2015, 09:40 last edited by
                    #9

                    ahh I see
                    when you say
                    double freq = StatusWindow::AngularVelocities.gimbalNS1Vel;
                    you try to access AngularVelocities as it was a static struct.
                    But its not - so you need an instance of StatusWindow for it to work.

                    like

                    StatusWindow *MyInst = new StatusWindow ();
                    double freq =MyInst->AngularVelocities.gimbalNS1Vel;
                    delete MyInst ;
                    

                    So if StatusWindow was the mainwindow in the other project, then you
                    might not have an instance in the "this" project and you would need to create one.

                    Have you considered to move the data to its own file so its easier to use both places ?

                    Z 2 Replies Last reply 1 Oct 2015, 10:11
                    0
                    • M mrjj
                      1 Oct 2015, 09:40

                      ahh I see
                      when you say
                      double freq = StatusWindow::AngularVelocities.gimbalNS1Vel;
                      you try to access AngularVelocities as it was a static struct.
                      But its not - so you need an instance of StatusWindow for it to work.

                      like

                      StatusWindow *MyInst = new StatusWindow ();
                      double freq =MyInst->AngularVelocities.gimbalNS1Vel;
                      delete MyInst ;
                      

                      So if StatusWindow was the mainwindow in the other project, then you
                      might not have an instance in the "this" project and you would need to create one.

                      Have you considered to move the data to its own file so its easier to use both places ?

                      Z Offline
                      Z Offline
                      zhihaowu
                      wrote on 1 Oct 2015, 10:11 last edited by
                      #10

                      @mrjj That is a good, but I had the idea of just taking it from another directory. So whenever i update the other files, I will not have to copy and paste it over here again.

                      M 1 Reply Last reply 1 Oct 2015, 10:14
                      0
                      • Z zhihaowu
                        1 Oct 2015, 10:11

                        @mrjj That is a good, but I had the idea of just taking it from another directory. So whenever i update the other files, I will not have to copy and paste it over here again.

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 1 Oct 2015, 10:14 last edited by
                        #11

                        @zhihaowu
                        Well if you need both projects still working then
                        moving the data our from mainwindow to its own file would make it far easier.
                        Copy/pasting code often comes back and bite. :)

                        1 Reply Last reply
                        1
                        • M mrjj
                          1 Oct 2015, 09:40

                          ahh I see
                          when you say
                          double freq = StatusWindow::AngularVelocities.gimbalNS1Vel;
                          you try to access AngularVelocities as it was a static struct.
                          But its not - so you need an instance of StatusWindow for it to work.

                          like

                          StatusWindow *MyInst = new StatusWindow ();
                          double freq =MyInst->AngularVelocities.gimbalNS1Vel;
                          delete MyInst ;
                          

                          So if StatusWindow was the mainwindow in the other project, then you
                          might not have an instance in the "this" project and you would need to create one.

                          Have you considered to move the data to its own file so its easier to use both places ?

                          Z Offline
                          Z Offline
                          zhihaowu
                          wrote on 1 Oct 2015, 10:54 last edited by
                          #12

                          @mrjj

                          C:\Users\Zhihao\Documents\SourceTree Repos\qtlearning\NISimpleTest - Zhihao Version\stepperwindow.cpp:126: error: invalid use of 'StatusWindow::AngularVelocities'
                          double freq = MyInst->AngularVelocities.gimbalNS1Vel;
                          ^

                          M 1 Reply Last reply 1 Oct 2015, 11:09
                          0
                          • Z zhihaowu
                            1 Oct 2015, 10:54

                            @mrjj

                            C:\Users\Zhihao\Documents\SourceTree Repos\qtlearning\NISimpleTest - Zhihao Version\stepperwindow.cpp:126: error: invalid use of 'StatusWindow::AngularVelocities'
                            double freq = MyInst->AngularVelocities.gimbalNS1Vel;
                            ^

                            M Offline
                            M Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on 1 Oct 2015, 11:09 last edited by mrjj 10 Jan 2015, 11:10
                            #13

                            @zhihaowu said:

                            Hi that's the type definition.
                            sorry my bad
                            it should be angVels;

                            double freq = MyInst->angVels.gimbalNS1Vel;

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on 1 Oct 2015, 11:16 last edited by
                              #14

                              one note:

                              I suspect you need to call
                              void computeAngularVelocities(SolTrack::Position sunPos, SolTrack::Position oldPos, AngularVelocities* angVels);

                              for angVels to have anything but zero.

                              Z 1 Reply Last reply 1 Oct 2015, 11:17
                              1
                              • M mrjj
                                1 Oct 2015, 11:16

                                one note:

                                I suspect you need to call
                                void computeAngularVelocities(SolTrack::Position sunPos, SolTrack::Position oldPos, AngularVelocities* angVels);

                                for angVels to have anything but zero.

                                Z Offline
                                Z Offline
                                zhihaowu
                                wrote on 1 Oct 2015, 11:17 last edited by
                                #15

                                @mrjj It is working!!! Super thanks mate.

                                M 1 Reply Last reply 1 Oct 2015, 11:19
                                0
                                • Z zhihaowu
                                  1 Oct 2015, 11:17

                                  @mrjj It is working!!! Super thanks mate.

                                  M Offline
                                  M Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on 1 Oct 2015, 11:19 last edited by
                                  #16

                                  @zhihaowu

                                  \o/
                                  Super

                                  1 Reply Last reply
                                  1
                                  • K Offline
                                    K Offline
                                    KaranBehar
                                    wrote on 29 Aug 2016, 10:18 last edited by
                                    #17

                                    I am trying to add new features to a GUI. The files for new features such as camera output, video output etc exists on a different location.

                                    What would be the best way to do agile Qt development.

                                    With best regards,

                                    Karan

                                    M 1 Reply Last reply 29 Aug 2016, 10:24
                                    0
                                    • K KaranBehar
                                      29 Aug 2016, 10:18

                                      I am trying to add new features to a GUI. The files for new features such as camera output, video output etc exists on a different location.

                                      What would be the best way to do agile Qt development.

                                      With best regards,

                                      Karan

                                      M Offline
                                      M Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on 29 Aug 2016, 10:24 last edited by
                                      #18

                                      @KaranBehar
                                      Well agile is not different with Qt.
                                      Just make sure project is under code revision control and go ahead :)

                                      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