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. My program doesn't show up in my enterprise device while in pc does
QtWS25 Last Chance

My program doesn't show up in my enterprise device while in pc does

Scheduled Pinned Locked Moved Solved General and Desktop
qwizardpagedevicesqt 4.8.5
23 Posts 3 Posters 7.4k Views
  • 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.
  • R Offline
    R Offline
    roseicollis
    wrote on 2 Feb 2016, 15:37 last edited by roseicollis 2 Feb 2016, 15:54
    #1

    Hello!!

    I've made a couple of projects in Qt4.8.5 which have to run on a especific device (the product of our company) which runs under a unix OS and they run as expected. You launch them, they show up and you use them. Until here is everything normal and happy:D

    Now I've made another program, which is like one of the before mentioned but bigger. The thing is that now that I've finished it, I've tried to run it on the HW and something strange happened:

    The screen gets black (the tipical black "with light" that means that the screen is on). I've launched it manually so I can see the console messages on console and I see all the qDebug() it has to print at the beginning and also, I have a qDebug() << "1st page"; on the ::initializePage() funcion of the first page shown (is a QWizardPage) also which is printed, so everything looks normal but... I can't see it on the screnn... just a black screen (My apps' background is orange so it is now the background of the app).

    Any idea of why I can't see it? The HW has all the libraries necessaries for it because as I said, I run there 2 other Qt apps.

    I add my .pro info...don't think it is usefull now but... any information is apreciated I guess..

    QT       += core gui
    QT       += network
    QT       += script
    QT       += date
    QT       += time
    QT       += xml
    QMAKE_CXXFLAGS += -std=c++11
    QMAKE_CXXFLAGS  += -s
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    TARGET = MyApp
    TEMPLATE = app
    

    Note 1: In the 1st page I have 2 buttons, so if you press enter, you go to the next QWizardPage called 2nd page so... when I see the "1st page" message on console, if I press enter on the device, of course, it then shows the "2nd page" message from the qDebug in the ::initializePage() which means that the program runs well, it is not frozen.

    Note 2: Another thing I want to point is that: it CAN'T be in the background running, the device make it appear in front always.

    Thank you so much.

    1 Reply Last reply
    0
    • R Offline
      R Offline
      roseicollis
      wrote on 5 Feb 2016, 14:27 last edited by
      #2

      So... after 2 days looking and trying different things with the different versions I had in the SVN I've found the stupid-silly-cause of my problem...

      It was a page, more exactly in its constructor where I create a connect between a combobox curretnIndexChanged signal and a fucntion I created as a slot. After that connect I load some items into the cb and switching those lines fixed my problem.... I don't really understand why because the combobox was well created and I thought is was not necessary to load some items into it to be able to do a connect with it but... seems I was wrong

      K 1 Reply Last reply 5 Feb 2016, 15:40
      0
      • R roseicollis
        5 Feb 2016, 14:27

        So... after 2 days looking and trying different things with the different versions I had in the SVN I've found the stupid-silly-cause of my problem...

        It was a page, more exactly in its constructor where I create a connect between a combobox curretnIndexChanged signal and a fucntion I created as a slot. After that connect I load some items into the cb and switching those lines fixed my problem.... I don't really understand why because the combobox was well created and I thought is was not necessary to load some items into it to be able to do a connect with it but... seems I was wrong

        K Offline
        K Offline
        kshegunov
        Moderators
        wrote on 5 Feb 2016, 15:40 last edited by
        #3

        @roseicollis
        Hello,
        I'm glad you were able to solve your problem, however you're also correct in noting that it shouldn't in principle matter where you make your QObject::connect calls. Maybe if you provide a code-snippet we could investigate that?

        Kind regards.

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • R Offline
          R Offline
          roseicollis
          wrote on 9 Feb 2016, 14:46 last edited by
          #4

          Hi @kshegunov srry for my late reply.

          What I do in that QWizardPage called WP25 is:
          In its constructor:

           .... 
           LoadXMLInfo();
           connect(my_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSomeLabels(int)));
          ---
          

          In the loadXMLInfo function, the only thing that has something in common with the combobox is:

           while(!Child.isNull())
              {
                  my_combobox->addItem(Child.attribute("Info1",Child.toText().data()), Child.attribute("Info2",Child.toText().data()));
                  Child = Child.nextSibling().toElement();
              }
          

          And in the SetSomeLabels function:

          void WP25::SetSomeLabels(int i)
          {
              if (i==(my_combobox->count()-1))
              {
                  m_bOtherTipus=true;
                  l_Onelabel->setVisible(true);
                  le_OneLineEdit>setVisible(true);
              }else{
                  m_bOtherTipus=false;
                  l_OneLabel->setVisible(false);
                  le_OneLineEdit->setVisible(false);
              }
          }
          

          I think that is everything important here

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kshegunov
            Moderators
            wrote on 9 Feb 2016, 16:07 last edited by
            #5

            @roseicollis
            Hello,
            I can't spot anything plainly wrong with that part of the code. Do you get any Qt warnings when running your application on the problematic device?

            Kind regards.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 10 Feb 2016, 08:46 last edited by
              #6

              Hi,

              Does LoadXMLInfo work on a local file ?

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

              1 Reply Last reply
              0
              • R Offline
                R Offline
                roseicollis
                wrote on 10 Feb 2016, 12:56 last edited by
                #7

                Hi @SGaist ! Yes, but the XML is ok and well loaded I imagine because the program reads it and load it into the combobox

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 10 Feb 2016, 13:00 last edited by
                  #8

                  What I meant is that if you are using a local file from your hard drive then it's normal that it won't load when running on a different device. If you don't change that file often, then use Qt's resource system to embedded the file in your application.

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

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    roseicollis
                    wrote on 10 Feb 2016, 15:20 last edited by
                    #9

                    @SGaist oh sorry, I know what you mean, that's why I say it loads correctly in both sites... The XML is in both and yes, it will be changed every now and then so it has to be this way but... as I said, it is well loaded.... so I discard that as a problem :S

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on 10 Feb 2016, 20:52 last edited by
                      #10

                      Ok, I misunderstood your original problem.

                      In such a strange case (meaning when nothing is obvious), one thing to do is to "disable everything". By that I mean start with only your main function showing a QWidget in place of your custom widget. I know it sounds basic but it confirms that Qt's working. The next step is to re-enable one by one your custom widgets until things break again.

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

                      1 Reply Last reply
                      0
                      • R Offline
                        R Offline
                        roseicollis
                        wrote on 11 Feb 2016, 11:04 last edited by
                        #11

                        Np :) Well its something similar to what I did... I commented everything until it stopped working so found the problem in that constructor.... comented everything ans was descomenting until found that and that's all.. If I switch lines, it crashes O.o

                        1 Reply Last reply
                        0
                        • S Offline
                          S Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on 11 Feb 2016, 17:06 last edited by
                          #12

                          What did you have to switch ?

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

                          K 1 Reply Last reply 11 Feb 2016, 17:08
                          0
                          • S SGaist
                            11 Feb 2016, 17:06

                            What did you have to switch ?

                            K Offline
                            K Offline
                            kshegunov
                            Moderators
                            wrote on 11 Feb 2016, 17:08 last edited by
                            #13

                            @SGaist
                            Hello, look up posts #2 and #4. He had switched:

                             connect(my_combobox, SIGNAL(currentIndexChanged(int)), this, SLOT(SetSomeLabels(int)));
                             LoadXMLInfo();
                            

                            to make it work, although I see no logical reason not to work in the original order.

                            Read and abide by the Qt Code of Conduct

                            1 Reply Last reply
                            0
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 11 Feb 2016, 20:34 last edited by
                              #14

                              I also don't see any reason either.

                              However, one thing I usually do is to setup widgets and connection and then trigger data/settings loading once everything is done or even right after the event loop as started using e.g. a QTimer with a 0 timeout.

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

                              K 1 Reply Last reply 11 Feb 2016, 20:36
                              0
                              • S SGaist
                                11 Feb 2016, 20:34

                                I also don't see any reason either.

                                However, one thing I usually do is to setup widgets and connection and then trigger data/settings loading once everything is done or even right after the event loop as started using e.g. a QTimer with a 0 timeout.

                                K Offline
                                K Offline
                                kshegunov
                                Moderators
                                wrote on 11 Feb 2016, 20:36 last edited by kshegunov 2 Nov 2016, 20:37
                                #15

                                @SGaist
                                To be honest I've never found any use for single shot timers with 0 timeout. Although, this depends on a personal preference I have always used QMetaObject::invokeMethod with Qt::QueuedConnection for such purposes. :)

                                Read and abide by the Qt Code of Conduct

                                1 Reply Last reply
                                0
                                • S Offline
                                  S Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on 11 Feb 2016, 20:50 last edited by
                                  #16

                                  QTimer is higher level and a bit clearer for people not going in the lower levels of Qt. But in the end, yes both have the same effects.

                                  Also, invokeMethod doesn't have any overload for lambdas

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

                                  K 1 Reply Last reply 11 Feb 2016, 20:51
                                  0
                                  • S SGaist
                                    11 Feb 2016, 20:50

                                    QTimer is higher level and a bit clearer for people not going in the lower levels of Qt. But in the end, yes both have the same effects.

                                    Also, invokeMethod doesn't have any overload for lambdas

                                    K Offline
                                    K Offline
                                    kshegunov
                                    Moderators
                                    wrote on 11 Feb 2016, 20:51 last edited by kshegunov 2 Nov 2016, 20:52
                                    #17

                                    @SGaist

                                    Also, invokeMethod doesn't have any overload for lambdas

                                    True, however you can pass arguments with it. And lambdas I can't remember needing really. ;)

                                    Read and abide by the Qt Code of Conduct

                                    1 Reply Last reply
                                    0
                                    • S Offline
                                      S Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on 11 Feb 2016, 20:54 last edited by
                                      #18

                                      Yup, good point.

                                      For lambdas ? Two main things comes to mind for Qt: real private slots and processing of QNetworkReply :)

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

                                      K 1 Reply Last reply 11 Feb 2016, 20:57
                                      0
                                      • S SGaist
                                        11 Feb 2016, 20:54

                                        Yup, good point.

                                        For lambdas ? Two main things comes to mind for Qt: real private slots and processing of QNetworkReply :)

                                        K Offline
                                        K Offline
                                        kshegunov
                                        Moderators
                                        wrote on 11 Feb 2016, 20:57 last edited by kshegunov 2 Nov 2016, 20:58
                                        #19

                                        @SGaist

                                        For lambdas ? Two main things comes to mind for Qt: real private slots and processing of QNetworkReply :)

                                        Q_PRIVATE_SLOT works wonders for me, although I could appreciate one wanting to use lambdas for it. QNetworkReply I've never used, only raw TCP/UDP connections ... I guess, I'm pretty old school ... :)

                                        Read and abide by the Qt Code of Conduct

                                        1 Reply Last reply
                                        0
                                        • S Offline
                                          S Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on 11 Feb 2016, 21:18 last edited by
                                          #20

                                          @kshegunov said:

                                          Q_PRIVATE_SLOT

                                          AFAIK, works only if you also use the PIMPL idiom, which is not the most common case.

                                          QNetworkAccessManager is a good tool when you want to write a layer to access a REST service. You use what best fits your needs :)

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

                                          1 Reply Last reply
                                          1

                                          5/23

                                          9 Feb 2016, 16:07

                                          18 unread
                                          • Login

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