Hi all,
I have a layout with multiple widget on a widget, it's a path bar like windows explorer.
When I change folder, I change the layout with the new path who is a layout of button.
The problem is I have bad result when I change folder, it's like a reresh problem, I have the old text on the new text.
Thanks for the helpQt Code:
void CContentBrowserPathWidget::UpdatePath() { // Get the layout and delete if not NULL. if( m_Layout != NULL ) delete m_Layout; // Create the layout. m_Layout->setSpacing( 0 ); m_Layout->setMargin( 0 ); setLayout( m_Layout ); // Cast the model. QFileSystemModel* Model = static_cast< QFileSystemModel* >( m_TreeView->model() ); // Get the root path. // Add the root. m_Layout->addWidget( new CPathButton( "" ) ); // Check if the current index is invalid. if( m_TreeView->currentIndex().isValid() == false ) return; // Get the current path. // Check if the current path is different than the root. if( CurrentPath != RootPath ) { QString RightPath = CurrentPath; RightPath.remove( RootPath + '/' ); for( int i = 0; i < FolderList.size(); ++i ) m_Layout->addWidget( new CPathButton( FolderList[ i ] ) ); } }To copy to clipboard, switch view to plain text mode
Bookmarks