00001 00022 #include "DGVConsole.h" 00023 00024 DGVConsole::DGVConsole(QWidget *parent) : QDockWidget(parent) 00025 { 00026 listDisplay = new QListWidget(this); 00027 00028 setWidget(listDisplay); 00029 00030 createConnections(); 00031 } 00032 00033 DGVConsole::~DGVConsole() 00034 { 00035 //dtor 00036 } 00037 00038 void DGVConsole::printError(QString error) 00039 { 00040 QListWidgetItem *newItem = new QListWidgetItem(listDisplay); 00041 QBrush brush; 00042 00043 newItem->setText(error); 00044 brush.setColor(Qt::darkRed); 00045 newItem->setForeground(brush); 00046 listDisplay->addItem(newItem); 00047 qApp->processEvents(); 00048 00049 emit consoleChanged(); 00050 } 00051 00052 void DGVConsole::printWarning(QString warning) 00053 { 00054 QListWidgetItem *newItem = new QListWidgetItem(listDisplay); 00055 QBrush brush; 00056 00057 newItem->setText(warning); 00058 brush.setColor(Qt::darkBlue); 00059 newItem->setForeground(brush); 00060 listDisplay->addItem(newItem); 00061 qApp->processEvents(); 00062 00063 emit consoleChanged(); 00064 } 00065 00066 void DGVConsole::printInfo(QString info) 00067 { 00068 listDisplay->addItem(info); 00069 qApp->processEvents(); 00070 00071 emit consoleChanged(); 00072 } 00073 00074 void DGVConsole::printMessage(QString msg) 00075 { 00076 QListWidgetItem *newItem = new QListWidgetItem(listDisplay); 00077 QBrush brush; 00078 00079 newItem->setText(msg); 00080 brush.setColor(Qt::darkGreen); 00081 newItem->setForeground(brush); 00082 listDisplay->addItem(newItem); 00083 qApp->processEvents(); 00084 00085 emit consoleChanged(); 00086 } 00087 00088 /*void DGVConsole::toFinalEntry() 00089 { 00090 setCurrentRow(count()-1); 00091 }*/ 00092 00093 void DGVConsole::createConnections() 00094 { 00095 connect(this, SIGNAL(consoleChanged()), this, SLOT(toFinalEntry())); 00096 }