logwindow.h

来自「压缩包里有教材<<C++模式设计-基于QT4开源跨平台开发框架&gt」· C头文件 代码 · 共 64 行

H
64
字号
#ifndef LOGWINDOW_H#define LOGWINDOW_H#include <QTextEdit>/** An extended QTextEdit suitable for capturing log output.Each LogWindow is attached to a logger of the same name,and will monitor messages that go through the named Logger.Contains a smart scrollbar that won't keep scrolling if you are dragging it. This class adds an "append" slot to QTextEdit, which also sendsthe scrollbar down to the bottom.see class @ref Logger*/class LogWindow : public QTextEdit {    Q_OBJECT    public:        /**       Create a LogWindow (QTextEdit)        @param logname - the name of a logger instance to connect to.       if logname=="debug", then this window monitors qDebug() messages.          @see Logger       */    LogWindow( QString logName = "debug", QWidget* parent=0);        public slots:    /**      Start logging all messages that go through a particular      named logger.      @param logname - the name of a Logger instance to monitor         @see Logger     */             void log(QString logname);    /**    Extended from the base class to be a slot, and also to    perform some scrollbar maintenance.    */    void append(QString str);    /**    Check the position of the scrollbar - if it's at the bottom,    resume scrolling.    */    void checkScroll(int newValue);        private:        int shouldScroll;    };#endif        //  #ifndef LOGWINDOW_H

⌨️ 快捷键说明

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