// Constructor; // the first parameter is the book whose TOC // is being edited, the second is the dialog's parent HeadingSelector::HeadingSelector( QSharedPointer< Book > book, QWidget *parent ) : QDialog( parent ), m_Book( book ) { ui.setupUi( this ); ConnectSignalsToSlots(); ui.tvTOCDisplay->setModel( &m_TableOfContents ); LockHTMLResources(); QList< Headings::Heading > flat_headings = Headings::GetHeadingList( m_Book->GetFolderKeeper().GetResourceTypeList< HTMLResource >( true ), true ); m_Headings = Headings::MakeHeadingHeirarchy( flat_headings ); PopulateSelectHeadingCombo( GetMaxHeadingLevel( flat_headings ) ); CreateTOCModel(); // Set the initial display state if ( ui.cbTOCItemsOnly->checkState() == Qt::Checked ) RemoveExcludedItems( m_TableOfContents.invisibleRootItem() ); UpdateTreeViewDisplay(); ReadSettings(); }
// Constructor; // the first parameter is the book whose TOC // is being edited, the second is the dialog's parent HeadingSelector::HeadingSelector(QSharedPointer<Book> book, QWidget *parent) : QDialog(parent), m_Book(book), m_ContextMenu(new QMenu(this)), m_book_changed(false) { ui.setupUi(this); ui.tvTOCDisplay->setContextMenuPolicy(Qt::CustomContextMenu); ui.tvTOCDisplay->installEventFilter(this); CreateContextMenuActions(); ConnectSignalsToSlots(); ui.tvTOCDisplay->setModel(&m_TableOfContents); LockHTMLResources(); QList<Headings::Heading> flat_headings = Headings::GetHeadingList( m_Book->GetFolderKeeper().GetResourceTypeList<HTMLResource>(true), true); m_Headings = Headings::MakeHeadingHeirarchy(flat_headings); PopulateSelectHeadingCombo(GetMaxHeadingLevel(flat_headings)); RefreshTOCModelDisplay(); ReadSettings(); }