2

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?

Jens
  • 6,173
  • 2
  • 24
  • 43
Tsung-Li Wang
  • 139
  • 10
  • 1
    Do you at the very least have available a line that declares 'qt_screen', such as `QScreen* qt_screen`, within the scope? – polarysekt Feb 23 '17 at 08:22
  • Two comments. 1) The error text has a variable called `qt_screeb` instead of `qt_screen` but the error says `qt_screen` was not declared. Stange. 2) The `resize` method has a dot (`.`) instead of a comma (`,`) – Tarod Feb 23 '17 at 12:48
  • Possible duplicate of [QT QWebEnginePage::setWebChannel() transport object](http://stackoverflow.com/questions/31928444/qt-qwebenginepagesetwebchannel-transport-object) – Tsung-Li Wang Mar 29 '17 at 05:36

1 Answers1

2

QScreen class has changed notably from Qt4 and Qt5, actually so much, that it is considered new in Qt5.

Qt4 QScreen had a static method called QScreen::instance() which returned a QScreen instance pointer. Way back in Qt4, this pointer was taken from a global variable qt_screen, if I remember correctly. All this has changed, so simply remove all code which access qt_screen and fix it by properly accessing public APIs.

Jens
  • 6,173
  • 2
  • 24
  • 43