How to open dialog box on top of the application if two screen are connected?
-
Hi,
Why not use
this
rather thanm_mainWindow
? -
@SGaist I already try it but it is not work. i got this error.
Severity Code Description Project File Line Suppression State
Error C2664 'void QWidget::setParent(QWidget *,Qt::WindowFlags)': cannot convert argument 1 from 'MainWindowUI *const ' to 'QWidget *' -
Can you show your complete code for your MainWindow ?
It looks like you are modifying the wrong file.
-
@mrjj
m_mainWindow is my main Object, it is create the whole application on GUI side by calling createUI funcation.yes i was try to set the parent as main object.
I make this change and code work perfectly fine. and got the output, which I want.
void MainWindowUI::ShowDataRecoveryInformDialog() {
QDialog dialog = new QDialog( );dialog->setWindowFlags(Qt::SplashScreen);
dialog->setParent(m_mainWindow);auto dialogLay = new QVBoxLayout(dialog);
dialogLay->addWidget(PBT("button 1"));
dialogLay->addWidget(PBT("button 2"));
dialog->exec();
} -
Ok should be the same as, or else im very wondering
void MainWindowUI::ShowDataRecoveryInformDialog() { QDialog dialog = new QDialog( m_mainWindow); dialog->setWindowFlags(Qt::SplashScreen); auto dialogLay = new QVBoxLayout(dialog); dialogLay->addWidget(PBT("button 1")); dialogLay->addWidget(PBT("button 2")); dialog->exec(); }
-
I don't know. what is different but now it is work. i did not make any change except setting the property
before:
QDialog *dialog = new QDialog(parent, Qt::SplashScreen);now :
QDialog* dialog = new QDialog();
dialog->setWindowFlags(Qt::SplashScreen);
dialog->setParent(m_mainWindow); -
dialog->setWindowFlags(Qt::SplashScreen);
dialog->setParent(m_mainWindow);
In this case I got dialog box on top of the screen but it is make another issuedialog->exec(); is not work as per expectation. without responding the to Dialog user access the other page also.
In other word, user can access both screen Main application as well as Dialog box. how to block access on other widget until get response from the user in dialog box?
-
Hi
Im not 100% sure Qt::SplashScreen is compatiple with Qt::Dialog flagQt::SplashScreen 0x0000000e | Window Indicates that the window is a splash screen. This is the default type for QSplashScreen.
Normally used with QSplashScreen widget.
-
maybe try with
dialog->setWindowFlags(Qt::Dialog | Qt::SplashScreen); -
I am using Qt::SplashScreen because of I wanted show dialog on the top of all screen. This dialog is show whenever specific signal is generated from Hardware Connection. if hardware is connected with PC before opening our Software then dialog will open after Software Open. and control need to transfer on dialog box. (at this time user should not access any other page).
I have not idea what is model Dialog.