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

displays a list of items with an icon next to each which indicates the current task performed on the item (e.g. not started, in progress, success, failed, ...) More...

#include <jkqteprogresslistwidget.h>

Inheritance diagram for JKQTEProgressListWidget:
Collaboration diagram for JKQTEProgressListWidget:

Classes

struct  widgetstruct
 

Public Types

enum  {
  statusNone =0,
  statusNotStarted =1,
  statusDone =2,
  statusFailed =3,
  statusInProgress =4,
  statusUser =5
}
 

Public Slots

void nextItem (int newStatusLast=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 setCentered (bool centered)
 inidctaes whether to center the display More...
 
void setIconSize (int size)
 sets the currently used icon size for status icons More...
 
void setIconSize (QSize size)
 sets the currently used icon size for status icons 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 start ()
 searched for the first item with status statusNotStarted and sets it to statusInProgress More...
 

Public Member Functions

 JKQTEProgressListWidget (QWidget *parent=nullptr)
 
void addItem (const QString &text, int status=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...
 
void deleteItem (int item)
 deletes a given item More...
 
QIcon getIcon (int status) const
 returns the icon used for a given status More...
 
QSize getIconSize () const
 returns currently used icon size for status icons More...
 
int getStatus (int item) const
 returns the status of a given item More...
 
QString getText (int item) const
 returns the text of a given item More...
 
bool isCentered () const
 inidctaes whether to center the display More...
 

Protected Member Functions

void updateWidgets ()
 

Protected Attributes

QGridLayout * layout
 
bool m_centered
 
QMap< int, QIcon > m_icons
 
QSize m_iconSize
 
QStringList m_items
 
QList< int > m_status
 
QList< widgetstructm_widgets
 

Detailed Description

displays a list of items with an icon next to each which indicates the current task performed on the item (e.g. not started, in progress, success, failed, ...)

Usage example:

timJKQTEProgressListWidget=new QTimer(progress);
stateJKQTEProgressListWidget=0;
timJKQTEProgressListWidget->setInterval(500);
connect(timJKQTEProgressListWidget, &QTimer::timeout, std::bind([progress](int& state){
if (state==1) {
for (int i=0; i<progress->count(); i++) {
}
progress->start();
} else if (state>10) {
state=0;
} else {
progress->nextItem();
}
state++;
}, std::ref(stateJKQTEProgressListWidget)));
timJKQTEProgressListWidget->start();

There are two types of APIs that allow to modify the items:


Class Documentation

◆ JKQTEProgressListWidget::widgetstruct

struct JKQTEProgressListWidget::widgetstruct
Class Members
QLabel * labIcon
QLabel * labText

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
statusNone 
statusNotStarted 
statusDone 
statusFailed 
statusInProgress 
statusUser 

Constructor & Destructor Documentation

◆ JKQTEProgressListWidget()

JKQTEProgressListWidget::JKQTEProgressListWidget ( QWidget *  parent = nullptr)
explicit

Member Function Documentation

◆ addItem()

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

add an item to the list

◆ count()

int JKQTEProgressListWidget::count ( ) const

returns the number of items in the list

◆ defineIcon()

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

◆ deleteItem()

void JKQTEProgressListWidget::deleteItem ( int  item)

deletes a given item

◆ getIcon()

QIcon JKQTEProgressListWidget::getIcon ( int  status) const

returns the icon used for a given status

◆ getIconSize()

QSize JKQTEProgressListWidget::getIconSize ( ) const

returns currently used icon size for status icons

◆ getStatus()

int JKQTEProgressListWidget::getStatus ( int  item) const

returns the status of a given item

◆ getText()

QString JKQTEProgressListWidget::getText ( int  item) const

returns the text of a given item

◆ isCentered()

bool JKQTEProgressListWidget::isCentered ( ) const

inidctaes whether to center the display

◆ nextItem

void JKQTEProgressListWidget::nextItem ( int  newStatusLast = 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 JKQTEProgressListWidget::reset ( )
slot

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

◆ setCentered

void JKQTEProgressListWidget::setCentered ( bool  centered)
slot

inidctaes whether to center the display

◆ setIconSize [1/2]

void JKQTEProgressListWidget::setIconSize ( int  size)
slot

sets the currently used icon size for status icons

◆ setIconSize [2/2]

void JKQTEProgressListWidget::setIconSize ( QSize  size)
slot

sets the currently used icon size for status icons

◆ setItemStatus

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

◆ setItemText

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

set the text of the item -th item

◆ start

void JKQTEProgressListWidget::start ( )
slot

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

◆ updateWidgets()

void JKQTEProgressListWidget::updateWidgets ( )
protected

Member Data Documentation

◆ layout

QGridLayout* JKQTEProgressListWidget::layout
protected

◆ m_centered

bool JKQTEProgressListWidget::m_centered
protected

◆ m_icons

QMap<int, QIcon> JKQTEProgressListWidget::m_icons
protected

◆ m_iconSize

QSize JKQTEProgressListWidget::m_iconSize
protected

◆ m_items

QStringList JKQTEProgressListWidget::m_items
protected

◆ m_status

QList<int> JKQTEProgressListWidget::m_status
protected

◆ m_widgets

QList<widgetstruct> JKQTEProgressListWidget::m_widgets
protected

The documentation for this class was generated from the following file:
JKQTEProgressListWidget::statusNotStarted
@ statusNotStarted
Definition: jkqteprogresslistwidget.h:56
JKQTEProgressListWidget::nextItem
void nextItem(int newStatusLast=statusDone)
searches for the first item with status statusInProgress and switches it's status to newStatusLast Th...
JKQTEProgressListWidget::start
void start()
searched for the first item with status statusNotStarted and sets it to statusInProgress
JKQTEProgressListWidget::addItem
void addItem(const QString &text, int status=statusNotStarted)
add an item to the list
JKQTEProgressListWidget::JKQTEProgressListWidget
JKQTEProgressListWidget(QWidget *parent=nullptr)
JKQTEProgressListWidget
displays a list of items with an icon next to each which indicates the current task performed on the ...
Definition: jkqteprogresslistwidget.h:51
JKQTEProgressListWidget::count
int count() const
returns the number of items in the list
JKQTEProgressListWidget::setItemStatus
void setItemStatus(int item, int status)
set the status of the item -th item (allowed values: JKQTEProgressListWidget::statusNone,...