QIcon generateIcon(const char* iconPath) { QIcon icon; QString normalPath(iconPath); auto tokens = normalPath.split('.'); TF_ASSERT(tokens.length() == 2); QString off(tokens[0]); QString on(tokens[0] + stateOn); QString ext("." + tokens[1]); QString disabledPath(off + modeDisabled + ext); QString activePath(off + modeActive + ext); QString selectedPath(off + modeSelected + ext); QString normalOnPath(on + ext); QString disabledOnPath(on + modeDisabled + ext); QString activeOnPath(on + modeActive + ext); QString selectedOnPath(on + modeSelected + ext); auto offIcon = QPixmap(normalPath); icon.addPixmap(offIcon, QIcon::Normal, QIcon::Off); icon.addPixmap(QPixmap(disabledPath), QIcon::Disabled, QIcon::Off); icon.addPixmap(QPixmap(activePath), QIcon::Active, QIcon::Off); icon.addPixmap(QPixmap(selectedPath), QIcon::Selected, QIcon::Off); auto onIcon = QPixmap(normalOnPath); if (onIcon.isNull()) { QPainter p; auto img = offIcon.toImage().convertToFormat(QImage::Format_ARGB32); auto mask(img); auto width = mask.width(); auto height = mask.height(); auto outerRect = mask.rect(); auto innerRect = QRect(width / 16, height / 16, width - width / 8, height - height / 8); p.begin(&mask); p.setCompositionMode(QPainter::CompositionMode_SourceIn); p.fillRect(outerRect, QApplication::palette().highlight()); p.fillRect(innerRect, Qt::transparent); p.end(); p.begin(&img); p.setCompositionMode(QPainter::CompositionMode_SourceOver); p.drawImage(0, 0, mask); p.end(); onIcon.convertFromImage(img); } icon.addPixmap(onIcon, QIcon::Normal, QIcon::On); icon.addPixmap(QPixmap(disabledOnPath), QIcon::Disabled, QIcon::On); icon.addPixmap(QPixmap(activeOnPath), QIcon::Active, QIcon::On); icon.addPixmap(QPixmap(selectedOnPath), QIcon::Selected, QIcon::On); return icon; }
//----------------------------------------------------------------------------- // Function: apply() //----------------------------------------------------------------------------- void NewSystemPage::apply() { // Create the system in a different way based on the mapping option selection. if (mapRadioButton_->isChecked()) { Q_ASSERT(compTreeWidget_->currentItem() != 0); QVariant data = compTreeWidget_->currentItem()->data(0, Qt::UserRole); emit createSystem(data.value<VLNV>(), viewComboBox_->currentText(), vlnvEditor_->getVLNV(), selectedPath()); } else { emit createSystem(VLNV(), "", vlnvEditor_->getVLNV(),selectedPath()); } }
void GraphTreeModel::updateSelectionStatus(const Glib::RefPtr<Gtk::TreeSelection>& selection, const scene::INodePtr& node) { NodeMap::const_iterator found = _nodemap.find(scene::INodeWeakPtr(node)); GraphTreeNodePtr foundNode; if (found == _nodemap.end()) { // The node is not in our map, it might have been previously hidden if (node->visible()) { foundNode = insert(node); } } else { foundNode = found->second; } if (foundNode) { if (Node_isSelected(node)) { // Select the row in the TreeView selection->select(foundNode->getIter()); // Scroll to the row Gtk::TreeView* tv = selection->get_tree_view(); Gtk::TreeModel::Path selectedPath(foundNode->getIter()); tv->expand_to_path(selectedPath); tv->scroll_to_row(selectedPath, 0.3f); } else { selection->unselect(foundNode->getIter()); } } }
//----------------------------------------------------------------------------- // Function: apply() //----------------------------------------------------------------------------- void NewSWDesignPage::apply() { emit createSWDesign(vlnvEditor_->getVLNV(), selectedPath()); }
//----------------------------------------------------------------------------- // Function: apply() //----------------------------------------------------------------------------- void NewDesignPage::apply() { emit createDesign(attributeEditor_->getProductHierarchy(), attributeEditor_->getFirmness(), vlnvEditor_->getVLNV(), selectedPath()); }
void DeviceSelectDialog::accept() { selectedPath(devicesView->selectionModel()->currentIndex()); QDialog::accept(); }
//----------------------------------------------------------------------------- // Function: apply() //----------------------------------------------------------------------------- void NewBusPage::apply() { emit createBus(vlnvEditor_->getVLNV(), selectedPath()); }
QString ODocumentFileView::directory()const { return selectedPath(); }
//----------------------------------------------------------------------------- // Function: apply() //----------------------------------------------------------------------------- void NewApiDefinitionPage::apply() { emit createApiDefinition(vlnvEditor_->getVLNV(), selectedPath()); }