File indexing completed on 2024-05-12 15:27:01

0001 /***************************************************************************
0002     File                 : SignallingUndoCommand.h
0003     Project              : SciDAVis / LabPlot
0004     --------------------------------------------------------------------
0005     Copyright            : (C) 2010 Knut Franke
0006     Email (use @ for *)  : Knut.Franke*gmx.net
0007     Description          : An undo command calling a method/signal/slot on a
0008                            QObject on redo/undo.
0009 
0010  ***************************************************************************/
0011 
0012 /***************************************************************************
0013  *                                                                         *
0014  *  This program is free software; you can redistribute it and/or modify   *
0015  *  it under the terms of the GNU General Public License as published by   *
0016  *  the Free Software Foundation; either version 2 of the License, or      *
0017  *  (at your option) any later version.                                    *
0018  *                                                                         *
0019  *  This program is distributed in the hope that it will be useful,        *
0020  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
0021  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
0022  *  GNU General Public License for more details.                           *
0023  *                                                                         *
0024  *   You should have received a copy of the GNU General Public License     *
0025  *   along with this program; if not, write to the Free Software           *
0026  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
0027  *   Boston, MA  02110-1301  USA                                           *
0028  *                                                                         *
0029  ***************************************************************************/
0030 
0031 #ifndef SIGNALLING_UNDO_COMMAND_H
0032 #define SIGNALLING_UNDO_COMMAND_H
0033 
0034 #include <QUndoCommand>
0035 #include <QByteArray>
0036 
0037 class SignallingUndoCommand : public QUndoCommand {
0038 public:
0039     SignallingUndoCommand(const QString &text, QObject* receiver, const char* redoMethod, const char* undoMethod,
0040             QGenericArgument val0 = QGenericArgument(), QGenericArgument val1 = QGenericArgument(),
0041             QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument());
0042     ~SignallingUndoCommand() override;
0043 
0044     void redo() override;
0045     void undo() override;
0046 
0047 private:
0048     QGenericArgument arg(int index);
0049     QByteArray m_redo, m_undo;
0050     QObject* m_receiver;
0051     int m_argument_count;
0052     int* m_argument_types;
0053     void** m_argument_data;
0054 };
0055 
0056 #endif // ifndef SIGNALLING_UNDO_COMMAND_H