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

A few design questions...

Scheduled Pinned Locked Moved General and Desktop
127 Posts 7 Posters 107.0k 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.
  • mzimmersM Offline
    mzimmersM Offline
    mzimmers
    wrote on last edited by
    #99

    OK, here's the .pro file:

    @######################################################################

    Automatically generated by qmake (2.01a) Mon Mar 28 17:09:16 2011

    ######################################################################

    TEMPLATE = app
    TARGET =
    DEPENDPATH += . headers src
    INCLUDEPATH += . headers

    APP_QML_FILES.files = DemodShaperFilter.qml
    APP_QML_FILES.path = Contents/MacOS
    QMAKE_BUNDLE_DATA += APP_QML_FILES

    QT += core gui declarative

    Input

    HEADERS +=
    headers/clock.h
    headers/DemodShaperFilter.h
    headers/globals.h
    headers/register_offsets.h
    headers/Soc.h
    headers/SocReg.h
    headers/widget.h
    headers/GenericCell.h
    headers/DemodCicTuner.h
    headers/SystolicFilter.h
    headers/modpredist.h
    headers/Nco.h
    headers/nyquist.h
    headers/nyquistcell.h
    headers/modshaperfilter.h
    headers/modciccomb.h
    headers/modciccombstage.h
    headers/socreg64.h
    SOURCES +=
    src/clock.cpp
    src/DemodShaperFilter.cpp
    src/filestuff.cpp
    src/globals.cpp
    src/main.cpp
    src/Soc.cpp
    src/SocReg.cpp
    src/widget.cpp
    src/GenericCell.cpp
    src/DemodCicTuner.cpp
    src/SystolicFilter.cpp
    src/modpredist.cpp
    src/nco.cpp
    src/nyquist.cpp
    src/nyquistcell.cpp
    src/modshaperfilter.cpp
    src/modciccomb.cpp
    src/modciccombstage.cpp
    src/socreg64.cpp

    FORMS +=
    widget.ui

    OTHER_FILES +=
    DemodShaperFilter.qml

    RESOURCES +=
    simple.qrc
    @

    Those commands you posted are from the shell, right? I got this error on the make command:

    bq. make: *** No rule to make target `distclean'. Stop.

    1 Reply Last reply
    0
    • Z Offline
      Z Offline
      ZapB
      wrote on last edited by
      #100

      OK just try

      @
      make clean
      qmake -r
      make
      @

      You can do it from within qt-creator via the project context menu "Clean project", "Run qmake", and "Build project" I htink are the entries.

      Nokia Certified Qt Specialist
      Interested in hearing about Qt related work

      1 Reply Last reply
      0
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #101

        OK, I did it from Creator. "Run qmake" returned this:

        @Running build steps for project simulatorGUI...
        Starting: "/usr/bin/qmake" /Users/mzimmers/wideband/SoC simulator/simulatorGUI/simulatorGUI.pro -r -spec macx-g++ QMLJSDEBUGGER_PATH=/Developer/Applications/Qt/Qt Creator.app/Contents/Resources/qml/qmljsdebugger
        The process "/usr/bin/qmake" exited normally.@

        And the build returned a whole bunch of stuff that I won't bother putting here (unless you really want it), but it did build successfully this time. And I checked the build directory, and I now have files for the filter there.

        Now, in the UI, the value displays as "undefined." And, I'm getting a couple run-time errors about "no such signal." One is on this line (in soc.cpp):

        @ connect (this, SIGNAL(shaperOutIChanged()), this, SIGNAL(shaperOutIStringChanged()));
        @

        And the other is (in widget.cpp):
        @ connect (soc, SIGNAL(shaperOutIChanged()), this, SLOT(updateShaperOutI()));
        @

        1 Reply Last reply
        0
        • Z Offline
          Z Offline
          ZapB
          wrote on last edited by
          #102

          OK. For some reason then the build system had not noticed that qmake needed to be re-run. But at least it is fixed now.

          For the signals...

          The first connect statement should now be moved into the DemodShaperFilter class since that is where we have all of the Qt property stuff now.

          The second statement should be changed to something like this:

          @
          connect (soc->demodShaperFilter(), SIGNAL(shaperOutIChanged()), this, SLOT(updateShaperOutI()));
          @

          where you need to add:

          @
          DemodShaperFilter* demodShaperFilter() const { return m_demodShaperFilter; }
          @

          to your Soc class. Note that I have used "m_demodShaperFilter" but I have not seen your Soc.h header file so you'll have to replace that with whatever you called your pointer to the DemodShaperFilter object.

          That should remove those runtime warnings.

          Incidentally, I find it useful to run with the environment variable QT_FATAL_WARNINGS=1 set. With that in place any runtiem warnings form Qt will cause your app to abort at that point which the debugger will catch so that you can inspect the stack trace. You can set the above in the Qt-Creator project settings under the RunTime Configuration tab.

          Nokia Certified Qt Specialist
          Interested in hearing about Qt related work

          1 Reply Last reply
          0
          • mzimmersM Offline
            mzimmersM Offline
            mzimmers
            wrote on last edited by
            #103

            OK. I'd already copied the first connect into the DSF, but hadn't removed it from the Soc. Now done.

            About the second one: something doesn't look right with that function definition. Either the type or the return value needs to be changed to agree with the other...

            EDIT: also, the "const" was causing the compiler to beef, so I removed it.

            And, at runtime, I now get this error:

            @qrc:/DemodShaperFilter.qml:15:2: QML Connections: Cannot assign to non-existent property "onShaperOutIChanged"@

            I didn't change my qml file; here it is:

            @import QtQuick 1.0

            Rectangle {
            id: myRect
            width: 300
            height: 100
            color: "#808080"

            Text {
            text: "shaperOutI = " + soc.shaperOutIString;
            font.pointSize: 20
            anchors.centerIn: parent
            }

            Connections {
            target: soc
            onShaperOutIChanged: {
            if (myRect.color == "#808080")
            myRect.color = "#c0c0c0"
            else
            myRect.color = "#808080"
            }
            }
            }

            @

            Do I change the target from soc to something else (like the DSF)?

            1 Reply Last reply
            0
            • mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #104

              I cleaned up some stuff, but I'm still getting this error message:

              bq. qrc:/DemodShaperFilter.qml:15:2: QML Connections: Cannot assign to non-existent property "onShaperOutIChanged"

              Any suggestions?

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                ZapB
                wrote on last edited by
                #105

                Can you post he header file of your DemonShaperFilter class, the place where you expose that object to the qml context and the QML file please?

                Nokia Certified Qt Specialist
                Interested in hearing about Qt related work

                1 Reply Last reply
                0
                • mzimmersM Offline
                  mzimmersM Offline
                  mzimmers
                  wrote on last edited by
                  #106

                  Hi, Zap -

                  Apart from some include files, and constant definitions, what I posted above is my complete header file for that class. I thought I copied everything necessary over from the original Soc class; did I miss something?

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    ZapB
                    wrote on last edited by
                    #107

                    What about the part where you expose the object to the QML context? Also can you show how you get the pointer to the DemodShaperFilter object from the Soc object please? You mentioned something about not being able to use const or a pointer or something there?

                    Nokia Certified Qt Specialist
                    Interested in hearing about Qt related work

                    1 Reply Last reply
                    0
                    • mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #108

                      The Soc class has a public function to return the address of the DSF object:

                      @ DemodShaperFilter* demodShaperFilter() { return &filter; }
                      @

                      I'm not sure I remember "exposing" the DSF to QML. In my .qml file, there's a Connections block:

                      @ Connections {
                      target: soc
                      onShaperOutIChanged: {
                      if (myRect.color == "#808080")
                      myRect.color = "#c0c0c0"
                      else
                      myRect.color = "#808080"
                      }
                      }
                      @

                      But I didn't see any code in my Soc class that tied the object to QML.

                      1 Reply Last reply
                      0
                      • Z Offline
                        Z Offline
                        ZapB
                        wrote on last edited by
                        #109

                        Somewhere we had something like:

                        @
                        view->rootContext->setContextProperty( m_soc, "soc" );
                        @

                        which should now become something like:

                        @
                        view->rootContext->setContextProperty( m_soc->demodSHaperFilter, "dsf" );
                        @

                        then in your QML scene replace all references of "soc" to "dsf".

                        Nokia Certified Qt Specialist
                        Interested in hearing about Qt related work

                        1 Reply Last reply
                        0
                        • mzimmersM Offline
                          mzimmersM Offline
                          mzimmers
                          wrote on last edited by
                          #110

                          Oh! That's in the widget constructor:
                          @Widget::Widget(QWidget *parent) :
                          QWidget(parent),
                          ui(new Ui::Widget),
                          m_timer(new QTimer(this)),
                          soc(new Soc(this))
                          {
                          ui->setupUi(this);

                          connect (m_timer, SIGNAL(timeout()), soc, SLOT(runOneCycle()));

                          connect (soc->demodShaperFilter(), SIGNAL(shaperOutIChanged()), this, SLOT(updateShaperOutI()));

                          QDeclarativeView* view = ui->declarativeView;

                          view->rootContext()->setContextProperty("soc", soc);
                          view->setSource(QUrl("qrc:/DemodShaperFilter.qml"));

                          m_timer->start(200); // 200 ms delay between cycles (for now)
                          }
                          @

                          And, by "QML scene," you're referring to the .qml file?

                          1 Reply Last reply
                          0
                          • Z Offline
                            Z Offline
                            ZapB
                            wrote on last edited by
                            #111

                            Yes that is what I meant. You need to make the changes that I mentioned to that line ie:

                            @
                            view->rootContext()->setContextProperty( "dsf", soc->demodShaperFilter() );
                            @

                            and in your QML file replace all mentions of "soc" with "dsf". It should work then.

                            Nokia Certified Qt Specialist
                            Interested in hearing about Qt related work

                            1 Reply Last reply
                            0
                            • mzimmersM Offline
                              mzimmersM Offline
                              mzimmers
                              wrote on last edited by
                              #112

                              OK, we're getting somewhere. I no longer get the error message at startup, and the QML window now comes up with the correct initial value of the variable. But...it's not updating. I have this line in my cycle loop for the object:

                              @ emit shaperOutIChanged();
                              @

                              Which I believe should correspond with this line in my DSF constructor:

                              @ connect (this, SIGNAL(shaperOutIChanged()), this, SIGNAL(shaperOutIStringChanged()));
                              @

                              So, I'm not sure what's missing.

                              Also, I'm confused about something: why is it we're still using some Soc functions for our QML processing?
                              @ ui->setupUi(this);

                              connect (m_timer, SIGNAL(timeout()), soc, SLOT(runOneCycle()));

                              connect (soc->demodShaperFilter(), SIGNAL(shaperOutIChanged()), this, SLOT(updateShaperOutI()));

                              QDeclarativeView* view = ui->declarativeView;

                              view->rootContext()->setContextProperty("dsf", soc->demodShaperFilter());
                              view->setSource(QUrl("qrc:/DemodShaperFilter.qml"));

                              m_timer->start(200); // 200 ms delay between cycles (for now)
                              @

                              Thanks.

                              1 Reply Last reply
                              0
                              • Z Offline
                                Z Offline
                                ZapB
                                wrote on last edited by
                                #113

                                Where do you emit the shaperOutIChanged() signal? Can you post that snippet of code please? Have you run it in a debugger to make sure that emit is actually called? Do you get any runtime warnings on the console output?

                                Can you also post the qml file where you use this property please - although it sounds as if the QML is correct since you get an intiial value. Just sounds like the signal is not being emitted correctly which would trigger the QML engine to update the displayed value.

                                The only reason we are referring to the soc object is that it is the only way we can get at the pointer to the DemodShaperFilter object. Are you using it anywhere else in relation to displaying stuff in the GUI?

                                Nokia Certified Qt Specialist
                                Interested in hearing about Qt related work

                                1 Reply Last reply
                                0
                                • mzimmersM Offline
                                  mzimmersM Offline
                                  mzimmers
                                  wrote on last edited by
                                  #114

                                  The shaperOutIChanged() signal is (currently) in the test loop for the DSF class. It loops 1024 times, processes the object and then executes this line (within the loop):

                                  @ emit shaperOutIChanged();
                                  @

                                  This routine is the one automatically generated within Qt, right?

                                  Contents of the .qml file:

                                  @import QtQuick 1.0

                                  Rectangle {
                                  id: myRect
                                  width: 300
                                  height: 100
                                  color: "#808080"

                                  Text {
                                  text: "shaperOutI = " + dsf.shaperOutIString;
                                  font.pointSize: 20
                                  anchors.centerIn: parent
                                  }

                                  Connections {
                                  target: dsf
                                  onShaperOutIChanged: {
                                  if (myRect.color == "#808080")
                                  myRect.color = "#c0c0c0"
                                  else
                                  myRect.color = "#808080"
                                  }
                                  }
                                  }

                                  @

                                  The string is the conversion of the display value. As a reminder, we did this for formatting convenience. I copied all of that code directly from the Soc class to the DSF.

                                  And no, I don't believe the DSF object is being used anywhere else for display purposes. The Soc invokes the DSF test loop, and that's about it.

                                  Thanks...

                                  1 Reply Last reply
                                  0
                                  • mzimmersM Offline
                                    mzimmersM Offline
                                    mzimmers
                                    wrote on last edited by
                                    #115

                                    Hi, Zap -

                                    I did some more debugging. The internal logic is definitely working; that is, the loop is clearly executing and the emit statement appears to be called 1024 times. Where would you suggest I look next for the disconnect here?

                                    Thanks.

                                    1 Reply Last reply
                                    0
                                    • Z Offline
                                      Z Offline
                                      ZapB
                                      wrote on last edited by
                                      #116

                                      Sorry for the delay, I must have missed the notification email. I'm not sure without seeing the source code. Are you able to zip it up and mail it to me so that I can take a look (I can sign an NDA if needed). Alternatively boil it right down to a very simple example that still shows the problem and send me that zip file.

                                      Nokia Certified Qt Specialist
                                      Interested in hearing about Qt related work

                                      1 Reply Last reply
                                      0
                                      • mzimmersM Offline
                                        mzimmersM Offline
                                        mzimmers
                                        wrote on last edited by
                                        #117

                                        I can zip up the relevant files and send them to you, if I had a real email address for you. You can provide it via a message if you like.

                                        Thanks.

                                        1 Reply Last reply
                                        0
                                        • Z Offline
                                          Z Offline
                                          ZapB
                                          wrote on last edited by
                                          #118

                                          Sent you my email address via private message.

                                          Nokia Certified Qt Specialist
                                          Interested in hearing about Qt related work

                                          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