mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 18:09:59 +03:00
Progress indicators
This commit is contained in:
parent
e6be883d14
commit
8cfd0881ac
7 changed files with 111 additions and 16 deletions
19
main.cpp
19
main.cpp
|
|
@ -1,11 +1,16 @@
|
|||
#include "CategorizedView.h"
|
||||
#include "main.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStandardItemModel>
|
||||
#include <QPainter>
|
||||
#include <QTime>
|
||||
|
||||
#include "CategorizedView.h"
|
||||
#include "CategorizedProxyModel.h"
|
||||
#include "InstanceDelegate.h"
|
||||
|
||||
Progresser *progresser;
|
||||
|
||||
QPixmap icon(const Qt::GlobalColor color)
|
||||
{
|
||||
QPixmap p = QPixmap(32, 32);
|
||||
|
|
@ -29,8 +34,9 @@ QStandardItem *createItem(const Qt::GlobalColor color, const QString &text, cons
|
|||
QStandardItem *item = new QStandardItem;
|
||||
item->setText(text);
|
||||
item->setData(icon(color), Qt::DecorationRole);
|
||||
item->setData(category, CategorizedView::CategoryRole);
|
||||
item->setData(category, CategorizedViewRoles::CategoryRole);
|
||||
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
//progresser->addTrackedIndex(item);
|
||||
return item;
|
||||
}
|
||||
QStandardItem *createItem(const int index, const QString &category)
|
||||
|
|
@ -38,8 +44,9 @@ QStandardItem *createItem(const int index, const QString &category)
|
|||
QStandardItem *item = new QStandardItem;
|
||||
item->setText(QString("Item #%1").arg(index));
|
||||
item->setData(icon(index), Qt::DecorationRole);
|
||||
item->setData(category, CategorizedView::CategoryRole);
|
||||
item->setData(category, CategorizedViewRoles::CategoryRole);
|
||||
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
|
||||
//progresser->addTrackedIndex(item);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
@ -47,6 +54,10 @@ int main(int argc, char *argv[])
|
|||
{
|
||||
QApplication a(argc, argv);
|
||||
|
||||
qsrand(QTime::currentTime().msec());
|
||||
|
||||
progresser = new Progresser();
|
||||
|
||||
QStandardItemModel model;
|
||||
model.setRowCount(10);
|
||||
model.setColumnCount(1);
|
||||
|
|
@ -62,7 +73,7 @@ int main(int argc, char *argv[])
|
|||
model.setItem(7, createItem(Qt::white, "White", "Not Colorful"));
|
||||
|
||||
model.setItem(8, createItem(Qt::darkGreen, "Dark Green", ""));
|
||||
model.setItem(9, createItem(Qt::green, "Green", ""));
|
||||
model.setItem(9, progresser->addTrackedIndex(createItem(Qt::green, "Green", "")));
|
||||
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue