QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
26  : QDialog( parent, fl ), mMessage( QString( message ) ), mMsgLabel( 0 )
27 {
28  setWindowTitle( tr( "QGIS" ) );
29  setLayout( new QVBoxLayout() );
30  setWindowModality( Qt::WindowModal );
31  setMinimumWidth( 250 );
32  mMsgLabel = new QLabel( mMessage );
33  layout()->addWidget( mMsgLabel );
34 
35  QProgressBar* pb = new QProgressBar();
36  pb->setMaximum( 0 ); // show as busy indicator
37  layout()->addWidget( pb );
38 
39  if ( mMessage.isEmpty() )
40  {
41  mMsgLabel->hide();
42  }
43 }
44 
46 {
47 }
48 
50 {
51  if ( !message.isEmpty() )
52  {
53  mMessage = QString( message );
54  mMsgLabel->setText( mMessage );
55  mMsgLabel->show();
56  }
57 }
QLayout * layout() const
void setMaximum(int maximum)
void setWindowModality(Qt::WindowModality windowModality)
void setMinimumWidth(int minw)
QgsBusyIndicatorDialog(const QString &message="", QWidget *parent=0, Qt::WindowFlags fl=QgisGui::ModalDialogFlags)
Constructor Modal busy indicator dialog with no buttons.
QString tr(const char *sourceText, const char *disambiguation, int n)
void setLayout(QLayout *layout)
bool isEmpty() const
void setText(const QString &)
void hide()
void addWidget(QWidget *w)
void setMessage(const QString &message)
void setWindowTitle(const QString &)
typedef WindowFlags
void show()