Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Compilation issue with qt_screen
QtWS25 Last Chance

Compilation issue with qt_screen

Scheduled Pinned Locked Moved Solved Mobile and Embedded
ubuntu
12 Posts 4 Posters 3.9k 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.
  • V Offline
    V Offline
    victor wang
    wrote on last edited by victor wang
    #1

    I have Qt5.5 Installed on Desktop PC On Ubuntu OS.
    While compiling my program i am getting below error -
    This is what i got for error

    ../../work/mainwindow.cpp: In constructor 'MainWindow(QWidget)': 
    ../../work/mainwindow.cpp:63:31: 
    error: 'qt_screen' was not declared in this scope ui->stackedWidget->resize(qt_screen->deviceWidth(),qt_screeb->deviceHeight());
    

    And this is part of my code

    MainWindow::MainWindow(QWidget *parent) : 
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
       ui->setipUi(this);
       setWindowFlags(Qt::CustomizeWindowHint);
       ui->stackedWidget->resize(qt_screen->deviceWidth().qt_screen->deviceHeight());
       ui->stackedWidget->setCurrentWidget(ui->stackedWidgetPageMain);
    
       initPageMain();
    
       touch=new Touch();
       powerButton=new PowerButton();
       auxButton=new AuxButton();
       usbOtg=new UsbOtg();
       battery=new Battery();
       panel=new Panel();
       lan=new Lan();
       hPattern= new HPattern();
       lodLog=new LodLog();
       record=new Record();
       led=new Led();
       lightsensor=new LightSensor();
    }
    

    Did i miss to include anything?
    By the way i'm sure that i had include Qscreen into it.
    Is there any possibility that i might set wrong on my code?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      The upload feature is currently broken, please use an image sharing site so we can see what the problem is about.

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

      V 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        The upload feature is currently broken, please use an image sharing site so we can see what the problem is about.

        V Offline
        V Offline
        victor wang
        wrote on last edited by
        #3

        @SGaist
        Thanks for telling me .
        This is what i got for my error

        ../../work/mainwindow.cpp: In constructor 'MainWindow(QWidget)': 
        ../../work/mainwindow.cpp:63:31: 
        error: 'qt_screen' was not declared in this scope ui->stackedWidget->resize(qt_screen->deviceWidth(),qt_screeb->deviceHeight());
        

        And this is part of my code

        MainWindow::MainWindow(QWidget *parent) : 
        QMainWindow(parent),
        ui(new Ui::MainWindow)
        {
           ui->setipUi(this);
           setWindowFlags(Qt::CustomizeWindowHint);
           ui->stackedWidget->resize(qt_screen->deviceWidth().qt_screen->deviceHeight());
           ui->stackedWidget->setCurrentWidget(ui->stackedWidgetPageMain);
        
           initPageMain();
        
           touch=new Touch();
           powerButton=new PowerButton();
           auxButton=new AuxButton();
           usbOtg=new UsbOtg();
           battery=new Battery();
           panel=new Panel();
           lan=new Lan();
           hPattern= new HPattern();
           lodLog=new LodLog();
           record=new Record();
           led=new Led();
           lightsensor=new LightSensor();
        }
        
        jsulmJ 1 Reply Last reply
        0
        • V victor wang

          @SGaist
          Thanks for telling me .
          This is what i got for my error

          ../../work/mainwindow.cpp: In constructor 'MainWindow(QWidget)': 
          ../../work/mainwindow.cpp:63:31: 
          error: 'qt_screen' was not declared in this scope ui->stackedWidget->resize(qt_screen->deviceWidth(),qt_screeb->deviceHeight());
          

          And this is part of my code

          MainWindow::MainWindow(QWidget *parent) : 
          QMainWindow(parent),
          ui(new Ui::MainWindow)
          {
             ui->setipUi(this);
             setWindowFlags(Qt::CustomizeWindowHint);
             ui->stackedWidget->resize(qt_screen->deviceWidth().qt_screen->deviceHeight());
             ui->stackedWidget->setCurrentWidget(ui->stackedWidgetPageMain);
          
             initPageMain();
          
             touch=new Touch();
             powerButton=new PowerButton();
             auxButton=new AuxButton();
             usbOtg=new UsbOtg();
             battery=new Battery();
             panel=new Panel();
             lan=new Lan();
             hPattern= new HPattern();
             lodLog=new LodLog();
             record=new Record();
             led=new Led();
             lightsensor=new LightSensor();
          }
          
          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @victor-wang What is qt_screen and where was it declared?

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

          V H 2 Replies Last reply
          1
          • jsulmJ jsulm

            @victor-wang What is qt_screen and where was it declared?

            V Offline
            V Offline
            victor wang
            wrote on last edited by victor wang
            #5

            @jsulm
            I thought that qt_screen no need to be declared.
            Because when i get this Sample code, it doesn't seem to be declared.
            According to that i search the Example code on Qt website, they do the same thing as below
            0_1487838222101_help.png

            So i don't think it is the problem.

            1 Reply Last reply
            0
            • jsulmJ jsulm

              @victor-wang What is qt_screen and where was it declared?

              H Offline
              H Offline
              Hung Tran
              wrote on last edited by
              #6

              @jsulm Something wrong in this code ?
              ui->stackedWidget->resize(qt_screen->deviceWidth().qt_screen->deviceHeight());

              jsulmJ 1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                A sample code is not necessarily a fully functioning example.

                Also, it's C++, you can't use something that wasn't declared and depending on how you declared it, it also need to be initialized.

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

                V 1 Reply Last reply
                0
                • H Hung Tran

                  @jsulm Something wrong in this code ?
                  ui->stackedWidget->resize(qt_screen->deviceWidth().qt_screen->deviceHeight());

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @Hung-Tran The error message actually tells you what is wrong. qt_screen is not declared.
                  Add

                  private:
                  QScreen qt_screen;
                  

                  to your MainWindow class.

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

                  V 1 Reply Last reply
                  0
                  • jsulmJ jsulm

                    @Hung-Tran The error message actually tells you what is wrong. qt_screen is not declared.
                    Add

                    private:
                    QScreen qt_screen;
                    

                    to your MainWindow class.

                    V Offline
                    V Offline
                    victor wang
                    wrote on last edited by
                    #9

                    @jsulm
                    It doesn't work and more error now.
                    This is what i got for my error

                    0_1487840442678_help.png

                    I have tried to add this function

                    QScreen *qt_screen;
                    

                    But actually it won't work because deviceWeight() is not the member.
                    Still got error.

                    jsulmJ 1 Reply Last reply
                    0
                    • V victor wang

                      @jsulm
                      It doesn't work and more error now.
                      This is what i got for my error

                      0_1487840442678_help.png

                      I have tried to add this function

                      QScreen *qt_screen;
                      

                      But actually it won't work because deviceWeight() is not the member.
                      Still got error.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      @victor-wang I cannot see the screenshot (images do not work here usually).
                      Did you include QScreen class in your MainWindow header?
                      deviceWeight() is not member of QSreen this is correct. I guess the example you're using is older?
                      Check the documentation: http://doc.qt.io/qt-5/qscreen.html
                      You need to use something else (http://doc.qt.io/qt-5/qscreen.html#geometry-prop ?).

                      Note: QScreen *qt_screen; is not a function, it is variable declaration.

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

                      1 Reply Last reply
                      0
                      • SGaistS SGaist

                        A sample code is not necessarily a fully functioning example.

                        Also, it's C++, you can't use something that wasn't declared and depending on how you declared it, it also need to be initialized.

                        V Offline
                        V Offline
                        victor wang
                        wrote on last edited by
                        #11

                        @SGaist
                        I'm thinking if it is possible to use Qscreen to show the full screen?
                        I can use the other way to achieve my goal.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Following what you wrote, it looks like you should rather take a look at QDesktopWidget.

                          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

                          • Login

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