PlaylistTabBar::PlaylistTabBar(QWidget* parent) : QTabBar(parent), manager_(nullptr), menu_(new QMenu(this)), menu_index_(-1), suppress_current_changed_(false), initialized_(false), rename_editor_(new RenameTabLineEdit(this)) { setAcceptDrops(true); setElideMode(Qt::ElideRight); setUsesScrollButtons(true); setTabsClosable(true); close_ = menu_->addAction(IconLoader::Load("list-remove", IconLoader::Base), tr("Close playlist"), this, SLOT(Close())); rename_ = menu_->addAction(IconLoader::Load("edit-rename", IconLoader::Base), tr("Rename playlist..."), this, SLOT(Rename())); save_ = menu_->addAction(IconLoader::Load("document-save", IconLoader::Base), tr("Save playlist..."), this, SLOT(Save())); menu_->addSeparator(); rename_editor_->setVisible(false); connect(rename_editor_, SIGNAL(editingFinished()), SLOT(RenameInline())); connect(rename_editor_, SIGNAL(EditingCanceled()), SLOT(HideEditor())); connect(this, SIGNAL(currentChanged(int)), SLOT(CurrentIndexChanged(int))); connect(this, SIGNAL(tabMoved(int, int)), SLOT(TabMoved())); // We can't just emit Close signal, we need to extract the playlist id first connect(this, SIGNAL(tabCloseRequested(int)), SLOT(CloseFromTabIndex(int))); }
void PixelInfoListCtrl::DoListenToMessage( std::string const iMsg, void* iData, void* sender ) { if ( iMsg == "LayerAdded" || iMsg == "LayerRemoved" || iMsg == "LayerMoved" || iMsg == "MouseRASPositionChanged" || iMsg == "SurfaceOverlayAdded" || iMsg == "SurfaceAnnotationAdded" ) { HideEditor(); UpdateList(); } }
void PlaylistTabBar::contextMenuEvent(QContextMenuEvent* e) { // we need to finish the renaming action before showing context menu if (rename_editor_->isVisible()) { // discard any change HideEditor(); } menu_index_ = tabAt(e->pos()); rename_->setEnabled(menu_index_ != -1); close_->setEnabled(menu_index_ != -1 && count() > 1); save_->setEnabled(menu_index_ != -1); menu_->popup(e->globalPos()); }
void PlaylistTabBar::RenameInline() { emit Rename(tabData(menu_index_).toInt(), rename_editor_->text()); HideEditor(); }
void PixelInfoListCtrl::SetShowShortName( bool bShow ) { m_bShowShortName = bShow; HideEditor(); UpdateList(); }
void PixelInfoListCtrl::SetShowSurfaceCurvature( bool bShow ) { m_bShowSurfaceCurvature = bShow; HideEditor(); UpdateList(); }
void PixelInfoListCtrl::SetShowSurfaceCoordinates( bool bShow ) { m_bShowSurfaceCoordinates = bShow; HideEditor(); UpdateList(); }