2022-08-25 18:37:24 +08:00
# include " progpanel.h "
# include "globaldefine.h"
# include "player/playwin.h"
# include "tipdialog.h"
# include <QApplication>
# include <QHeaderView>
# include <QMessageBox>
# include <QSettings>
2022-09-30 18:08:39 +08:00
ProgPanel : : ProgPanel ( QSettings & settings , QWidget * parent ) : QWidget ( parent ) {
2022-08-25 18:37:24 +08:00
setAttribute ( Qt : : WA_DeleteOnClose ) ;
setAutoFillBackground ( true ) ;
QPalette pal ;
pal . setBrush ( QPalette : : Window , QColor ( 0xeeeeee ) ) ;
setPalette ( pal ) ;
auto vBox = new QVBoxLayout ( this ) ;
vBox - > setContentsMargins ( 0 , 0 , 0 , 0 ) ;
vBox - > setSpacing ( 0 ) ;
auto hBox = new QHBoxLayout ( ) ;
hBox - > setContentsMargins ( 6 , 6 , 6 , 6 ) ;
hBox - > setSpacing ( 6 ) ;
vBox - > addLayout ( hBox ) ;
bnNew = new QPushButton ( tr ( " New " ) ) ;
bnNew - > setFixedSize ( 88 , 38 ) ;
bnNew - > setProperty ( " ssType " , " progManageTool " ) ;
hBox - > addWidget ( bnNew ) ;
2022-09-30 18:08:39 +08:00
connect ( bnNew , & QPushButton : : clicked , this , [ this ] {
ProgCreateDlg dlg ( QDateTime : : currentDateTime ( ) . toString ( " yyyyMMddhhmmsszzz " ) , 512 , 512 , " " , this ) ;
if ( dlg . exec ( ) ! = QDialog : : Accepted ) return ;
if ( checkIfNameRepeated ( dlg . fdName - > text ( ) ) ) return ;
auto item = new ProgItem ( progDir , dlg . fdName - > text ( ) , dlg . fdWidth - > value ( ) , dlg . fdHeight - > value ( ) , dlg . fdRemark - > toPlainText ( ) , mProgTree , this ) ;
item - > save ( ) ; //保存pro.json
mProgTree - > adjustCheckState ( ) ;
item - > onEditProgram ( ) ;
} ) ;
2022-08-25 18:37:24 +08:00
bnEdit = new QPushButton ( tr ( " Edit " ) ) ;
bnEdit - > setFixedSize ( QSize ( 88 , 38 ) ) ;
bnEdit - > setProperty ( " ssType " , " progManageTool " ) ;
bnEdit - > setEnabled ( false ) ;
hBox - > addWidget ( bnEdit ) ;
connect ( bnEdit , SIGNAL ( clicked ( bool ) ) , this , SLOT ( onEditClicked ( bool ) ) ) ;
bnDelete = new QPushButton ( tr ( " Delete " ) ) ;
bnDelete - > setFixedSize ( QSize ( 88 , 38 ) ) ;
bnDelete - > setProperty ( " ssType " , " progManageTool " ) ;
bnDelete - > setEnabled ( false ) ;
hBox - > addWidget ( bnDelete ) ;
connect ( bnDelete , SIGNAL ( clicked ( bool ) ) , this , SLOT ( onDeleteClicked ( bool ) ) ) ;
bnImport = new QPushButton ( tr ( " Import " ) ) ;
bnImport - > setFixedSize ( QSize ( 88 , 38 ) ) ;
bnImport - > setProperty ( " ssType " , " progManageTool " ) ;
hBox - > addWidget ( bnImport ) ;
2022-09-30 18:08:39 +08:00
connect ( bnImport , & QPushButton : : clicked , this , [ this ] {
auto dlg = new TipDialog ( this , ENUM_IMPORT_DLG ) ;
connect ( dlg , SIGNAL ( sigAcceptData ( QString , QString ) ) , this , SLOT ( onImportProgram ( QString , QString ) ) ) ;
dlg - > exec ( ) ;
} ) ;
2022-08-25 18:37:24 +08:00
bnExport = new QPushButton ( tr ( " Export " ) ) ;
bnExport - > setFixedSize ( QSize ( 88 , 38 ) ) ;
bnExport - > setEnabled ( false ) ;
bnExport - > setProperty ( " ssType " , " progManageTool " ) ;
hBox - > addWidget ( bnExport ) ;
connect ( bnExport , SIGNAL ( clicked ( bool ) ) , this , SLOT ( onExportClicked ( bool ) ) ) ;
bnSend = new QPushButton ( tr ( " Send " ) ) ;
bnSend - > setFixedSize ( QSize ( 88 , 38 ) ) ;
bnSend - > setProperty ( " ssType " , " progManageTool " ) ;
bnSend - > setEnabled ( false ) ;
bnSend - > hide ( ) ;
hBox - > addWidget ( bnSend ) ;
btnPlay = new QPushButton ( tr ( " Play " ) + " / " + tr ( " Stop " ) ) ;
btnPlay - > setFixedSize ( QSize ( 88 , 38 ) ) ;
btnPlay - > setProperty ( " ssType " , " progManageTool " ) ;
hBox - > addWidget ( btnPlay ) ;
connect ( btnPlay , & QPushButton : : clicked , this , [ this ] ( ) {
if ( PlayWin : : self ! = nullptr ) PlayWin : : self - > close ( ) ;
else {
2022-09-30 18:08:39 +08:00
int cnt = mProgTree - > topLevelItemCount ( ) ;
for ( int i = 0 ; i < cnt ; i + + ) if ( mProgTree - > topLevelItem ( i ) - > checkState ( 0 ) = = Qt : : Checked ) {
auto item = static_cast < ProgItem * > ( mProgTree - > topLevelItem ( i ) ) ;
QString dir = progDir + " / " + item - > m_name + " _tmp " ;
2022-08-25 18:37:24 +08:00
QFile file ( dir + " /program " ) ;
if ( ! file . open ( QIODevice : : ReadOnly | QIODevice : : Text ) ) return ;
QString value = file . readAll ( ) ;
file . close ( ) ;
QJsonParseError jsErr ;
QJsonObject prog = QJsonDocument : : fromJson ( value . toUtf8 ( ) , & jsErr ) . object ( ) ;
if ( jsErr . error ) return ;
if ( PlayWin : : self ! = nullptr ) PlayWin : : self - > close ( ) ;
2022-09-30 18:08:39 +08:00
PlayWin : : self = PlayWin : : newIns ( item - > m_width , item - > m_height , dir , prog ) ;
2022-08-25 18:37:24 +08:00
break ;
}
}
} ) ;
hBox - > addStretch ( ) ;
auto txtSearch = new QLineEdit ( this ) ;
txtSearch - > setFixedSize ( QSize ( 240 , 36 ) ) ;
QAction * search = new QAction ( txtSearch ) ;
search - > setIcon ( QIcon ( " :/res/ProgramManager/bnSearch.png " ) ) ;
txtSearch - > addAction ( search , QLineEdit : : LeadingPosition ) ;
txtSearch - > setClearButtonEnabled ( true ) ;
txtSearch - > setStyleSheet ( " border: 2px solid #aaaaaa; " ) ;
hBox - > addWidget ( txtSearch ) ;
connect ( txtSearch , SIGNAL ( textChanged ( const QString & ) ) , this , SLOT ( FilterProgram ( const QString & ) ) ) ;
2022-09-30 18:08:39 +08:00
mProgTree = new LoQTreeWidget ( ) ;
mProgTree - > setIndentation ( 10 ) ;
mProgTree - > setSortingEnabled ( true ) ;
2022-08-25 18:37:24 +08:00
m_headerItem = new QTreeWidgetItem ( ) ;
for ( int i = 1 ; i < ENUM_PROGRAMLISTHEADERITEM_END ; i + + ) m_headerItem - > setTextAlignment ( i , Qt : : AlignCenter ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_CHECK , Qt : : DisplayRole , " " ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_NAME , Qt : : DisplayRole , tr ( " Name " ) ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_RESOLUTION , Qt : : DisplayRole , tr ( " Resolution " ) ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_SIZE , Qt : : DisplayRole , tr ( " File Size " ) ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_LASTTIME , Qt : : DisplayRole , tr ( " Last Modify " ) ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT , Qt : : DisplayRole , tr ( " Usb playback " ) ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_SEND , Qt : : DisplayRole , tr ( " Publish " ) ) ;
2022-09-30 18:08:39 +08:00
mProgTree - > setHeaderItem ( m_headerItem ) ;
mProgTree - > header ( ) - > setSectionResizeMode ( ENUM_PROGRAMLISTHEADERITEM_CHECK , QHeaderView : : Fixed ) ;
mProgTree - > header ( ) - > setSectionResizeMode ( ENUM_PROGRAMLISTHEADERITEM_NAME , QHeaderView : : Stretch ) ;
mProgTree - > header ( ) - > setSectionResizeMode ( ENUM_PROGRAMLISTHEADERITEM_RESOLUTION , QHeaderView : : Stretch ) ;
mProgTree - > header ( ) - > setSectionResizeMode ( ENUM_PROGRAMLISTHEADERITEM_SIZE , QHeaderView : : Stretch ) ;
mProgTree - > header ( ) - > setSectionResizeMode ( ENUM_PROGRAMLISTHEADERITEM_LASTTIME , QHeaderView : : Stretch ) ;
mProgTree - > header ( ) - > setSectionResizeMode ( ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT , QHeaderView : : Fixed ) ;
mProgTree - > header ( ) - > setSectionResizeMode ( ENUM_PROGRAMLISTHEADERITEM_SEND , QHeaderView : : Fixed ) ;
mProgTree - > header ( ) - > setStretchLastSection ( false ) ;
mProgTree - > setColumnWidth ( ENUM_PROGRAMLISTHEADERITEM_CHECK , 66 ) ;
mProgTree - > setColumnWidth ( ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT , 100 ) ;
mProgTree - > setColumnWidth ( ENUM_PROGRAMLISTHEADERITEM_SEND , 72 ) ;
vBox - > addWidget ( mProgTree ) ;
connect ( mProgTree , & LoQTreeWidget : : sigCheckStateChanged , this , [ this ] ( int f ) {
2022-08-25 18:37:24 +08:00
switch ( f ) {
case LoQTreeWidget : : CheckNone :
bnEdit - > setEnabled ( false ) ;
bnDelete - > setEnabled ( false ) ;
bnExport - > setEnabled ( false ) ;
bnSend - > setEnabled ( false ) ;
break ;
case LoQTreeWidget : : CheckOne :
bnEdit - > setEnabled ( true ) ;
bnDelete - > setEnabled ( true ) ;
bnExport - > setEnabled ( true ) ;
bnSend - > setEnabled ( true ) ;
break ;
case LoQTreeWidget : : CheckMulti :
bnEdit - > setEnabled ( false ) ;
bnDelete - > setEnabled ( true ) ;
bnExport - > setEnabled ( true ) ;
bnSend - > setEnabled ( true ) ;
break ;
default : break ;
}
} ) ;
QString doc_path = QStandardPaths : : writableLocation ( QStandardPaths : : DocumentsLocation ) ;
if ( ! doc_path . isEmpty ( ) ) {
QString app_path = doc_path + " / " + QApplication : : applicationName ( ) ;
progDir = app_path + " /NPrograms " ;
if ( ! QFileInfo : : exists ( progDir ) ) {
QDir app_dir ( app_path ) ;
app_dir . mkdir ( " NPrograms " ) ;
app_dir . mkdir ( " ApkStore " ) ;
}
}
//connect(search, SIGNAL(triggered(bool)), this, SLOT(FilterProgram()));
//查找根路径下的项目文件夹, 查找文件夹下的节目pro.json信息, 包括节目名称, 大小, 像素, 备注等信息
if ( ! progDir . isEmpty ( ) ) {
QDir root_dir ( progDir ) ;
QStringList pro_list = root_dir . entryList ( QDir : : Dirs | QDir : : NoDotAndDotDot | QDir : : NoSymLinks ) ;
foreach ( QString pro_name , pro_list ) {
QDir pro_dir ( progDir + " / " + pro_name ) ;
if ( pro_dir . exists ( " pro.json " ) ) {
QFile fPro ( pro_dir . path ( ) + " /pro.json " ) ;
fPro . open ( QIODevice : : ReadOnly ) ;
QJsonDocument pro = QJsonDocument : : fromJson ( fPro . readAll ( ) ) ;
fPro . close ( ) ;
2022-09-30 18:08:39 +08:00
m_pwPorgramItemList . append ( new ProgItem ( progDir , pro . object ( ) , mProgTree , this ) ) ;
2022-08-25 18:37:24 +08:00
}
}
}
2022-09-30 18:08:39 +08:00
if ( settings . value ( " ProgramListSortOrder " ) . toInt ( ) = = 0 ) mProgTree - > sortByColumn ( settings . value ( " ProgramListSortColumn " ) . toInt ( ) , Qt : : SortOrder : : AscendingOrder ) ;
else mProgTree - > sortByColumn ( settings . value ( " ProgramListSortColumn " ) . toInt ( ) , Qt : : SortOrder : : DescendingOrder ) ;
2022-08-25 18:37:24 +08:00
// ui->wProgramList->setSortingEnabled( false ); //不使能QT的自动排序
// ui->wProgramList->header()->setSortIndicatorShown( true ); // 设置三角标识符可见
// ui->wProgramList->header()->setSectionsClickable( true ); // 设置标题栏单击响应使能
// connect( ui->wProgramList->header(), SIGNAL( sectionClicked(int) ), this, SLOT( OnClickColumn(int) ) );
}
void ProgPanel : : OnClickColumn ( int iColumn ) {
2022-09-30 18:08:39 +08:00
if ( iColumn ! = ENUM_PROGRAMLISTHEADERITEM_CHECK & & iColumn ! = ENUM_PROGRAMLISTHEADERITEM_SEND ) mProgTree - > sortByColumn ( iColumn , mProgTree - > header ( ) - > sortIndicatorOrder ( ) ) ;
2022-08-25 18:37:24 +08:00
}
void ProgPanel : : changeEvent ( QEvent * event ) {
QWidget : : changeEvent ( event ) ;
if ( event - > type ( ) = = QEvent : : LanguageChange ) transUi ( ) ;
}
void ProgPanel : : transUi ( ) {
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_CHECK , 0 , " " ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_NAME , 0 , tr ( " Name " ) ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_RESOLUTION , 0 , tr ( " Resolution " ) ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_SIZE , 0 , tr ( " File Size " ) ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_LASTTIME , 0 , tr ( " Last Modify " ) ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT , 0 , tr ( " Usb playback " ) ) ;
m_headerItem - > setData ( ENUM_PROGRAMLISTHEADERITEM_SEND , 0 , tr ( " Publish " ) ) ;
bnNew - > setText ( tr ( " New " ) ) ;
bnEdit - > setText ( tr ( " Edit " ) ) ;
bnDelete - > setText ( tr ( " Delete " ) ) ;
bnImport - > setText ( tr ( " Import " ) ) ;
bnExport - > setText ( tr ( " Export " ) ) ;
bnSend - > setText ( tr ( " Send " ) ) ;
btnPlay - > setText ( tr ( " Play " ) + " / " + tr ( " Stop " ) ) ;
for ( int i = 0 ; i < m_pwPorgramItemList . count ( ) ; i + + ) m_pwPorgramItemList . at ( i ) - > refreshLable ( ) ;
}
void ProgPanel : : onEditClicked ( bool ) {
2022-09-30 18:08:39 +08:00
int cnt = mProgTree - > topLevelItemCount ( ) ;
2022-08-25 18:37:24 +08:00
for ( int i = 0 ; i < cnt ; i + + ) {
2022-09-30 18:08:39 +08:00
if ( mProgTree - > topLevelItem ( i ) - > checkState ( 0 ) = = Qt : : Checked ) {
auto item = static_cast < ProgItem * > ( mProgTree - > topLevelItem ( i ) ) ;
item - > onEditProgram ( ) ;
2022-08-25 18:37:24 +08:00
break ;
}
}
}
bool ProgPanel : : checkIfNameRepeated ( const QString & name , QTreeWidgetItem * skip ) {
2022-09-30 18:08:39 +08:00
int cnt = mProgTree - > topLevelItemCount ( ) ;
2022-08-25 18:37:24 +08:00
for ( int i = 0 ; i < cnt ; i + + ) {
2022-09-30 18:08:39 +08:00
auto item = static_cast < ProgItem * > ( mProgTree - > topLevelItem ( i ) ) ;
2022-08-25 18:37:24 +08:00
if ( item = = skip ) continue ;
2022-09-30 18:08:39 +08:00
if ( name = = item - > m_name ) {
2022-08-25 18:37:24 +08:00
QMessageBox : : warning ( this , tr ( " Warning " ) , tr ( " Program name conflicted " ) ) ;
return true ;
}
}
return false ;
}
void ProgPanel : : onCreateNewProgramOnOpenEditProgramWidget ( QString name , QSize res , QString remarks )
{
if ( checkIfNameRepeated ( name ) ) return ;
2022-09-30 18:08:39 +08:00
auto item = new ProgItem ( progDir , name , res . width ( ) , res . height ( ) , remarks , mProgTree , this ) ;
2022-08-25 18:37:24 +08:00
item - > save ( ) ; //保存pro.json
2022-09-30 18:08:39 +08:00
mProgTree - > adjustCheckState ( ) ;
item - > onEditProgram ( ) ;
2022-08-25 18:37:24 +08:00
}
void ProgPanel : : onDeleteClicked ( bool ) {
auto res = QMessageBox : : information ( this , tr ( " Tip Info " ) , tr ( " You will delete the selected solution(s),are you sure? " ) , QMessageBox : : Ok , QMessageBox : : Cancel ) ;
if ( res = = QMessageBox : : Ok ) {
2022-09-30 18:08:39 +08:00
int cnt = mProgTree - > topLevelItemCount ( ) ;
QList < ProgItem * > list ;
2022-08-25 18:37:24 +08:00
for ( int i = 0 ; i < cnt ; i + + ) {
2022-09-30 18:08:39 +08:00
if ( mProgTree - > topLevelItem ( i ) - > checkState ( 0 ) = = Qt : : Checked ) {
auto item = static_cast < ProgItem * > ( mProgTree - > topLevelItem ( i ) ) ;
2022-08-25 18:37:24 +08:00
list . push_back ( item ) ;
}
}
while ( ! list . isEmpty ( ) ) {
2022-09-30 18:08:39 +08:00
auto item = list . takeFirst ( ) ;
2022-08-25 18:37:24 +08:00
item - > del ( ) ;
delete item ;
}
2022-09-30 18:08:39 +08:00
mProgTree - > adjustCheckState ( ) ;
2022-08-25 18:37:24 +08:00
}
}
void ProgPanel : : onImportProgram ( QString strImportDir , QString ) {
if ( ! strImportDir . isEmpty ( ) ) {
2022-09-30 18:08:39 +08:00
mProgTree - > clear ( ) ;
2022-08-25 18:37:24 +08:00
//查找根路径下的项目文件夹, 查找文件夹下的节目pro.json信息, 包括节目名称, 大小, 像素, 备注等信息
if ( ! progDir . isEmpty ( ) ) {
QDir root_dir ( progDir ) ;
QStringList pro_list = root_dir . entryList ( QDir : : Dirs | QDir : : NoDotAndDotDot | QDir : : NoSymLinks ) ;
foreach ( QString pro_name , pro_list ) {
QDir pro_dir ( progDir + MACRO_FENGEFU + pro_name ) ;
if ( pro_dir . exists ( " pro.json " ) ) {
QFile fPro ( pro_dir . path ( ) + MACRO_FENGEFU + " pro.json " ) ;
fPro . open ( QIODevice : : ReadOnly ) ;
QJsonDocument pro = QJsonDocument : : fromJson ( fPro . readAll ( ) ) ;
fPro . close ( ) ;
2022-09-30 18:08:39 +08:00
m_pwPorgramItemList . append ( new ProgItem ( progDir , pro . object ( ) , mProgTree , this ) ) ;
2022-08-25 18:37:24 +08:00
}
}
}
}
}
void ProgPanel : : onExportClicked ( bool ) {
2022-09-30 18:08:39 +08:00
int cnt = mProgTree - > topLevelItemCount ( ) ;
2022-08-25 18:37:24 +08:00
QStringList selectProgramlist ;
for ( int i = 0 ; i < cnt ; i + + ) {
2022-09-30 18:08:39 +08:00
if ( mProgTree - > topLevelItem ( i ) - > checkState ( 0 ) = = Qt : : Checked ) {
QString string = static_cast < ProgItem * > ( mProgTree - > topLevelItem ( i ) ) - > m_bnName - > text ( ) ;
2022-08-25 18:37:24 +08:00
selectProgramlist . append ( string ) ;
}
}
TipDialog * dlg = new TipDialog ( this , ENUM_EXPORT_DLG , & selectProgramlist , 0 ) ;
dlg - > exec ( ) ;
}
void ProgPanel : : FilterProgram ( const QString & strtemp ) {
if ( strtemp . isEmpty ( ) ) //显示全部
{
2022-09-30 18:08:39 +08:00
for ( int i = 0 ; i < mProgTree - > topLevelItemCount ( ) ; + + i )
2022-08-25 18:37:24 +08:00
{
2022-09-30 18:08:39 +08:00
QTreeWidgetItem * topItem = mProgTree - > topLevelItem ( i ) ;
mProgTree - > setRowHidden ( i , mProgTree - > indexFromItem ( topItem - > parent ( ) ) , false ) ;
2022-08-25 18:37:24 +08:00
}
}
else
{
2022-09-30 18:08:39 +08:00
QList < QTreeWidgetItem * > resultList = mProgTree - > findItems ( strtemp , Qt : : MatchContains , ENUM_PROGRAMLISTHEADERITEM_NAME ) ; //搜索结果
2022-08-25 18:37:24 +08:00
if ( resultList . size ( ) > 0 )
{
2022-09-30 18:08:39 +08:00
for ( int i = 0 ; i < mProgTree - > topLevelItemCount ( ) ; + + i )
2022-08-25 18:37:24 +08:00
{
2022-09-30 18:08:39 +08:00
QTreeWidgetItem * topItem = mProgTree - > topLevelItem ( i ) ;
2022-08-25 18:37:24 +08:00
if ( resultList . contains ( topItem ) )
2022-09-30 18:08:39 +08:00
mProgTree - > setRowHidden ( i , mProgTree - > indexFromItem ( topItem - > parent ( ) ) , false ) ; //显示匹配的结果
2022-08-25 18:37:24 +08:00
else
2022-09-30 18:08:39 +08:00
mProgTree - > setRowHidden ( i , mProgTree - > indexFromItem ( topItem - > parent ( ) ) , true ) ; //隐藏不匹配的结果
2022-08-25 18:37:24 +08:00
}
}
else {
2022-09-30 18:08:39 +08:00
QList < QTreeWidgetItem * > resultList1 = mProgTree - > findItems ( strtemp , Qt : : MatchContains , ENUM_PROGRAMLISTHEADERITEM_RESOLUTION ) ; //搜索结果
2022-08-25 18:37:24 +08:00
if ( resultList1 . size ( ) > 0 ) {
2022-09-30 18:08:39 +08:00
for ( int i = 0 ; i < mProgTree - > topLevelItemCount ( ) ; + + i ) {
QTreeWidgetItem * topItem = mProgTree - > topLevelItem ( i ) ;
if ( resultList1 . contains ( topItem ) ) mProgTree - > setRowHidden ( i , mProgTree - > indexFromItem ( topItem - > parent ( ) ) , false ) ; //显示匹配的结果
else mProgTree - > setRowHidden ( i , mProgTree - > indexFromItem ( topItem - > parent ( ) ) , true ) ; //隐藏不匹配的结果
2022-08-25 18:37:24 +08:00
}
}
else {
2022-09-30 18:08:39 +08:00
for ( int i = 0 ; i < mProgTree - > topLevelItemCount ( ) ; + + i ) {
QTreeWidgetItem * topItem = mProgTree - > topLevelItem ( i ) ;
mProgTree - > setRowHidden ( i , mProgTree - > indexFromItem ( topItem - > parent ( ) ) , true ) ; //隐藏不匹配的结果
2022-08-25 18:37:24 +08:00
}
}
}
}
}