#4 EditingWindow::getPreferences bug

open
M. J. Smith
None
5
2009-04-05
2009-04-04
Alain Bertrand
No

EditingWindow::getPreferences needs a prefsDialog.show(); somewhere in its body.

Discussion

  • M. J. Smith
    M. J. Smith
    2009-04-05

    Why? It uses prefsDialog.exec(), which shows the dialog and runs it as a modal dialog.

     
  • M. J. Smith
    M. J. Smith
    2009-04-05

    • assigned_to: nobody --> indigojo_uk
     
  • Alain Bertrand
    Alain Bertrand
    2009-04-05

    Hi,

    I compiled yesterday qtm-0.7.4. When run, it asks me in a message box whether I wanted to set the preferences, I responded "yes", and then, nothing more on the screen but qtm is still running. If I answer "no", the main window shows correctly. I looked very quickly in the code, and added a prefsDialog.show() which solved my problem. I looked very quickly in the code, this function is full of #if defined so it is a little bit difficult to really follow the code, maybe the exec function is inside something which is not compiled on my platform. If you don't find it, I'll try to follow it in gdb.

     
  • M. J. Smith
    M. J. Smith
    2009-04-05

    The exec call is on line 1554 of EditingWindow.cc.

     
  • Alain Bertrand
    Alain Bertrand
    2009-04-06

    That's really strange indeed. I have added a few qWarning around the exec call :

    // Set console colours
    palette = prefsDialog.lConsoleExampleText->palette();
    palette.setColor( QPalette::Window, consoleBgColor );
    palette.setColor( QPalette::WindowText, consoleFgColor );
    prefsDialog.lConsoleExampleText->setPalette( palette );
    qWarning("run before USE_SYSTRAYICON ");

    #ifdef USE_SYSTRAYICON
    prefsDialog.cbSTI2ClickFunction->setCurrentIndex( STI2ClickFunction );
    #else
    prefsDialog.cbSTI2ClickFunction->hide();
    prefsDialog.label_10->hide();
    #endif
    #endif
    qWarning("run to 1547");
    prefsDialog.resize( QSize( prefsDialog.width(),
    prefsDialog.minimumHeight() ) );
    if( !title.isEmpty() )
    prefsDialog.setWindowTitle( title );

    // Disable cbStripParaTags as this feature is not properly implemented
    prefsDialog.chStripParaTags->setVisible( false );

    qWarning("run before exec");
    if( prefsDialog.exec() ) {
    qWarning("run exec");

    alain@logodenn:~/deb/qtm-0.7.4$ ./qtm
    run before USE_SYSTRAYICON
    run to 1547
    run before exec

    Best regards,

    Alain

    Alain

     
  • M. J. Smith
    M. J. Smith
    2009-04-06

    The "run exec" warning would have appeared only after the dialog had been closed, and even then only if it had exited with a positive result (i.e. the dialog's accept() slot being called, in this case by the user clicking OK), because that is what causes exec to return true. The exec function runs the dialog as modal, which means control passes to Qt until it's closed.

    What window manager/desktop are you using? It works for me in Gnome (I just tested it). It could be that the window is appearing behind another window. Certainly, I've never had the problem of the Prefs window failing to appear after clicking OK.

     
  • Alain Bertrand
    Alain Bertrand
    2009-04-07

    OK, it seems I have forgotten how works QDialog::exec(). Shame on me !
    Anyway, it doesn't work correctly on my system, I am using openbox and the dialog window is not hidden by others but is simply not present in any desktop. Adding a call to show() makes it work so if I am the only one to encounter this problem, there is no need to go further IMHO.

    Best regards,

    Alain