Back to index

Public Slots | Public Member Functions | Private Attributes
QTMCommand Class Reference

Handles TeXmacs commands in the QT way. More...

#include <QTMMenuHelper.hpp>

Collaboration diagram for QTMCommand:
Collaboration graph

List of all members.

Public Slots

void apply ()
 Queues the object's command into the main queue.

Public Member Functions

 QTMCommand (command _cmd)

Private Attributes

command cmd

Detailed Description

Handles TeXmacs commands in the QT way.

Most TeXmacs widgets accept one command_rep as an argument. This is a scheme closure which will usually be executed when the widget is closed, in the case of dialogs, or activated in the case of checkboxes, combo boxes, etc. This means connecting them to signals emmitted by our QWidgets and that's the purpose of this wrapping class. Furthermore, this commands must be processed in a separate queue. The slot apply() takes care of that.

To use this class, one typically takes some given command "cmd" and does the following:

QTMCommand* qtmcmd = new QTMCommand(cmd); theQWidget->setParent(qtmcmd); QObject::connect(theQWidget, SIGNAL(somethingHappened()), qtmcmd, SLOT(apply()));

Since the slot in this class accepts no arguments, commands which require access to the QWidget must be subclassed from command_rep to accept the particular QWidget as a parameter. Then their invocation (which apply() will call) must access it.

An alternative would be to subclass QTMCommand to add slots accepting arguments but making sure that the underlying command_rep is properly sent to the mentioned queue.

Definition at line 54 of file QTMMenuHelper.hpp.

Constructor & Destructor Documentation

QTMCommand::QTMCommand ( command  _cmd) [inline]

Definition at line 59 of file QTMMenuHelper.hpp.

    cmd (_cmd) {  }

Member Function Documentation

void QTMCommand::apply ( ) [slot]

Queues the object's command into the main queue.

Definition at line 24 of file QTMMenuHelper.cpp.

  if (!is_nil(cmd)) { the_gui->process_command(cmd); }

Here is the call graph for this function:

Member Data Documentation

Definition at line 56 of file QTMMenuHelper.hpp.

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