LinkPropertyViewImpl::LinkPropertyViewImpl(LinkPropertyView* self) : self(self) { linkSelectionView = LinkSelectionView::mainInstance(); setFrameShape(QFrame::NoFrame); setColumnCount(2); setSelectionBehavior(QAbstractItemView::SelectRows); setSelectionMode(QAbstractItemView::NoSelection); QHeaderView* hh = horizontalHeader(); QHeaderView* vh = verticalHeader(); hh->hide(); vh->hide(); hh->setSectionResizeMode(QHeaderView::Stretch); vh->setSectionResizeMode(QHeaderView::ResizeToContents); hh->setStretchLastSection(true); fontPointSizeDiff = 0; MappingPtr config = AppConfig::archive()->openMapping("LinkPropertyView"); int storedFontPointSizeDiff; if(config->read("fontZoom", storedFontPointSizeDiff)){ zoomFontSize(storedFontPointSizeDiff); } connections.add( BodyBar::instance()->sigCurrentBodyItemChanged().connect( std::bind(&LinkPropertyViewImpl::onCurrentBodyItemChanged, this, _1))); connections.add( linkSelectionView->sigSelectionChanged().connect( std::bind(&LinkPropertyViewImpl::updateProperties, this))); }
void View::enableFontSizeZoomKeys(bool on) { isFontSizeZoomKeysEnabled = on; if(on){ MappingPtr config = AppConfig::archive()->openMapping(viewClass()->className()); int storedZoom; if(config->read("fontZoom", storedZoom)){ zoomFontSize(storedZoom); } } }
SceneGraphPropertyViewImpl::SceneGraphPropertyViewImpl(SceneGraphPropertyView* self) : self(self) { tableWidget = new CustomizedTableWidget(self); tableWidget->setFrameShape(QFrame::NoFrame); tableWidget->setColumnCount(2); tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows); tableWidget->setSelectionMode(QAbstractItemView::NoSelection); tableWidget->horizontalHeader()->hide(); tableWidget->horizontalHeader()->setStretchLastSection(true); tableWidget->verticalHeader()->hide(); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) tableWidget->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); #else tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); #endif QStyledItemDelegate* delegate = new CustomizedItemDelegate(tableWidget); QItemEditorFactory* factory = new QItemEditorFactory; QItemEditorCreatorBase* selectionListCreator = new QStandardItemEditorCreator<SelectionListEditor>(); factory->registerEditor(QVariant::StringList, selectionListCreator); delegate->setItemEditorFactory(factory); tableWidget->setItemDelegate(delegate); QVBoxLayout* layout = new QVBoxLayout(); layout->addWidget(tableWidget); self->setLayout(layout); self->sigActivated().connect(std::bind(&SceneGraphPropertyViewImpl::onActivated, this, true)); self->sigDeactivated().connect(std::bind(&SceneGraphPropertyViewImpl::onActivated, this ,false)); currentObject = 0; fontPointSizeDiff = 0; MappingPtr config = AppConfig::archive()->openMapping("SceneGraphPropertyView"); int storedFontPointSizeDiff; if(config->read("fontZoom", storedFontPointSizeDiff)){ zoomFontSize(storedFontPointSizeDiff); } }
ItemTreeViewImpl::ItemTreeViewImpl(ItemTreeView* self, RootItem* rootItem, bool showRoot) : self(self), rootItem(rootItem) { using boost::bind; isProceccingSlotForRootItemSignals = 0; isDropping = false; setColumnCount(1); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) header()->setResizeMode(0, QHeaderView::Stretch); header()->setMinimumSectionSize(0); #else header()->setSectionResizeMode(0, QHeaderView::Stretch); //header()->setMinimumSectionSize(0); #endif // default check column addCheckColumn(); header()->setStretchLastSection(false); header()->swapSections(0, 1); setWordWrap(true); setFrameShape(QFrame::NoFrame); setHeaderHidden(true); setIndentation(12); setSelectionMode(QAbstractItemView::ExtendedSelection); setDragDropMode(QAbstractItemView::InternalMove); sigItemSelectionChanged().connect(bind(&ItemTreeViewImpl::onSelectionChanged, this)); connectionsFromRootItem.add( rootItem->sigSubTreeAdded().connect(bind(&ItemTreeViewImpl::onSubTreeAddedOrMoved, this, _1))); connectionsFromRootItem.add( rootItem->sigSubTreeMoved().connect(bind(&ItemTreeViewImpl::onSubTreeAddedOrMoved, this, _1))); connectionsFromRootItem.add( rootItem->sigSubTreeRemoved().connect(bind(&ItemTreeViewImpl::onSubTreeRemoved, this, _1, _2))); connectionsFromRootItem.add( rootItem->sigTreeChanged().connect(bind(&ItemTreeViewImpl::onTreeChanged, this))); connectionsFromRootItem.add( rootItem->sigItemAssigned().connect(bind(&ItemTreeViewImpl::onItemAssigned, this, _1, _2))); QObject::connect(model(), SIGNAL(rowsAboutToBeRemoved(const QModelIndex&, int, int)), self, SLOT(onRowsAboutToBeRemoved(const QModelIndex&, int, int))); QObject::connect(model(), SIGNAL(rowsInserted(const QModelIndex&, int, int)), self, SLOT(onRowsInserted(const QModelIndex&, int, int))); popupMenu = new Menu(this); menuManager.setTopMenu(popupMenu); menuManager.addItem(_("Cut")) ->sigTriggered().connect(bind(&ItemTreeViewImpl::cutSelectedItems, this)); menuManager.addItem(_("Copy (single)")) ->sigTriggered().connect(bind(&ItemTreeViewImpl::copySelectedItems, this)); menuManager.addItem(_("Copy (sub tree)")) ->sigTriggered().connect(bind(&ItemTreeViewImpl::copySelectedItemsWithChildren, this)); menuManager.addItem(_("Paste")) ->sigTriggered().connect(bind(&ItemTreeViewImpl::pasteItems, this)); menuManager.addSeparator(); menuManager.addItem(_("Check")) ->sigTriggered().connect(bind(&ItemTreeViewImpl::checkSelectedItems, this, true)); menuManager.addItem(_("Uncheck")) ->sigTriggered().connect(bind(&ItemTreeViewImpl::checkSelectedItems, this, false)); menuManager.addItem(_("Toggle checks")) ->sigTriggered().connect(bind(&ItemTreeViewImpl::toggleSelectedItemChecks, this)); menuManager.addSeparator(); menuManager.addItem(_("Select all")) ->sigTriggered().connect(bind(&ItemTreeView::selectAllItems, self)); menuManager.addItem(_("Clear selection")) ->sigTriggered().connect(bind(&ItemTreeView::clearSelection, self)); fontPointSizeDiff = 0; MappingPtr config = AppConfig::archive()->openMapping("ItemTreeView"); int storedFontPointSizeDiff; if(config->read("fontZoom", storedFontPointSizeDiff)){ zoomFontSize(storedFontPointSizeDiff); } }