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-StrK Offline
    K-StrK Offline
    K-Str
    wrote on last edited by K-Str
    #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!

    jsulmJ 1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #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-StrK Offline
        K-StrK Offline
        K-Str
        wrote on 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.
        
        jsulmJ 1 Reply Last reply
        0
        • K-StrK K-Str

          @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.
          
          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on 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-StrK Offline
            K-StrK Offline
            K-Str
            wrote on 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-StrK K-Str

              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!

              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on last edited by jsulm
              #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-StrK Offline
                K-StrK Offline
                K-Str
                wrote on last edited by K-Str
                #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.

                jsulmJ 1 Reply Last reply
                0
                • K-StrK K-Str

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

                  jsulmJ Online
                  jsulmJ Online
                  jsulm
                  Lifetime Qt Champion
                  wrote on 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-StrK Offline
                    K-StrK Offline
                    K-Str
                    wrote on last edited by K-Str
                    #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?

                    jsulmJ 1 Reply Last reply
                    0
                    • K-StrK K-Str

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

                      jsulmJ Online
                      jsulmJ Online
                      jsulm
                      Lifetime Qt Champion
                      wrote on 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-StrK Offline
                        K-StrK Offline
                        K-Str
                        wrote on last edited by K-Str
                        #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?

                        jsulmJ 1 Reply Last reply
                        0
                        • K-StrK K-Str

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

                          jsulmJ Online
                          jsulmJ Online
                          jsulm
                          Lifetime Qt Champion
                          wrote on 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-StrK Offline
                            K-StrK Offline
                            K-Str
                            wrote on 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

                            jsulmJ 1 Reply Last reply
                            0
                            • K-StrK K-Str

                              @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

                              jsulmJ Online
                              jsulmJ Online
                              jsulm
                              Lifetime Qt Champion
                              wrote on 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-StrK Offline
                                K-StrK Offline
                                K-Str
                                wrote on 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"?

                                jsulmJ 1 Reply Last reply
                                0
                                • K-StrK K-Str

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

                                  jsulmJ Online
                                  jsulmJ Online
                                  jsulm
                                  Lifetime Qt Champion
                                  wrote on 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-StrK Offline
                                    K-StrK Offline
                                    K-Str
                                    wrote on 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

                                    mrjjM 1 Reply Last reply
                                    0
                                    • K-StrK K-Str

                                      @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

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on 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-StrK Offline
                                        K-StrK Offline
                                        K-Str
                                        wrote on 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
                                        • mrjjM Offline
                                          mrjjM Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on 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