JKQtExtras
a library of useful Qt widgets and tools
JKQTEProgressListDialog Class Reference

a dialog with a JKQTEProgressListWidget and a cancel button (optional) More...

#include <jkqteprogresslistwidget.h>

Inheritance diagram for JKQTEProgressListDialog:
Collaboration diagram for JKQTEProgressListDialog:

Public Slots

void cancel ()
 cancel the dialog
More...
 
void nextItem (int newStatusLast=JKQTEProgressListWidget::statusDone)
 searches for the first item with status statusInProgress and switches it's status to newStatusLast The next item with status statusNotStarted is switched to statusInProgress More...
 
void reset ()
 reset the list, i.e. set all items to JKQTEProgressListWidget::statusNotStarted More...
 
void setCancelButtonText (const QString &text)
 set the text on the cancel button More...
 
void setItemStatus (int item, int status)
 set the status of the item -th item (allowed values: JKQTEProgressListWidget::statusNone, JKQTEProgressListWidget::statusNotStarted, JKQTEProgressListWidget::statusDone, JKQTEProgressListWidget::statusFailed, JKQTEProgressListWidget::statusInProgress, JKQTEProgressListWidget::statusUser ...) More...
 
void setItemText (int item, const QString &text)
 set the text of the item -th item More...
 
void setLabelText (const QString &text)
 set the text on the label More...
 
void setMaximum (int max)
 set the range maximum of the progress indicator More...
 
void setMinimum (int min)
 set the range minimum of the progress indicator More...
 
void setProgressText (const QString &text)
 set the text on the progress indicator More...
 
void setRange (int min, int max)
 set the range of the progress indicator More...
 
void setValue (int value)
 set the value of the progress indicator More...
 
void start ()
 searched for the first item with status statusNotStarted and sets it to statusInProgress More...
 

Signals

void canceled ()
 emitted when the dialog is canceled More...
 

Public Member Functions

 JKQTEProgressListDialog (const QString &labelText, const QString &cancelButtonText, int minimum, int maximum, QWidget *parent=0, Qt::WindowFlags f=0)
 
 JKQTEProgressListDialog (QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
 
void addItem (const QString &text, int status=JKQTEProgressListWidget::statusNotStarted)
 add an item to the list More...
 
int count () const
 returns the number of items in the list More...
 
void defineIcon (int status, QIcon icon)
 define an icon to be used for a given status. More...
 
JKQTEProgressListWidgetgetProgressList () const
 
void setHasCancelButton (bool hasCancel, bool cancelRejects=false)
 switch visibility of cancel button (hasCancel =true ) and whether pressing it causes the dialog to be rejected. More...
 
void setHasProgressBar (bool hasProg=true)
 switch additional progress indicator on or off More...
 
bool wasCanceled () const
 indicates whether the dialog was canceled (via the cancel button or calling cancel() ) More...
 

Protected Member Functions

void createWidgets ()
 
virtual void showEvent (QShowEvent *event)
 

Protected Attributes

QPushButton * btnCancel
 
QLabel * labProgress
 
JKQTEProgressListWidgetlist
 
bool m_cancelRejects
 
bool m_hasProgressBar
 
bool m_wasCanceled
 
QProgressBar * progress
 
QFrame * progressLine
 

Detailed Description

a dialog with a JKQTEProgressListWidget and a cancel button (optional)

Usage example:

// label cancel button label min max
dialog.setWindowTitle(tr("Window Title of JKQTEProgressListDialog"));
// add progress list items
// the dialog also has a progress indicator:
dialog.setHasProgressBar(true);
dialog.setRange(0,10);
dialog.setValue(0);
dialog.setProgressText(tr("Progress Label"));
// the widget should have a cancel button:
dialog.setHasCancelButton(true);
dialog.setCancelButtonText(tr("Cancel Process"));
// some automatism for changing the state
timJKQTEProgressListDialog=new QTimer(progress);
stateJKQTEProgressListDialog=0;
timJKQTEProgressListDialog->setInterval(500);
connect(timJKQTEProgressListDialog, &QTimer::timeout, std::bind([&dialog](int& state){
if (state==1) {
for (int i=0; i<dialog.count(); i++) {
}
dialog.start();
} else if (state>10) {
state=0;
} else {
dialog.nextItem();
}
dialog.setValue(state);
state++;
}, std::ref(stateJKQTEProgressListDialog)));
timJKQTEProgressListDialog->start();
// show the dialog
dialog.exec();
See also
JKQTEProgressListWidget

Constructor & Destructor Documentation

◆ JKQTEProgressListDialog() [1/2]

JKQTEProgressListDialog::JKQTEProgressListDialog ( QWidget *  parent = nullptr,
Qt::WindowFlags  f = nullptr 
)

◆ JKQTEProgressListDialog() [2/2]

JKQTEProgressListDialog::JKQTEProgressListDialog ( const QString &  labelText,
const QString &  cancelButtonText,
int  minimum,
int  maximum,
QWidget *  parent = 0,
Qt::WindowFlags  f = 0 
)

Member Function Documentation

◆ addItem()

void JKQTEProgressListDialog::addItem ( const QString &  text,
int  status = JKQTEProgressListWidget::statusNotStarted 
)

add an item to the list

◆ cancel

void JKQTEProgressListDialog::cancel ( )
slot

cancel the dialog

◆ canceled

void JKQTEProgressListDialog::canceled ( )
signal

emitted when the dialog is canceled

◆ count()

int JKQTEProgressListDialog::count ( ) const

returns the number of items in the list

◆ createWidgets()

void JKQTEProgressListDialog::createWidgets ( )
protected

◆ defineIcon()

void JKQTEProgressListDialog::defineIcon ( int  status,
QIcon  icon 
)

◆ getProgressList()

JKQTEProgressListWidget* JKQTEProgressListDialog::getProgressList ( ) const

◆ nextItem

void JKQTEProgressListDialog::nextItem ( int  newStatusLast = JKQTEProgressListWidget::statusDone)
slot

searches for the first item with status statusInProgress and switches it's status to newStatusLast The next item with status statusNotStarted is switched to statusInProgress

◆ reset

void JKQTEProgressListDialog::reset ( )
slot

reset the list, i.e. set all items to JKQTEProgressListWidget::statusNotStarted

◆ setCancelButtonText

void JKQTEProgressListDialog::setCancelButtonText ( const QString &  text)
slot

set the text on the cancel button

◆ setHasCancelButton()

void JKQTEProgressListDialog::setHasCancelButton ( bool  hasCancel,
bool  cancelRejects = false 
)

switch visibility of cancel button (hasCancel =true ) and whether pressing it causes the dialog to be rejected.

◆ setHasProgressBar()

void JKQTEProgressListDialog::setHasProgressBar ( bool  hasProg = true)

switch additional progress indicator on or off

◆ setItemStatus

void JKQTEProgressListDialog::setItemStatus ( int  item,
int  status 
)
slot

◆ setItemText

void JKQTEProgressListDialog::setItemText ( int  item,
const QString &  text 
)
slot

set the text of the item -th item

◆ setLabelText

void JKQTEProgressListDialog::setLabelText ( const QString &  text)
slot

set the text on the label

◆ setMaximum

void JKQTEProgressListDialog::setMaximum ( int  max)
slot

set the range maximum of the progress indicator

◆ setMinimum

void JKQTEProgressListDialog::setMinimum ( int  min)
slot

set the range minimum of the progress indicator

◆ setProgressText

void JKQTEProgressListDialog::setProgressText ( const QString &  text)
slot

set the text on the progress indicator

◆ setRange

void JKQTEProgressListDialog::setRange ( int  min,
int  max 
)
slot

set the range of the progress indicator

◆ setValue

void JKQTEProgressListDialog::setValue ( int  value)
slot

set the value of the progress indicator

◆ showEvent()

virtual void JKQTEProgressListDialog::showEvent ( QShowEvent *  event)
protectedvirtual

◆ start

void JKQTEProgressListDialog::start ( )
slot

searched for the first item with status statusNotStarted and sets it to statusInProgress

◆ wasCanceled()

bool JKQTEProgressListDialog::wasCanceled ( ) const

indicates whether the dialog was canceled (via the cancel button or calling cancel() )

Member Data Documentation

◆ btnCancel

QPushButton* JKQTEProgressListDialog::btnCancel
protected

◆ labProgress

QLabel* JKQTEProgressListDialog::labProgress
protected

◆ list

JKQTEProgressListWidget* JKQTEProgressListDialog::list
protected

◆ m_cancelRejects

bool JKQTEProgressListDialog::m_cancelRejects
protected

◆ m_hasProgressBar

bool JKQTEProgressListDialog::m_hasProgressBar
protected

◆ m_wasCanceled

bool JKQTEProgressListDialog::m_wasCanceled
protected

◆ progress

QProgressBar* JKQTEProgressListDialog::progress
protected

◆ progressLine

QFrame* JKQTEProgressListDialog::progressLine
protected

The documentation for this class was generated from the following file:
JKQTEProgressListDialog::addItem
void addItem(const QString &text, int status=JKQTEProgressListWidget::statusNotStarted)
add an item to the list
JKQTEProgressListDialog::setValue
void setValue(int value)
set the value of the progress indicator
JKQTEProgressListWidget::statusNotStarted
@ statusNotStarted
Definition: jkqteprogresslistwidget.h:56
JKQTEProgressListDialog::setRange
void setRange(int min, int max)
set the range of the progress indicator
JKQTEProgressListDialog::setCancelButtonText
void setCancelButtonText(const QString &text)
set the text on the cancel button
JKQTEProgressListDialog::setProgressText
void setProgressText(const QString &text)
set the text on the progress indicator
JKQTEProgressListDialog::setHasCancelButton
void setHasCancelButton(bool hasCancel, bool cancelRejects=false)
switch visibility of cancel button (hasCancel =true ) and whether pressing it causes the dialog to be...
JKQTEProgressListDialog::start
void start()
searched for the first item with status statusNotStarted and sets it to statusInProgress
JKQTEProgressListDialog::count
int count() const
returns the number of items in the list
JKQTEProgressListDialog::progress
QProgressBar * progress
Definition: jkqteprogresslistwidget.h:194
JKQTEProgressListDialog::nextItem
void nextItem(int newStatusLast=JKQTEProgressListWidget::statusDone)
searches for the first item with status statusInProgress and switches it's status to newStatusLast Th...
JKQTEProgressListDialog::setHasProgressBar
void setHasProgressBar(bool hasProg=true)
switch additional progress indicator on or off
JKQTEProgressListDialog::setItemStatus
void setItemStatus(int item, int status)
set the status of the item -th item (allowed values: JKQTEProgressListWidget::statusNone,...
JKQTEProgressListDialog
a dialog with a JKQTEProgressListWidget and a cancel button (optional)
Definition: jkqteprogresslistwidget.h:137