summaryrefslogtreecommitdiff
path: root/client/widgets
diff options
context:
space:
mode:
authorsenator <senator>2008-03-24 13:16:38 +0000
committersenator <senator>2008-03-24 13:16:38 +0000
commit2e87c4608a9fb888fd7669756d8cb457ac305f71 (patch)
tree3e8ecbf49f42bac36128a3ae24a7c76722677272 /client/widgets
parent885e139e750fa13a581dff70b3d8d91a9170a772 (diff)
next button now works; listbox isValid check improved; start macro implemented
Diffstat (limited to 'client/widgets')
-rw-r--r--client/widgets/listbox.cc42
-rw-r--r--client/widgets/listbox.h1
-rw-r--r--client/widgets/pushbutton.cc2
-rw-r--r--client/widgets/pushbutton.h2
4 files changed, 39 insertions, 8 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";
diff --git a/client/widgets/listbox.h b/client/widgets/listbox.h
index bf70420..30c4129 100644
--- a/client/widgets/listbox.h
+++ b/client/widgets/listbox.h
@@ -38,6 +38,7 @@ public:
ListBox(QDomNode);
public slots:
+ bool isValid();
QString getValue();
private:
diff --git a/client/widgets/pushbutton.cc b/client/widgets/pushbutton.cc
index 8d74e4e..26ae83c 100644
--- a/client/widgets/pushbutton.cc
+++ b/client/widgets/pushbutton.cc
@@ -92,6 +92,6 @@ void PushButton::cancel()
void PushButton::cont()
{
- emit act_continue();
+ emit act_continue(field);
printf("Emit: continue\n");
}
diff --git a/client/widgets/pushbutton.h b/client/widgets/pushbutton.h
index 663be79..4db5952 100644
--- a/client/widgets/pushbutton.h
+++ b/client/widgets/pushbutton.h
@@ -52,7 +52,7 @@ signals:
void act_commit();
void act_reset();
void act_cancel();
- void act_continue();
+ void act_continue(QString);
private: