QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
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
19#include "moc_qgsbusyindicatordialog.cpp"
20
21#include <QDialog>
22#include <QLayout>
23#include <QLabel>
24#include <QProgressBar>
25
26QgsBusyIndicatorDialog::QgsBusyIndicatorDialog( const QString &message, QWidget *parent, Qt::WindowFlags fl )
27 : QDialog( parent, fl )
28 , mMessage( QString( message ) )
29
30{
31 setWindowTitle( tr( "QGIS" ) );
32 setLayout( new QVBoxLayout() );
33 setWindowModality( Qt::WindowModal );
34 setMinimumWidth( 250 );
35 mMsgLabel = new QLabel( mMessage );
36 layout()->addWidget( mMsgLabel );
37
38 QProgressBar *pb = new QProgressBar();
39 pb->setMaximum( 0 ); // show as busy indicator
40 layout()->addWidget( pb );
41
42 if ( mMessage.isEmpty() )
43 {
44 mMsgLabel->hide();
45 }
46}
47
48void QgsBusyIndicatorDialog::setMessage( const QString &message )
49{
50 if ( !message.isEmpty() )
51 {
52 mMessage = QString( message );
53 mMsgLabel->setText( mMessage );
54 mMsgLabel->show();
55 }
56}
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.