diff options
author | senator <senator> | 2008-03-24 13:16:38 +0000 |
---|---|---|
committer | senator <senator> | 2008-03-24 13:16:38 +0000 |
commit | 2e87c4608a9fb888fd7669756d8cb457ac305f71 (patch) | |
tree | 3e8ecbf49f42bac36128a3ae24a7c76722677272 /client/widgets/listbox.cc | |
parent | 885e139e750fa13a581dff70b3d8d91a9170a772 (diff) |
next button now works; listbox isValid check improved; start macro implemented
Diffstat (limited to 'client/widgets/listbox.cc')
-rw-r--r-- | client/widgets/listbox.cc | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/client/widgets/listbox.cc b/client/widgets/listbox.cc index 9435ac1..823a4bb 100644 --- a/client/widgets/listbox.cc +++ b/client/widgets/listbox.cc @@ -25,6 +25,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ #include "listbox.h" +#include <QListWidgetItem> ListBox::ListBox(QDomNode node) : QListWidget(), Widget(node) @@ -47,21 +48,50 @@ ListBox::ListBox(QDomNode node) for (int i=0; i < children.count(); i++) { QDomNode child = children.at(i); QDomElement list_elem = child.toElement(); - - if(list_elem.hasAttribute("caption") && list_elem.hasAttribute("value")) { + + if(list_elem.hasAttribute("type")) { + if(list_elem.attribute("type") == "header") { + // create header element + QListWidgetItem *header = new + QListWidgetItem(list_elem.attribute("caption")); + //header->setBackground(Qt::HorPattern); + header->setFlags(0); + QFont headerfont; + headerfont.setBold(true); + headerfont.setItalic(true); + header->setFont(headerfont); + QBrush headerbrush(Qt::SolidPattern); + headerbrush.setColor(Qt::lightGray); + header->setBackground(headerbrush); + addItem(header); + } else if (list_elem.attribute("type") == "separator") { + // insert separator + QListWidgetItem *separator = new QListWidgetItem(" "); + //separator->setBackground(Qt::HorPattern); + separator->setFlags(0); + addItem(separator); + } + } else if(list_elem.hasAttribute("caption") && + list_elem.hasAttribute("value")) { // insert item into current listbox addItem(list_elem.attribute("caption")); - if(elem.attribute("value") == list_elem.attribute("value")) { - setCurrentRow(count() - 1); - default_found = 1; + if(default_found == 0 && elem.attribute("value") == list_elem.attribute("value")) { + //setCurrentRow(count() - 1); + //default_found = 1; } } else { - printf("XML Error!!! Listbox item is missing one or more attributes...\n"); + printf("XML Error!!! Listbox item is missing one or more " + "attributes...\n"); } } if(default_found == 0) setCurrentRow(-1); // -1 is default for none selected } +bool ListBox::isValid() +{ + return selectedItems().size() != 0; +} + QString ListBox::getValue() { QString value = "none"; |