class GenericWaitDlg
: public QDialog{
Q_OBJECT
public:
GenericWaitDlg
( QWidget *pParent
);
private:
Ui::GenericDlgClass ui;
MainWin* m_pMainWin;
};
GenericWaitDlg
::GenericWaitDlg( QWidget* pParent
) , m_pParent( pParent )
, m_pMainWin( reinterpret_cast<MainWin*>(
reinterpret_cast<NetConfigDlg*>( pParent )->m_pMainWin ) ) {}
{
// Remove the system menu, close button and context help button
setWindowFlags( windowFlags() ^
(Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint) );
ui.setupUi( this );
// Create Title and text strings
setWindowTitle( sTitle );
// Get the label size and use to fix dialog width
QSize labelSize
= sText
->sizeHint
().
expandedTo( sText
->sizeHint
() );
labelSize.setWidth( labelSize.width() + 120 );
// Layout label
hBox->addWidget( sText, 0, Qt::AlignHCenter );
// Main layout
vbox->addSpacing( 10 );
vbox->addLayout( hBox, Qt::AlignRight );
vbox->addSpacing( 15 );
setLayout( vbox );
resize( labelSize.width(), labelSize.height() * 8 );
// Center the dialog in the parent window
move( m_pParent->pos().x() +
(m_pParent->frameGeometry().width() / 2) - (frameGeometry().width() / 2),
m_pParent->pos().y() +
(m_pParent->frameGeometry().height() / 2) - (frameGeometry().height() / 2) );
}
// Instantiate, initialize and show the dialog
GenericWaitDlg dlg( m_parent );
dlg.Initialize( DLG_TITLE, DLG_MSG );
dlg.show();
// Do some work here...
dlg.done( 0 );
class GenericWaitDlg : public QDialog
{
Q_OBJECT
public:
GenericWaitDlg( QWidget *pParent );
void Initialize( QString sTitle, QString sMsg );
private:
Ui::GenericDlgClass ui;
QWidget* m_pParent;
MainWin* m_pMainWin;
};
GenericWaitDlg::GenericWaitDlg( QWidget* pParent )
: QDialog( pParent )
, m_pParent( pParent )
, m_pMainWin( reinterpret_cast<MainWin*>(
reinterpret_cast<NetConfigDlg*>( pParent )->m_pMainWin ) ) {}
void GenericWaitDlg::Initialize( QString sTitle, QString sMsg )
{
// Remove the system menu, close button and context help button
setWindowFlags( windowFlags() ^
(Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint) );
ui.setupUi( this );
// Create Title and text strings
setWindowTitle( sTitle );
QLabel* sText = new QLabel( sMsg, this );
// Get the label size and use to fix dialog width
QSize labelSize = sText->sizeHint().expandedTo( sText->sizeHint() );
labelSize.setWidth( labelSize.width() + 120 );
// Layout label
QHBoxLayout* hBox = new QHBoxLayout();
hBox->addWidget( sText, 0, Qt::AlignHCenter );
// Main layout
QVBoxLayout* vbox = new QVBoxLayout( this );
vbox->addSpacing( 10 );
vbox->addLayout( hBox, Qt::AlignRight );
vbox->addSpacing( 15 );
setLayout( vbox );
resize( labelSize.width(), labelSize.height() * 8 );
// Center the dialog in the parent window
move( m_pParent->pos().x() +
(m_pParent->frameGeometry().width() / 2) - (frameGeometry().width() / 2),
m_pParent->pos().y() +
(m_pParent->frameGeometry().height() / 2) - (frameGeometry().height() / 2) );
}
// Instantiate, initialize and show the dialog
GenericWaitDlg dlg( m_parent );
dlg.Initialize( DLG_TITLE, DLG_MSG );
dlg.show();
// Do some work here...
dlg.done( 0 );
To copy to clipboard, switch view to plain text mode
Bookmarks