1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
/***************************** LICENSE START ***********************************
Copyright 2017 ECMWF and INPE. This software is distributed under the terms
of the Apache License version 2.0. In applying this license, ECMWF does not
waive the privileges and immunities granted to it by virtue of its status as
an Intergovernmental Organization or submit itself to any jurisdiction.
***************************** LICENSE END *************************************/
#include "MvQProgressBarPanel.h"
//#include <QDebug>
#include <QLabel>
#include <QProgressBar>
#include <QToolBar>
#include <QWidgetAction>
MvQProgressBarPanel::MvQProgressBarPanel(QToolBar* toolBar, QWidget* parent):
QWidget(parent)
{
// Create a progress bar label
QLabel *label = new QLabel(this);
label->setText("Progress Bar: ");
acLabel_ = new QWidgetAction(this);
acLabel_->setDefaultWidget(label);
acLabel_->setVisible(false);
toolBar->addAction(acLabel_);
// Create progress bar
progressBar_ = new QProgressBar(this);
acToolBar_ = new QWidgetAction(this);
acToolBar_->setDefaultWidget(progressBar_);
acToolBar_->setVisible(false);
toolBar->addAction(acToolBar_);
}
MvQProgressBarPanel::~MvQProgressBarPanel()
{
// parent should destroy all Qt objects
}
void MvQProgressBarPanel::setRange(int min, int max)
{
progressBar_->setRange(min,max);
}
void MvQProgressBarPanel::setVisible(bool flag)
{
acLabel_->setVisible(flag);
acToolBar_->setVisible(flag);
}
void MvQProgressBarPanel::reset()
{
progressBar_->reset();
}
void MvQProgressBarPanel::setValue(int value)
{
progressBar_->setValue(value);
}
|