Commit 9db688c8 authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Fixed CoWowListWidget.

parent 0ff83e88
...@@ -205,26 +205,22 @@ void CoWowListWidgetQt::list_row_activated_cb(QTreeWidgetItem* item, int i) ...@@ -205,26 +205,22 @@ void CoWowListWidgetQt::list_row_activated_cb(QTreeWidgetItem* item, int i)
void CoWowListWidgetQt::list_apply_cb() void CoWowListWidgetQt::list_apply_cb()
{ {
button_pressed = 0;
QString selected_text;
QList<QTreeWidgetItem*> selected_items = list->selectedItems(); QList<QTreeWidgetItem*> selected_items = list->selectedItems();
if (selected_items.size() > 0) { if (selected_items.size() > 0 && action_cb) {
QTreeWidgetItem* item = selected_items[0]; if (button_pressed == -1)
selected_text = item->text(0); button_pressed = 0;
action_cb(parent_ctx, qPrintableLatin1(selected_items[0]->text(0)),
button_pressed);
} }
if (action_cb) {
(action_cb)(parent_ctx, qPrintableLatin1(selected_text), button_pressed);
}
close();
} }
void CoWowListWidgetQt::list_ok_cb() void CoWowListWidgetQt::list_ok_cb()
{ {
button_pressed = 1; if (list->selectedItems().size() > 0) {
list_apply_cb(); button_pressed = 1;
close(); list_apply_cb();
close();
}
} }
CoWowListWidgetQt::CoWowListWidgetQt(QWidget* parent, const char* title, CoWowListWidgetQt::CoWowListWidgetQt(QWidget* parent, const char* title,
...@@ -298,15 +294,13 @@ void* CoWowQt::CreateList(const char* title, const char* texts, int textsize, ...@@ -298,15 +294,13 @@ void* CoWowQt::CreateList(const char* title, const char* texts, int textsize,
void(action_cb)(void*, char*, int), void(cancel_cb)(void*), void(action_cb)(void*, char*, int), void(cancel_cb)(void*),
void* parent_ctx, int show_apply_button) void* parent_ctx, int show_apply_button)
{ {
CoWowListWidgetQt* tree = new CoWowListWidgetQt(object->parent_wid, title, return new CoWowListWidgetQt(object->parent_wid, title, texts, textsize,
texts, textsize, action_cb, cancel_cb, parent_ctx, show_apply_button); action_cb, cancel_cb, parent_ctx, show_apply_button);
return tree;
} }
void CoWowQt::PopList(void* data) void CoWowQt::PopList(void* data)
{ {
CoWowListWidgetQt* ctx = (CoWowListWidgetQt*)data; pop((CoWowListWidgetQt*)data);
pop(ctx);
} }
void CoWowWarrantQt::reject() void CoWowWarrantQt::reject()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment