QGIS API Documentation  3.4.15-Madeira (e83d02e274)
qgsbusyindicatordialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsbusyindicatordialog.cpp
3  --------------------------
4  begin : Mar 27, 2013
5  copyright : (C) 2013 by Larry Shaffer
6  email : larrys at dakcarto dot com
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #include "qgsbusyindicatordialog.h"
19 
20 #include <QDialog>
21 #include <QLayout>
22 #include <QLabel>
23 #include <QProgressBar>
24 
25 QgsBusyIndicatorDialog::QgsBusyIndicatorDialog( const QString &message, QWidget *parent, Qt::WindowFlags fl )
26  : QDialog( parent, fl )
27  , mMessage( QString( message ) )
28 
29 {
30  setWindowTitle( tr( "QGIS" ) );
31  setLayout( new QVBoxLayout() );
32  setWindowModality( Qt::WindowModal );
33  setMinimumWidth( 250 );
34  mMsgLabel = new QLabel( mMessage );
35  layout()->addWidget( mMsgLabel );
36 
37  QProgressBar *pb = new QProgressBar();
38  pb->setMaximum( 0 ); // show as busy indicator
39  layout()->addWidget( pb );
40 
41  if ( mMessage.isEmpty() )
42  {
43  mMsgLabel->hide();
44  }
45 }
46 
48 {
49  if ( !message.isEmpty() )
50  {
51  mMessage = QString( message );
52  mMsgLabel->setText( mMessage );
53  mMsgLabel->show();
54  }
55 }
void setMessage(const QString &message)
QgsBusyIndicatorDialog(const QString &message=QString(), QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
Constructor Modal busy indicator dialog with no buttons.