qInputDialog make visible unity taskbar and title bar in fullscreen applications
Solved
General and Desktop
-
I'm trying to ask for a password the user in order to access a particular section, my application is fullscreen. The problem is that when the qInputDialog appears also the unity taskbar and the application titlebar appears. I want to avoid this and keep my application fullscreen. I'm using Qt 5.12.3 on Ubuntu 16.04
Take a look at this minimal example:
main.cpp
#include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.showFullScreen(); return a.exec(); }
Mainwindow.cpp
#include "mainwindow.h" #include "ui_mainwindow.h" #include <QInputDialog> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); } MainWindow::~MainWindow() { delete ui; } void MainWindow::on_pushButton_clicked() { bool ok; QString text = QInputDialog::getText(this, tr("Restriscted"), tr("Password:"), QLineEdit::Password,"",&ok, Qt::FramelessWindowHint); if (ok && text=="pass") { ui->label->setText("ok"); } }
-
Hi
I never found a way to avoid that. At least not with XFCE windows manager. -
Hi,
One alternative could be to implement your own input widget and use for example QStackedWidget to show it in place of your central widget when you need to login and once done, you switch back to your standard central widget.