Back to index

Public Member Functions | Public Attributes | Private Attributes
qt_choice_command_rep Class Reference

Ad-hoc command to be used with choice widgets. More...

Inheritance diagram for qt_choice_command_rep:
Inheritance graph
Collaboration diagram for qt_choice_command_rep:
Collaboration graph

List of all members.

Public Member Functions

 qt_choice_command_rep (QListWidget *w, command c, bool m)
void apply ()
tm_ostreamprint (tm_ostream &out)
virtual void apply (object args)

Public Attributes

int ref_count

Private Attributes

QPointer< QListWidget > qwid
command cmd
bool multiple

Detailed Description

Ad-hoc command to be used with choice widgets.

The command associated with a qt_ui_element::choice_widget has one parameter. (a list of selected items). For the reason to be of this class, see

See also:
qt_ui_element, , qt_ui_element_rep::as_qwidget, qt_ui_element_rep::choice_widget

Definition at line 935 of file qt_ui_element.cpp.

Constructor & Destructor Documentation

qt_choice_command_rep::qt_choice_command_rep ( QListWidget *  w,
command  c,
bool  m 
) [inline]

Definition at line 941 of file qt_ui_element.cpp.

: qwid(w), cmd(c), multiple(m) {}

Member Function Documentation

void command_rep::apply ( object  args) [virtual, inherited]

Reimplemented in object_command_rep.

Definition at line 20 of file command.cpp.

  (void) args;
  apply ();

Here is the call graph for this function:

void qt_choice_command_rep::apply ( ) [inline, virtual]

Implements command_rep.

Definition at line 942 of file qt_ui_element.cpp.

    if (qwid) {
      QList<QListWidgetItem*> items = qwid->selectedItems();
      array<string> selected;
      for(int i = 0; i < items.size(); ++i)
        selected << from_qstring (items[i]->text());
      object l= null_object ();
        for (int i = N(selected)-1; i >= 0; --i)
          l= cons (selected[i], l);
      else if(N(selected)>0)  //Do not return a list with the item if only one
        l= selected[0];
      cmd (list_object (l));

Here is the call graph for this function:

tm_ostream& qt_choice_command_rep::print ( tm_ostream out) [inline, virtual]

Reimplemented from command_rep.

Definition at line 957 of file qt_ui_element.cpp.

{ return out << "Choice"; }

Member Data Documentation

Definition at line 937 of file qt_ui_element.cpp.

Definition at line 938 of file qt_ui_element.cpp.

QPointer<QListWidget> qt_choice_command_rep::qwid [private]

Definition at line 936 of file qt_ui_element.cpp.

int abstract_struct::ref_count [inherited]

Definition at line 142 of file basic.hpp.

The documentation for this class was generated from the following file: