latex中使用listings显示代码

\documentclass[12pt,a4paper]{article}
\usepackage{ctex}
\usepackage{listings}
\usepackage{xcolor}
\begin{document}
Qt中的等级观念

\lstset{language=c++,breaklines=true,numbers=left,xleftmargin=0em,xrightmargin=0em}
\begin{lstlisting}

/*!
\internal

File was visible before, but now should NOT be

*WARNING* this will change the visible count
*/
void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int vLocation)
{
Q_Q(QFileSystemModel);
if (vLocation == -1)
return;
QModelIndex parent = index(parentNode);
bool indexHidden = isHiddenByFilter(parentNode, parent);
if (!indexHidden)
q->beginRemoveRows(parent, translateVisibleLocation(parentNode, vLocation), translateVisibleLocation(parentNode, vLocation));
parentNode->children.value(parentNode->visibleChildren.at(vLocation))->isVisible = false;
parentNode->visibleChildren.removeAt(vLocation);
if (!indexHidden)
q->endRemoveRows();
}

 

  


\end{lstlisting}

\end{document}

转载于:https://www.cnblogs.com/microthink/p/9532717.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值