tuchulcha  0.10.1
Graphical Workflow Configuration Editor
PriorityBox.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2012 David Stronczek
2 
3  This file is part of Tuchulcha.
4 
5  Tuchulcha is free software: you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  Tuchulcha is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with Tuchulcha. If not, see <http://www.gnu.org/licenses/>.
17 */
24 #include "PriorityBox.h"
25 
26 #include <QComboBox>
27 
28 PriorityBox::PriorityBox(QWidget* pp, uint prio, bool strings) :
29  QComboBox(pp)
30 {
31  QIcon icon1;
32  icon1.addFile(QString::fromUtf8(":/icons/priorityGrey.png"),
33  QSize(), QIcon::Normal, QIcon::Off);
34  QIcon icon2;
35  icon2.addFile(QString::fromUtf8(":/icons/priorityGreen.png"),
36  QSize(), QIcon::Normal, QIcon::Off);
37  QIcon icon3;
38  icon3.addFile(QString::fromUtf8(":/icons/priorityYellow.png"),
39  QSize(), QIcon::Normal, QIcon::Off);
40  QIcon icon4;
41  icon4.addFile(QString::fromUtf8(":/icons/priorityRed.png"),
42  QSize(), QIcon::Normal, QIcon::Off);
43 
44  if (strings) {
45  addItem(icon1, QString("Standard"));
46  addItem(icon2, QString("Low"));
47  addItem(icon3, QString("Medium"));
48  addItem(icon4, QString("High"));
49  } else {
50  addItem(icon1, QString());
51  addItem(icon2, QString());
52  addItem(icon3, QString());
53  addItem(icon4, QString());
54  }
55 
56  setCurrentIndex(prio);
57 }
58 
59 uint PriorityBox::priority() const {
60  return currentIndex();
61 }
62 
63 void PriorityBox::setPriority(uint value) {
64  setCurrentIndex(value);
65 }
Declaration of class PriorityBox.
void setPriority(uint value)
Set selected priority.
Definition: PriorityBox.cpp:63
PriorityBox(QWidget *parent=0, uint priority=0, bool strings=true)
Default constructor, setting parent widget.
Definition: PriorityBox.cpp:28
uint priority() const
Get selected priority.