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}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM