This is the line of code that breaks when I moved my project from QT 5.12 to QT 5.15.
setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
The error that is thrown is the following:
mainwindow.cpp:28:5: error: cannot initialize object parameter of type 'QWidget' with an expression of type 'MainWindow'
I am doing this migration because QT recommends moving to 5.15 before moving to QT 6. I have tried doing it the following way as well but gives me the same error.
Qt::WindowFlags flags;
flags |= Qt::Window;
flags |=Qt::FramelessWindowHint;
setWindowFlags(flags);
Here is the code for the whole MainWindow constructor there are several more errors in it as well, but for now lets focus on this one.
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
translator.load("://languages/translation_en.qm");
qApp->installTranslator(&translator);
//Initial UI setup.
#ifndef DESKTOP
/*
Qt::WindowFlags flags;
flags |= Qt::Window;
flags |=Qt::FramelessWindowHint;
setWindowFlags(flags);
*/
setWindowFlags(Qt::Window | Qt::FramelessWindowHint); //this is the line in question
setWindowState(Qt::WindowFullScreen);
#endif
ui->setupUi(this);
ui->remoteStatus->setVisible(false);
ui->simpleRemoteStatus->setVisible(false);
ui->simpleFrame->hide();
ui->dashboardFrame->hide();
ui->childFrame->hide();
startButtonDown = ui->simpleStartButton->isChecked();
stopButtonDown = ui->simpleStopButton->isChecked();
setupIcons();
//
double hmiver = 380;//version number
#ifdef CYCLE
hmiver = 999;
#endif
//Setup for Modbus Slave
thread = new QThread(this);
data = new DataThread();
data->moveToThread(thread);
connect(thread, SIGNAL(started()), data, SLOT(runProcess()));
//
setupMenus();
comsMod->RetainedData.HMIVer = hmiver;
comsMod->RTData.HMIVer = hmiver;
settingsMenu->aboutMenu->setHMIVer(hmiver);
setupTimers();
connectAll();
//Starts RTM communications on device side
DisplayCountTimer->setInterval(100);
DisplayCountTimer->start();
//After 2 seconds, starts remaining processes
StartModbusTimer->setInterval(2000);
StartModbusTimer->start();
/* Used for cycle testing */
#ifdef USBTEST
usbTest();
#endif
/* Used for cycle testing */
#ifdef CYCLE
this->on_productionButton_clicked();
#endif
}
I am working on Ubuntu 20.04