Results 1 to 11 of 11

Thread: Update to 4.4.2 - Now I Have A Transparent Dialog

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2006
    Location
    Madison, WI USA
    Posts
    153
    Thanks
    35
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Question Update to 4.4.2 - Now I Have A Transparent Dialog

    I've recently updated my Qt installation from 4.3.4 to 4.4.2. I have a simple dialog which is to display a 1 line message while some time-consuming operation is happening. When the operation has finished the dialog closes.

    Using 4.3.4 this was displaying as expected but since my switch to 4.4.2 the dialog body has become transparent (no background color, no text).

    Based on my years of programming experience, I assume that my code has worked by accident in 4.3.4 and 4.4.2 has uncovered a defect. Can anyone see what is going wrong here?

    I've attached a bitmap of what I'm seeing.

    Qt Code:
    1. class GenericWaitDlg : public QDialog
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. GenericWaitDlg( QWidget *pParent );
    7. void Initialize( QString sTitle, QString sMsg );
    8.  
    9. private:
    10. Ui::GenericDlgClass ui;
    11. QWidget* m_pParent;
    12. MainWin* m_pMainWin;
    13.  
    14. };
    15.  
    16.  
    17. GenericWaitDlg::GenericWaitDlg( QWidget* pParent )
    18. : QDialog( pParent )
    19. , m_pParent( pParent )
    20. , m_pMainWin( reinterpret_cast<MainWin*>(
    21. reinterpret_cast<NetConfigDlg*>( pParent )->m_pMainWin ) ) {}
    22.  
    23.  
    24. void GenericWaitDlg::Initialize( QString sTitle, QString sMsg )
    25. {
    26. // Remove the system menu, close button and context help button
    27. setWindowFlags( windowFlags() ^
    28. (Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint) );
    29.  
    30. ui.setupUi( this );
    31.  
    32. // Create Title and text strings
    33. setWindowTitle( sTitle );
    34. QLabel* sText = new QLabel( sMsg, this );
    35.  
    36. // Get the label size and use to fix dialog width
    37. QSize labelSize = sText->sizeHint().expandedTo( sText->sizeHint() );
    38. labelSize.setWidth( labelSize.width() + 120 );
    39.  
    40. // Layout label
    41. QHBoxLayout* hBox = new QHBoxLayout();
    42. hBox->addWidget( sText, 0, Qt::AlignHCenter );
    43.  
    44. // Main layout
    45. QVBoxLayout* vbox = new QVBoxLayout( this );
    46. vbox->addSpacing( 10 );
    47. vbox->addLayout( hBox, Qt::AlignRight );
    48. vbox->addSpacing( 15 );
    49. setLayout( vbox );
    50.  
    51. resize( labelSize.width(), labelSize.height() * 8 );
    52.  
    53. // Center the dialog in the parent window
    54. move( m_pParent->pos().x() +
    55. (m_pParent->frameGeometry().width() / 2) - (frameGeometry().width() / 2),
    56. m_pParent->pos().y() +
    57. (m_pParent->frameGeometry().height() / 2) - (frameGeometry().height() / 2) );
    58. }
    59.  
    60. // Instantiate, initialize and show the dialog
    61. GenericWaitDlg dlg( m_parent );
    62. dlg.Initialize( DLG_TITLE, DLG_MSG );
    63. dlg.show();
    64. // Do some work here...
    65. dlg.done( 0 );
    To copy to clipboard, switch view to plain text mode 
    Attached Images Attached Images

Similar Threads

  1. Update to 4.4.2 generates new warnings
    By mclark in forum Qt Programming
    Replies: 1
    Last Post: 19th September 2008, 19:59

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.