⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 commands.h

📁 Qt4源代码,详细介绍了Qt4编程中的范例
💻 H
字号:
#ifndef COMMANDS_H
#define COMMANDS_H

#include <QUndoCommand>
#include <QTableWidget>
#include <QColor>
#include <QList>

class UndoWidget;

class TextColorCommand : public QUndoCommand
{
public:
	TextColorCommand(UndoWidget *undoWidget, QColor beforeColor, QColor afterColor, QUndoCommand *parent = 0);

    void undo();
    void redo();

private:
	QList<QTableWidgetItem*> affectedItems;
	QColor before;
	QColor after;
};

class BkgColorCommand : public QUndoCommand
{
public:
	BkgColorCommand(UndoWidget *undoWidget, QColor beforeColor, QColor afterColor, QUndoCommand *parent = 0);

    void undo();
    void redo();

private:
	QList<QTableWidgetItem*> affectedItems;
	QColor before;
	QColor after;
};

class FontCommand : public QUndoCommand
{
public:
	FontCommand(UndoWidget *undoWidget, QFont beforeFont, QFont afterFont, QUndoCommand *parent = 0);

    void undo();
    void redo();

private:
	QList<QTableWidgetItem*> affectedItems;
	QFont before;
	QFont after;
};

class EditCommand : public QUndoCommand
{
public:
	EditCommand(QTableWidgetItem *item, QString beforeText, QString afterText, QUndoCommand *parent = 0);

    void undo();
    void redo();

private:
	QTableWidgetItem* affectedItem;
	QString before;
	QString after;
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -