Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Has anyone ever got a widget running on a rpi3 with LCD-Display (HDMI and SPI-Interface)

Has anyone ever got a widget running on a rpi3 with LCD-Display (HDMI and SPI-Interface)

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
21 Posts 3 Posters 2.6k 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.
  • K Offline
    K Offline
    K-Str
    wrote on 4 Nov 2019, 11:02 last edited by K-Str 11 Apr 2019, 11:03
    #1

    Hi,
    I'm quiet frustrated. Since a long time I try to install QT on an UBUNTU 18.04.3 Host cross compile for a raspberry3.
    There are a lot of tipps and tutorials how to install the qt creator for cross compile and remote debugging for a raspberry but now works really for me.
    I use a raspberry 3 where a LCD-display is connected via HDMI and SPI (for a touch pen). It runs a raspbian buster and the driver for the display.
    The installation is qt 5.12.5 based on 5.13.1 and qt-creator 4.10.0.
    The installation was fine and there where now errors during the installation.
    But when I create a simple widget with some buttons (e.g. one push button and one radio butto) it handles only one button.
    I get some errors when I run this widget

    
    Unable to query physical screen size, defaulting to 100 dpi.
    To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
    Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
    

    but I cannot find any solution for them.
    This is the code for the widget:
    mainwindow.cpp:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QDebug>
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    
    void MainWindow::on_pushButton_clicked()
    {
        qDebug() << "Hallo Pushy!";
    }
    
    void MainWindow::on_radioButton_clicked()
    {
        qDebug() << "Hallo Radio!";
    }
    

    and mainwindow.h

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    
    #include <QMainWindow>
    
    QT_BEGIN_NAMESPACE
    namespace Ui { class MainWindow; }
    QT_END_NAMESPACE
    
    class MainWindow : public QMainWindow
    {
        Q_OBJECT
    
    public:
        MainWindow(QWidget *parent = nullptr);
        ~MainWindow();
    
    private slots:
        void on_pushButton_clicked();
    
        void on_radioButton_clicked();
    
    private:
        Ui::MainWindow *ui;
    };
    #endif // MAINWINDOW_H
    

    I'm sorry! sometimes I have the feeling sucessfull installing qt for creating widget for a raspberry never works and it's just a story like urban legends. Or does somebody really know a working tutorial or something?
    It would be nice if I get an answer

    thanks in advance!

    J 1 Reply Last reply 4 Nov 2019, 13:17
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 4 Nov 2019, 11:16 last edited by mrjj 11 Apr 2019, 11:18
      #2

      Hi

      I understand your frustration. Cross compiling is often time consuming and hard to get working right.

      I think you can just export the values
      (in some .sh file to start app or in your profile so its always run)

      export QT_QPA_EGLFS_PHYSICAL_WIDTH=520
      export QT_QPA_EGLFS_PHYSICAL_HEIGHT=326

      https://stackoverflow.com/questions/18518280/raspberry-pi-qt5-set-physical-screen-size

      I liked this tutorial
      https://mechatronicsblog.com/cross-compile-and-deploy-qt-5-12-for-raspberry-pi/

      1 Reply Last reply
      2
      • K Offline
        K Offline
        K-Str
        wrote on 4 Nov 2019, 12:49 last edited by
        #3

        @mrjj Thanks for your answer,
        I'm sorry, it does not solve my problem.
        When I make there is sitll only one button active, the second has ignored and I get this Error:

        Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
        
        J 1 Reply Last reply 4 Nov 2019, 12:51
        0
        • K K-Str
          4 Nov 2019, 12:49

          @mrjj Thanks for your answer,
          I'm sorry, it does not solve my problem.
          When I make there is sitll only one button active, the second has ignored and I get this Error:

          Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
          
          J Online
          J Online
          jsulm
          Lifetime Qt Champion
          wrote on 4 Nov 2019, 12:51 last edited by
          #4

          @K-Str Can you show your main.cpp file?

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

          1 Reply Last reply
          0
          • K Offline
            K Offline
            K-Str
            wrote on 4 Nov 2019, 13:06 last edited by
            #5

            @jsulm
            Hello thanks for your answer,
            Here you will find the main.cpp code:

            #include "mainwindow.h"
            
            #include <QApplication>
            
            int main(int argc, char *argv[])
            {
                QApplication a(argc, argv);
                MainWindow w;
                w.show();
                return a.exec();
            }
            
            1 Reply Last reply
            0
            • K K-Str
              4 Nov 2019, 11:02

              Hi,
              I'm quiet frustrated. Since a long time I try to install QT on an UBUNTU 18.04.3 Host cross compile for a raspberry3.
              There are a lot of tipps and tutorials how to install the qt creator for cross compile and remote debugging for a raspberry but now works really for me.
              I use a raspberry 3 where a LCD-display is connected via HDMI and SPI (for a touch pen). It runs a raspbian buster and the driver for the display.
              The installation is qt 5.12.5 based on 5.13.1 and qt-creator 4.10.0.
              The installation was fine and there where now errors during the installation.
              But when I create a simple widget with some buttons (e.g. one push button and one radio butto) it handles only one button.
              I get some errors when I run this widget

              
              Unable to query physical screen size, defaulting to 100 dpi.
              To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (in millimeters).
              Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
              

              but I cannot find any solution for them.
              This is the code for the widget:
              mainwindow.cpp:

              #include "mainwindow.h"
              #include "ui_mainwindow.h"
              #include <QDebug>
              
              MainWindow::MainWindow(QWidget *parent)
                  : QMainWindow(parent)
                  , ui(new Ui::MainWindow)
              {
                  ui->setupUi(this);
              }
              
              MainWindow::~MainWindow()
              {
                  delete ui;
              }
              
              
              void MainWindow::on_pushButton_clicked()
              {
                  qDebug() << "Hallo Pushy!";
              }
              
              void MainWindow::on_radioButton_clicked()
              {
                  qDebug() << "Hallo Radio!";
              }
              

              and mainwindow.h

              #ifndef MAINWINDOW_H
              #define MAINWINDOW_H
              
              #include <QMainWindow>
              
              QT_BEGIN_NAMESPACE
              namespace Ui { class MainWindow; }
              QT_END_NAMESPACE
              
              class MainWindow : public QMainWindow
              {
                  Q_OBJECT
              
              public:
                  MainWindow(QWidget *parent = nullptr);
                  ~MainWindow();
              
              private slots:
                  void on_pushButton_clicked();
              
                  void on_radioButton_clicked();
              
              private:
                  Ui::MainWindow *ui;
              };
              #endif // MAINWINDOW_H
              

              I'm sorry! sometimes I have the feeling sucessfull installing qt for creating widget for a raspberry never works and it's just a story like urban legends. Or does somebody really know a working tutorial or something?
              It would be nice if I get an answer

              thanks in advance!

              J Online
              J Online
              jsulm
              Lifetime Qt Champion
              wrote on 4 Nov 2019, 13:17 last edited by jsulm 11 Apr 2019, 13:17
              #6

              @K-Str said in Has anyone ever got a widget running on a rpi3 with LCD-Display (HDMI and SPI-Interface):

              it handles only one button

              Does exact same application work properly on your host?
              You're using auto-connect feature which is error-prone.

              I don't think the warning you see is related to your problem. You probably can ignore the warning.

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

              1 Reply Last reply
              0
              • K Offline
                K Offline
                K-Str
                wrote on 4 Nov 2019, 13:56 last edited by K-Str 11 Apr 2019, 14:30
                #7

                @jsulm ,
                yes I runned it on my host. Itworks perfectly!
                Both buttons work.
                When I start the widget on the raspberry from the command-line then it also shows this errors.
                I think there went something wrong on the configuration during the installation.
                I Installed it using almost this Tutorial link text.
                I also installed qt on a raspberry and it also works without any problems.

                If you need I can insert the installationscripte for the raspberry and Linux host.

                J 1 Reply Last reply 5 Nov 2019, 06:22
                0
                • K K-Str
                  4 Nov 2019, 13:56

                  @jsulm ,
                  yes I runned it on my host. Itworks perfectly!
                  Both buttons work.
                  When I start the widget on the raspberry from the command-line then it also shows this errors.
                  I think there went something wrong on the configuration during the installation.
                  I Installed it using almost this Tutorial link text.
                  I also installed qt on a raspberry and it also works without any problems.

                  If you need I can insert the installationscripte for the raspberry and Linux host.

                  J Online
                  J Online
                  jsulm
                  Lifetime Qt Champion
                  wrote on 5 Nov 2019, 06:22 last edited by
                  #8

                  @K-Str I really don't know why this happens. Alternative approach would be to not to use auto-connect feature (it is error-probe anyway). Instead give your slots a bit different names and connect them manually with signals.

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

                  1 Reply Last reply
                  0
                  • K Offline
                    K Offline
                    K-Str
                    wrote on 5 Nov 2019, 08:32 last edited by K-Str 11 May 2019, 08:33
                    #9

                    @jsulm Thanks your answer.
                    I will try it.
                    But

                      1. How cann I connect the signals manually to a slot?
                      1. How do I prevent of auto-connection?

                    Could you give me a hint how to do it?

                    J 1 Reply Last reply 5 Nov 2019, 08:36
                    0
                    • K K-Str
                      5 Nov 2019, 08:32

                      @jsulm Thanks your answer.
                      I will try it.
                      But

                        1. How cann I connect the signals manually to a slot?
                        1. How do I prevent of auto-connection?

                      Could you give me a hint how to do it?

                      J Online
                      J Online
                      jsulm
                      Lifetime Qt Champion
                      wrote on 5 Nov 2019, 08:36 last edited by
                      #10

                      @K-Str said in Has anyone ever got a widget running on a rpi3 with LCD-Display (HDMI and SPI-Interface):

                      How cann I connect the signals manually to a slot?

                      Using connect(). https://doc.qt.io/qt-5/signalsandslots.html

                      "How do I prevent of auto-connection?" - do not use the naming convention (like on_pushButton_clicked()) - rename your slots to for example pushButtonClicked()

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

                      1 Reply Last reply
                      0
                      • K Offline
                        K Offline
                        K-Str
                        wrote on 5 Nov 2019, 09:30 last edited by K-Str 11 May 2019, 11:05
                        #11

                        @jsulm ,
                        I use the qt-creator module to create form sheets.
                        Does it not work ? Must I setup everything without using the form file(=.ui)?
                        What is the problem? because I can create and run the widget on the host PC.
                        Do you think this is more a problem of the Touch-screen drivers?
                        Has anybody a idea?

                        J 1 Reply Last reply 6 Nov 2019, 06:30
                        0
                        • K K-Str
                          5 Nov 2019, 09:30

                          @jsulm ,
                          I use the qt-creator module to create form sheets.
                          Does it not work ? Must I setup everything without using the form file(=.ui)?
                          What is the problem? because I can create and run the widget on the host PC.
                          Do you think this is more a problem of the Touch-screen drivers?
                          Has anybody a idea?

                          J Online
                          J Online
                          jsulm
                          Lifetime Qt Champion
                          wrote on 6 Nov 2019, 06:30 last edited by
                          #12

                          @K-Str said in Has anyone ever got a widget running on a rpi3 with LCD-Display (HDMI and SPI-Interface):

                          Does it not work ?

                          It does. What sometimes causes problems is the auto-connect feature - I was only talking about this and not whole Qt Designer (ui).

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

                          1 Reply Last reply
                          0
                          • K Offline
                            K Offline
                            K-Str
                            wrote on 15 Nov 2019, 11:44 last edited by K-Str
                            #13

                            @jsulm ,
                            hi,
                            Thanks a lot for your answer!
                            Sorry for this delay but I was involved in an other project.
                            I use Qt5.10.1! and make a new widget.

                            • Here I open forms --> MainWindow.ui
                              Screenshot from 2019-11-15 12-32-13.png

                            • Next I create two button
                              Screenshot from 2019-11-15 12-36-36.png

                            • then I execute go to slot
                              Screenshot from 2019-11-15 12-37-48.png

                            • this makes a new slot:
                              mainwindow.cpp
                              Screenshot from 2019-11-15 12-40-32.png
                              and mainwindow.h
                              Screenshot from 2019-11-15 12-40-54.png
                              Where must I modify the names? In both files mainwindow.cpp and mainwindow.h

                            J 1 Reply Last reply 15 Nov 2019, 11:52
                            0
                            • K K-Str
                              15 Nov 2019, 11:44

                              @jsulm ,
                              hi,
                              Thanks a lot for your answer!
                              Sorry for this delay but I was involved in an other project.
                              I use Qt5.10.1! and make a new widget.

                              • Here I open forms --> MainWindow.ui
                                Screenshot from 2019-11-15 12-32-13.png

                              • Next I create two button
                                Screenshot from 2019-11-15 12-36-36.png

                              • then I execute go to slot
                                Screenshot from 2019-11-15 12-37-48.png

                              • this makes a new slot:
                                mainwindow.cpp
                                Screenshot from 2019-11-15 12-40-32.png
                                and mainwindow.h
                                Screenshot from 2019-11-15 12-40-54.png
                                Where must I modify the names? In both files mainwindow.cpp and mainwindow.h

                              J Online
                              J Online
                              jsulm
                              Lifetime Qt Champion
                              wrote on 15 Nov 2019, 11:52 last edited by
                              #14

                              @K-Str said in Has anyone ever got a widget running on a rpi3 with LCD-Display (HDMI and SPI-Interface):

                              Where must I modify the names?

                              This way you probably can't as designer generates the slot for you.
                              I create slots by myself, so can name them as I lake.

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

                              1 Reply Last reply
                              0
                              • K Offline
                                K Offline
                                K-Str
                                wrote on 15 Nov 2019, 12:05 last edited by
                                #15

                                @jsulm ,
                                hi,
                                I just renamed it as follows:
                                mainWindow.cpp
                                Screenshot from 2019-11-15 12-56-56.png
                                and mainwindow.h
                                Screenshot from 2019-11-15 12-53-09.png
                                It still doesn't work.
                                It is frustrating!
                                Was here something wrong?
                                What does it mean "You create your slots by yourself"?

                                J 1 Reply Last reply 15 Nov 2019, 12:08
                                0
                                • K K-Str
                                  15 Nov 2019, 12:05

                                  @jsulm ,
                                  hi,
                                  I just renamed it as follows:
                                  mainWindow.cpp
                                  Screenshot from 2019-11-15 12-56-56.png
                                  and mainwindow.h
                                  Screenshot from 2019-11-15 12-53-09.png
                                  It still doesn't work.
                                  It is frustrating!
                                  Was here something wrong?
                                  What does it mean "You create your slots by yourself"?

                                  J Online
                                  J Online
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on 15 Nov 2019, 12:08 last edited by
                                  #16

                                  @K-Str said in Has anyone ever got a widget running on a rpi3 with LCD-Display (HDMI and SPI-Interface):

                                  You create your slots by yourself

                                  You write the code by yourself.
                                  If you renamed the slot then you have to connect signal and slot manually now:

                                  connect(ui->pushButton, &QPushButton::clicked, this, MainWindow::MyPushButtonClicked);
                                  

                                  Please take a look at https://doc.qt.io/qt-5/signalsandslots.html

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

                                  1 Reply Last reply
                                  2
                                  • K Offline
                                    K Offline
                                    K-Str
                                    wrote on 15 Nov 2019, 16:18 last edited by
                                    #17

                                    @jsulm
                                    I'm really sorry but it's crazy.
                                    When I go forward step by step you get again new errors.
                                    I made it as you suggested but I get new problems:
                                    I think I yuse this connect command in a wrong way:
                                    Screenshot from 2019-11-15 17-09-52.png
                                    When I compile it I get this errors:

                                    /home/kurt/qt-projekte/AsimpleWidget/mainwindow.cpp:9: error: invalid use of void expression
                                         connect(ui->MyPushButton, &QPushButton::clicked, this, MainWindow::MyPushButtonClicked());
                                    

                                    and

                                    /home/kurt/qt-projekte/AsimpleWidget/mainwindow.cpp:10: error: invalid use of void expression
                                         connect(ui->MyRadioButton,&QRadioButton::clicked, this, MainWindow::MyRadioButtonClicked());
                                    

                                    I think this void makes some problems.
                                    Thanks for a hint whats wrong

                                    M 1 Reply Last reply 15 Nov 2019, 16:19
                                    0
                                    • K K-Str
                                      15 Nov 2019, 16:18

                                      @jsulm
                                      I'm really sorry but it's crazy.
                                      When I go forward step by step you get again new errors.
                                      I made it as you suggested but I get new problems:
                                      I think I yuse this connect command in a wrong way:
                                      Screenshot from 2019-11-15 17-09-52.png
                                      When I compile it I get this errors:

                                      /home/kurt/qt-projekte/AsimpleWidget/mainwindow.cpp:9: error: invalid use of void expression
                                           connect(ui->MyPushButton, &QPushButton::clicked, this, MainWindow::MyPushButtonClicked());
                                      

                                      and

                                      /home/kurt/qt-projekte/AsimpleWidget/mainwindow.cpp:10: error: invalid use of void expression
                                           connect(ui->MyRadioButton,&QRadioButton::clicked, this, MainWindow::MyRadioButtonClicked());
                                      

                                      I think this void makes some problems.
                                      Thanks for a hint whats wrong

                                      M Offline
                                      M Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on 15 Nov 2019, 16:19 last edited by mrjj
                                      #18

                                      @K-Str said in Has anyone ever got a widget running on a rpi3 with LCD-Display (HDMI and SPI-Interface):

                                      MainWindow::MyRadioButtonClicked()

                                      Hi
                                      in the connect you should not have the ()
                                      MainWindow::MyRadioButtonClicked**()**
                                      when using the new syntax. ( the one with no SIGNAL and SLOT macros)

                                      connect(ui->MyRadioButton,&QRadioButton::clicked, this, MainWindow::MyRadioButtonClicked); // no () in the end
                                      
                                      1 Reply Last reply
                                      0
                                      • K Offline
                                        K Offline
                                        K-Str
                                        wrote on 15 Nov 2019, 17:40 last edited by K-Str
                                        #19

                                        Hi @jsulm ,
                                        I think it's like Sisyphean task because I f you solve one problem you get the next one.
                                        Thank you for your patience. But I got the next problem:

                                        /home/kurt/qt-projekte/AsimpleWidget/mainwindow.cpp:9: error: no matching function for call to ‘MainWindow::connect(QPushButton*&, void (QAbstractButton::*)(bool), MainWindow* const, <unresolved overloaded function type>)’
                                             connect(ui->MyPushButton, &QPushButton::clicked, this, MainWindow::MyPushButtonClicked);
                                        

                                        and

                                        /opt/qt5pi/sysroot/usr/local/qt5pi/include/QtCore/qobject.h:275: error: no type named ‘type’ in ‘struct std::enable_if<false, QMetaObject::Connection>’
                                        

                                        Now seems to be something wrong in the sysroot?

                                        1 Reply Last reply
                                        0
                                        • M Offline
                                          M Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on 15 Nov 2019, 17:52 last edited by
                                          #20

                                          @K-Str said in Has anyone ever got a widget running on a rpi3 with LCD-Display (HDMI and SPI-Interface):

                                          connect(ui->MyPushButton, &QPushButton::clicked, this, MainWindow::MyPushButtonClicked);

                                          Hi
                                          You are missing a & ( sorry my bad, i missed it before)

                                          connect(ui->MyPushButton, &QPushButton::clicked, this, -->& MainWindow::MyPushButtonClicked);

                                          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