I am using QT Creator 4.5.2 based on 5.9.5 on Ubuntu 18 to build an application designed for a Raspberry Pi 3 running Stretch (cross compiled).
I can launch the application on the RPi3, but the MainWindow is full screen with no control buttons nor title bar and I can't seem to figure out how to change that. I have tried .show(), .showMaximized(), and .showFullScreen() all which produce the same results of a full screen application with no frame or control buttons.
What could I be missing here? For brevity, here are abbreviated versions of the main.cpp and mainwindow.h files:
Lines commented out are the .show functions that I've tried, all which seem to produce the same results. Note: there are no other references to any .show functions anywhere else in the code.
main.cpp:
#include "mainwindow.h"
#include <QDialog>
#include <QApplication>
#include <QScreen>
#include <QDebug>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QScreen *screen = QGuiApplication::primaryScreen();
QRect screenGeometry = screen->geometry();
int height = screenGeometry.height();
int width = screenGeometry.width();
MainWindow w;
w.resize(height-100, width-100);
w.setWindowFlags(Qt::Window | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint | Qt::WindowCloseButtonHint | Qt::WindowFullscreenButtonHint | Qt::WindowTitleHint);
//w.show();
//w.showMaximized();
w.showFullScreen();
return a.exec();
}
mainwindow.h:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QObject>
#include <QCloseEvent>
#include <QDebug>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
private slots:
void closeApp();
};
#endif // MAINWINDOW_H