QGIS API Documentation  2.99.0-Master (e077efd)
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  , mMsgLabel( nullptr )
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 }
50 
52 {
53  if ( !message.isEmpty() )
54  {
55  mMessage = QString( message );
56  mMsgLabel->setText( mMessage );
57  mMsgLabel->show();
58  }
59 }
QgsBusyIndicatorDialog(const QString &message="", QWidget *parent=nullptr, Qt::WindowFlags fl=QgisGui::ModalDialogFlags)
Constructor Modal busy indicator dialog with no buttons.
void setMessage(const QString &message)