2

I have project that written in qt5.5 and below and it contains qtdeclarative module, I am trying to port qt5.5+ but my project using qtdeclarative module that is removed. So I added equivalent as this document says but members are removed or moved to another class,(setAttribute, viewport, setRenderHints, setViewportUpdateMode ) so how can I use those members inside of my MainViewX or for the qt5.9+ Can I use qtdeclarative without changing mycode significantly?

enter image description here

    QQuickView  *MainViewX;//QDeclarativeView    *MainViewX;
    QQmlEngine  *EngineX;//QDeclarativeEngine  *EngineX;
    QQmlContext *ContextX;//QDeclarativeContext *ContextX;


    QString QML_MainWindow;




#include <QQmlPropertyMap> //#include <QDeclarativePropertyMap>

#include <QTranslator>

MainWindow::MainWindow(QApplication *app, QWidget *parent,QTranslator * mtrans) :
    QWidget(parent)
{
    MainViewX    = new QQuickView;//new QDeclarativeView;
    EngineX      = MainViewX->engine();
    ContextX     = MainViewX->rootContext();

    Info = new InfoX(MainViewX);

    QML_MainWindow = "qrc:qml/main.qml";

    MainViewX->setSource(QML_MainWindow);
    MainViewX->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform | QPainter::TextAntialiasing);

    MainViewX->setAttribute(Qt::WA_OpaquePaintEvent); //Qt::WA_TranslucentBackground
    MainViewX->setAttribute(Qt::WA_NoSystemBackground);
    MainViewX->viewport()->setAttribute(Qt::WA_OpaquePaintEvent);
    MainViewX->viewport()->setAttribute(Qt::WA_NoSystemBackground);
    MainViewX->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
ikaloron
  • 59
  • 8

2 Answers2

0

QtDeclarative has been removed since Qt 5.6. You have to add QT += declarative in your *.pro file and include the header file QtDeclarative/QDeclarativeView.

See the Qt documentation for more info.

Dimitry Ernot
  • 6,256
  • 2
  • 25
  • 37
  • when I add it says : Project ERROR: Unknown module(s) in QT: declarative – ikaloron Apr 04 '19 at 12:58
  • It seems you didn't install the *Qt Script (deprecated)* module. Run the Qt Maintenance Tool and install it. – Dimitry Ernot Apr 04 '19 at 13:31
  • I installed qt from ubuntu repositories, and installed qtscript5-dev qtscript-tools too. But it still gives same error Project ERROR: Unknown module(s) in QT: declarative. Isn`t it qtscript5-dev contains qtdeclarative. – ikaloron Apr 11 '19 at 06:45
  • also I installed qt with maintaince tool with qt script module but it still gives me :-1: error: Unknown module(s) in QT: declarative – ikaloron Apr 11 '19 at 08:28
  • I use multi platform multi distro so i tried also on manjaro but same error, no luck. If I didn`t understand wrongly, if qtscript depracated package installed i will be able to use qtdeclarative module in qt5.9+ and be able cross compile, right? – ikaloron Apr 11 '19 at 12:51
  • QtDeclarative (Qt Quick 1) != QtScript. And with QtDeclarative removed from 5.9 you need, effectively, a port of your program... – peppe Apr 13 '19 at 11:38
0

This is not an actual answer but i am removing and using new qt libraries for project. So qtdeclarative problem is no more relevant.

ikaloron
  • 59
  • 8