bool AddressWidget::eventFilter(QObject *object, QEvent *event) { if (object == m_bookmarkLabel && m_bookmarkLabel && event->type() == QEvent::MouseButtonPress) { QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); if (mouseEvent && mouseEvent->button() == Qt::LeftButton) { if (m_bookmarkLabel->isEnabled()) { if (BookmarksManager::hasBookmark(getUrl())) { BookmarksManager::deleteBookmark(getUrl()); } else { BookmarkInformation *bookmark = new BookmarkInformation(); bookmark->url = getUrl().toString(QUrl::RemovePassword); bookmark->title = m_window->getTitle(); bookmark->type = UrlBookmark; BookmarkPropertiesDialog dialog(bookmark, -1, this); if (dialog.exec() == QDialog::Rejected) { delete bookmark; } } updateBookmark(); } return true; } } if (object && event->type() == QEvent::ContextMenu) { QContextMenuEvent *contextMenuEvent = static_cast<QContextMenuEvent*>(event); if (contextMenuEvent) { QMenu menu(this); QAction *action = menu.addAction(tr("Remove This Icon"), this, SLOT(removeIcon())); action->setData(object->objectName()); menu.exec(contextMenuEvent->globalPos()); contextMenuEvent->accept(); return true; } } return QLineEdit::eventFilter(object, event); }
LRESULT CArchTaskBarWindows::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case kNotifyReceiver: { // lookup receiver CIDToReceiverMap::const_iterator index = m_idTable.find((UINT)wParam); if (index != m_idTable.end()) { IArchTaskBarReceiver* receiver = index->second->first; handleIconMessage(receiver, lParam); return 0; } break; } case kAddReceiver: addIcon((UINT)wParam); break; case kRemoveReceiver: removeIcon((UINT)wParam); break; case kUpdateReceiver: updateIcon((UINT)wParam); break; default: if (msg == m_taskBarRestart) { // task bar was recreated so re-add our icons addAllIcons(); } break; } return DefWindowProc(hwnd, msg, wParam, lParam); }
/* * RemoveIconFromList - remove an icon image from the current icon file * - after calling this routine, the 'node' variable * should no longer be used by the calling routine */ img_node *RemoveIconFromList( img_node *node, int index ) { img_node *prevnode; img_node *nextimage; img_node *newnodelist; nextimage = node->next; prevnode = findPreviousNode( node ); newnodelist = removeIcon( node, index ); if( prevnode == NULL ) { imgHead = newnodelist; } else { prevnode->next = newnodelist; } newnodelist->next = nextimage; if( nextimage == NULL ) { imgTail = newnodelist; } return( newnodelist ); } /* RemoveIconFromList */
ObjectTypesEditor::ObjectTypesEditor(QWidget *parent) : QMainWindow(parent, Qt::Window) , mUi(new Ui::ObjectTypesEditor) , mObjectTypesModel(new ObjectTypesModel(this)) , mVariantManager(new VariantPropertyManager(this)) , mGroupManager(new QtGroupPropertyManager(this)) , mUpdating(false) { mUi->setupUi(this); resize(Utils::dpiScaled(size())); mUi->objectTypesTable->setModel(mObjectTypesModel); mUi->objectTypesTable->setItemDelegateForColumn(1, new ColorDelegate(this)); QHeaderView *horizontalHeader = mUi->objectTypesTable->horizontalHeader(); horizontalHeader->setSectionResizeMode(QHeaderView::Stretch); mUi->propertiesView->setFactoryForManager(mVariantManager, new VariantEditorFactory(this)); mUi->propertiesView->setResizeMode(QtTreePropertyBrowser::ResizeToContents); mUi->propertiesView->setRootIsDecorated(false); mUi->propertiesView->setPropertiesWithoutValueMarked(true); mAddObjectTypeAction = new QAction(this); mRemoveObjectTypeAction = new QAction(this); mAddPropertyAction = new QAction(this); mRemovePropertyAction = new QAction(this); mRenamePropertyAction = new QAction(this); mRemoveObjectTypeAction->setEnabled(false); mAddPropertyAction->setEnabled(false); mRemovePropertyAction->setEnabled(false); mRenamePropertyAction->setEnabled(false); QIcon addIcon(QLatin1String(":/images/22x22/add.png")); QIcon removeIcon(QLatin1String(":/images/22x22/remove.png")); mAddObjectTypeAction->setIcon(addIcon); mRemoveObjectTypeAction->setIcon(removeIcon); mAddPropertyAction->setIcon(addIcon); mRemovePropertyAction->setIcon(removeIcon); mRenamePropertyAction->setIcon(QIcon(QLatin1String(":/images/16x16/rename.png"))); Utils::setThemeIcon(mAddObjectTypeAction, "add"); Utils::setThemeIcon(mRemoveObjectTypeAction, "remove"); Utils::setThemeIcon(mAddPropertyAction, "add"); Utils::setThemeIcon(mRemovePropertyAction, "remove"); QToolBar *objectTypesToolBar = new QToolBar(this); objectTypesToolBar->setIconSize(Utils::smallIconSize()); objectTypesToolBar->addAction(mAddObjectTypeAction); objectTypesToolBar->addAction(mRemoveObjectTypeAction); QToolBar *propertiesToolBar = new QToolBar(this); propertiesToolBar->setIconSize(Utils::smallIconSize()); propertiesToolBar->addAction(mAddPropertyAction); propertiesToolBar->addAction(mRemovePropertyAction); propertiesToolBar->addAction(mRenamePropertyAction); mUi->objectTypesLayout->addWidget(objectTypesToolBar); mUi->propertiesLayout->addWidget(propertiesToolBar); auto selectionModel = mUi->objectTypesTable->selectionModel(); connect(selectionModel, &QItemSelectionModel::selectionChanged, this, &ObjectTypesEditor::selectedObjectTypesChanged); connect(mObjectTypesModel, &ObjectTypesModel::modelReset, this, &ObjectTypesEditor::selectFirstType); connect(mUi->objectTypesTable, &QAbstractItemView::doubleClicked, this, &ObjectTypesEditor::objectTypeIndexClicked); connect(mAddObjectTypeAction, &QAction::triggered, this, &ObjectTypesEditor::addObjectType); connect(mRemoveObjectTypeAction, &QAction::triggered, this, &ObjectTypesEditor::removeSelectedObjectTypes); connect(mAddPropertyAction, &QAction::triggered, this, &ObjectTypesEditor::openAddPropertyDialog); connect(mRemovePropertyAction, &QAction::triggered, this, &ObjectTypesEditor::removeProperty); connect(mRenamePropertyAction, &QAction::triggered, this, &ObjectTypesEditor::renameProperty); connect(mUi->actionChooseFile, &QAction::triggered, this, &ObjectTypesEditor::chooseObjectTypesFile); connect(mUi->actionImport, &QAction::triggered, this, &ObjectTypesEditor::importObjectTypes); connect(mUi->actionExport, &QAction::triggered, this, &ObjectTypesEditor::exportObjectTypes); connect(mObjectTypesModel, &ObjectTypesModel::dataChanged, this, &ObjectTypesEditor::applyObjectTypes); connect(mObjectTypesModel, &ObjectTypesModel::rowsInserted, this, &ObjectTypesEditor::applyObjectTypes); connect(mObjectTypesModel, &ObjectTypesModel::rowsRemoved, this, &ObjectTypesEditor::applyObjectTypes); connect(mVariantManager, &QtVariantPropertyManager::valueChanged, this, &ObjectTypesEditor::propertyValueChanged); connect(mUi->propertiesView, &QtTreePropertyBrowser::currentItemChanged, this, &ObjectTypesEditor::currentItemChanged); mObjectTypesModel->setObjectTypes(Object::objectTypes()); retranslateUi(); }
void SCameraConfigLauncher::starting() { this->create(); m_cameraSeries = this->getInOut< ::arData::CameraSeries >("cameraSeries"); SLM_ASSERT("Missing cameraSeries.", m_cameraSeries); m_activitySeries = this->getInOut< ::fwMedData::ActivitySeries >("activitySeries"); SLM_ASSERT("Missing activitySeries.", m_activitySeries); auto qtContainer = ::fwGuiQt::container::QtContainer::dynamicCast( this->getContainer() ); QHBoxLayout* layout = new QHBoxLayout(); m_cameraComboBox = new QComboBox(); layout->addWidget(m_cameraComboBox); QIcon addIcon(QString::fromStdString(::fwRuntime::getBundleResourceFilePath("media", "icons/Import.svg").string())); m_addButton = new QPushButton(addIcon, ""); m_addButton->setToolTip("Add a new camera."); layout->addWidget(m_addButton); QIcon importIcon(QString::fromStdString(::fwRuntime::getBundleResourceFilePath("arMedia", "icons/CameraSeries.svg").string())); m_importButton = new QPushButton(importIcon, ""); m_importButton->setToolTip("Import an intrinsic calibration."); layout->addWidget(m_importButton); QIcon removeIcon(QString::fromStdString(::fwRuntime::getBundleResourceFilePath("arMedia", "icons/remove.svg").string())); m_removeButton = new QPushButton(removeIcon, ""); m_removeButton->setToolTip("Remove the camera."); layout->addWidget(m_removeButton); m_extrinsicButton = new QPushButton("Extrinsic"); layout->addWidget(m_extrinsicButton); m_extrinsicButton->setCheckable(true); qtContainer->setLayout( layout ); const size_t nbCam = m_cameraSeries->getNumberOfCameras(); if (nbCam == 0) { this->addCamera(); m_extrinsicButton->setEnabled(false); m_removeButton->setEnabled(false); } else { for (size_t i = 0; i < nbCam; ++i) { m_cameraComboBox->addItem(QString("Camera %1").arg(i+1)); } const bool moreThanOneCamera = (nbCam > 1); m_extrinsicButton->setEnabled(moreThanOneCamera); m_removeButton->setEnabled(moreThanOneCamera); } QObject::connect(m_cameraComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onCameraChanged(int))); QObject::connect(m_addButton, SIGNAL(clicked()), this, SLOT(onAddClicked())); QObject::connect(m_importButton, SIGNAL(clicked()), this, SLOT(onImportClicked())); QObject::connect(m_removeButton, SIGNAL(clicked()), this, SLOT(onRemoveClicked())); QObject::connect(m_extrinsicButton, SIGNAL(toggled(bool)), this, SLOT(onExtrinsicToggled(bool))); this->startIntrinsicConfig(0); }
bool AddressWidget::eventFilter(QObject *object, QEvent *event) { if (object == m_bookmarkLabel && m_bookmarkLabel && event->type() == QEvent::MouseButtonPress) { QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event); if (mouseEvent && mouseEvent->button() == Qt::LeftButton) { if (m_bookmarkLabel->isEnabled()) { if (BookmarksManager::hasBookmark(getUrl())) { BookmarksManager::deleteBookmark(getUrl()); } else { BookmarkInformation *bookmark = new BookmarkInformation(); bookmark->url = getUrl().toString(QUrl::RemovePassword); bookmark->title = m_window->getTitle(); bookmark->type = UrlBookmark; BookmarkPropertiesDialog dialog(bookmark, -1, this); if (dialog.exec() == QDialog::Rejected) { delete bookmark; } } updateBookmark(); } return true; } } if (object != this && event->type() == QEvent::ContextMenu) { QContextMenuEvent *contextMenuEvent = static_cast<QContextMenuEvent*>(event); if (contextMenuEvent) { QMenu menu(this); QAction *action = menu.addAction(tr("Remove This Icon"), this, SLOT(removeIcon())); action->setData(object->objectName()); menu.exec(contextMenuEvent->globalPos()); contextMenuEvent->accept(); return true; } } if (object == this && event->type() == QEvent::KeyPress && m_window) { QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event); if (keyEvent->key() == Qt::Key_Escape) { const QUrl url = m_window->getUrl(); if (text().trimmed().isEmpty() || text().trimmed() != url.toString()) { setText((url.scheme() == QLatin1String("about") && m_window->isUrlEmpty()) ? QString() : url.toString()); if (!text().trimmed().isEmpty() && SettingsManager::getValue(QLatin1String("AddressField/SelectAllOnFocus")).toBool()) { QTimer::singleShot(0, this, SLOT(selectAll())); } } else { m_window->setFocus(); } } } return QLineEdit::eventFilter(object, event); }