本文整理汇总了C++中Exception::getExceptionsText方法的典型用法代码示例。如果您正苦于以下问题:C++ Exception::getExceptionsText方法的具体用法?C++ Exception::getExceptionsText怎么用?C++ Exception::getExceptionsText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exception
的用法示例。
在下文中一共展示了Exception::getExceptionsText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: show
void MessageBox::show(Exception e, const QString &msg, unsigned icon_type)
{
deque<Exception> list;
deque<Exception>::reverse_iterator itr,itr_end;
QTreeWidgetItem *item=NULL,*item1=NULL,*item2=NULL;
QLabel *label=NULL;
int idx=0;
Exception *ex=NULL;
QString str_aux, title;
QFont font=this->font();
show_errors_txt_tb->blockSignals(true);
show_errors_txt_tb->setChecked(false);
show_errors_txt_tb->blockSignals(false);
exceptions_txt->setPlainText(e.getExceptionsText());
e.getExceptionsList(list);
itr=list.rbegin();
itr_end=list.rend();
while(itr!=itr_end)
{
ex=&(*itr);
item=new QTreeWidgetItem;
str_aux=QString("[%1] - %2")
.arg(idx)
.arg(ex->getMethod());
item->setIcon(0,QPixmap(QString(":/icones/icones/funcao.png")));
exceptions_trw->insertTopLevelItem(0,item);
label=new QLabel;
label->setFont(font);
label->setWordWrap(true);
label->setText(str_aux);
exceptions_trw->setItemWidget(item, 0, label);
item1=new QTreeWidgetItem(item);
item1->setIcon(0,QPixmap(QString(":/icones/icones/codigofonte.png")));
item1->setText(0,ex->getFile() + " (" + ex->getLine() + ")");
item2=new QTreeWidgetItem(item);
item2->setIcon(0,QPixmap(QString(":/icones/icones/msgbox_alerta.png")));
item2->setText(0,Exception::getErrorCode(ex->getErrorType()) +
" (" + QString("%1").arg(ex->getErrorType()) + ")");
item1=new QTreeWidgetItem(item);
item1->setIcon(0,QPixmap(":/icones/icones/msgbox_erro.png"));
label=new QLabel;
label->setWordWrap(true);
label->setFont(font);
label->setStyleSheet("color: #ff0000;");
exceptions_trw->setItemWidget(item1, 0, label);
label->setText(ex->getErrorMessage());
if(!ex->getExtraInfo().isEmpty())
{
item1=new QTreeWidgetItem(item);
item1->setIcon(0,QPixmap(QString(":/icones/icones/msgbox_info.png")));
label=new QLabel;
label->setWordWrap(true);
label->setFont(font);
label->setStyleSheet("color: #000080;");
exceptions_trw->setItemWidget(item1, 0, label);
label->setText(ex->getExtraInfo());
}
itr++;
idx++;
}
switch(icon_type)
{
case ERROR_ICON:
title=trUtf8("Error");
break;
case ALERT_ICON:
title=trUtf8("Alert");
break;
case INFO_ICON:
title=trUtf8("Information");
break;
default:
title="";
break;
}
if(msg.isEmpty())
str_aux=e.getErrorMessage();
else
str_aux=msg;
this->show(title,str_aux,icon_type,OK_BUTTON);
}
示例2: show
void Messagebox::show(Exception e, const QString &msg, unsigned icon_type, unsigned buttons, const QString &yes_lbl, const QString &no_lbl, const QString &cancel_lbl,
const QString &yes_ico, const QString &no_ico, const QString &cancel_ico)
{
vector<Exception> list;
vector<Exception>::reverse_iterator itr,itr_end;
QTreeWidgetItem *item=nullptr,*item1=nullptr,*item2=nullptr;
QLabel *label=nullptr;
int idx=0;
Exception *ex=nullptr;
QString str_aux, title;
QFont font=this->font();
show_raw_info_tb->blockSignals(true);
show_raw_info_tb->setChecked(false);
show_raw_info_tb->blockSignals(false);
raw_info_txt->setPlainText(e.getExceptionsText());
e.getExceptionsList(list);
itr=list.rbegin();
itr_end=list.rend();
while(itr!=itr_end)
{
ex=&(*itr);
item=new QTreeWidgetItem;
str_aux=QString("[%1] - %2")
.arg(idx)
.arg(ex->getMethod());
item->setIcon(0,QPixmap(QString(":/icones/icones/funcao.png")));
exceptions_trw->insertTopLevelItem(0,item);
label=new QLabel;
label->setFont(font);
label->setWordWrap(true);
label->setText(str_aux);
exceptions_trw->setItemWidget(item, 0, label);
item1=new QTreeWidgetItem(item);
item1->setIcon(0,QPixmap(QString(":/icones/icones/codigofonte.png")));
item1->setText(0,ex->getFile() + " (" + ex->getLine() + ")");
item2=new QTreeWidgetItem(item);
item2->setIcon(0,QPixmap(QString(":/icones/icones/msgbox_alerta.png")));
item2->setText(0,Exception::getErrorCode(ex->getErrorType()) +
" (" + QString("%1").arg(ex->getErrorType()) + ")");
item1=new QTreeWidgetItem(item);
item1->setIcon(0,QPixmap(":/icones/icones/msgbox_erro.png"));
label=new QLabel;
label->setWordWrap(true);
label->setFont(font);
label->setStyleSheet("color: #ff0000;");
exceptions_trw->setItemWidget(item1, 0, label);
label->setText(ex->getErrorMessage());
if(!ex->getExtraInfo().isEmpty())
{
item1=new QTreeWidgetItem(item);
item1->setIcon(0,QPixmap(QString(":/icones/icones/msgbox_info.png")));
label=new QLabel;
label->setWordWrap(true);
label->setFont(font);
label->setStyleSheet("color: #000080;");
label->setTextInteractionFlags(Qt::TextSelectableByMouse);
exceptions_trw->setItemWidget(item1, 0, label);
label->setText(ex->getExtraInfo());
}
itr++;
idx++;
}
switch(icon_type)
{
case ERROR_ICON:
title=trUtf8("Error");
break;
case ALERT_ICON:
title=trUtf8("Alert");
break;
case INFO_ICON:
title=trUtf8("Information");
break;
default:
title="";
break;
}
if(msg.isEmpty())
str_aux=e.getErrorMessage();
else
str_aux=msg;
if(str_aux.contains("`") && str_aux.contains("'"))
{
//.........这里部分代码省略.........