Advertisement
Guest User

Untitled

a guest
Jun 28th, 2013
537
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef QPCONSOLE_H
  2. #define QPCONSOLE_H
  3.  
  4. #include <QPlainTextEdit>
  5.  
  6. class QPConsole : public QPlainTextEdit
  7. {
  8.   Q_OBJECT
  9. public:
  10.   explicit QPConsole(QWidget *parent = 0);
  11.   void setPrefix(const QString &prefix);
  12.   void setPrefixColor(const QColor &color);
  13.   void setPrefixFont(const QFont &font);
  14.   QString prefix() const { return mPrefix; }
  15.   QColor prefixColor() const { return mPrefixColor; }
  16.   QFont prefixFont() const { return mPrefixFont; }
  17.  
  18. signals:
  19.   void command(QString cmd, QStringList params);
  20.  
  21. public slots:
  22.   void print(QString str);
  23.   void prepareCommandLine();
  24.  
  25. protected:
  26.   bool inCommandLine() const;
  27.   void processCommand();
  28.   QStringList getParams(QString str);
  29.   virtual void keyPressEvent(QKeyEvent *event);
  30.  
  31.   int mHistoryPos;
  32.   QStringList mHistory;
  33.   QString mPrefix;
  34.   QColor mPrefixColor;
  35.   QFont mPrefixFont;
  36.   bool mCommandLineReady;
  37. };
  38.  
  39. #endif // QPCONSOLE_H
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement