void ActionEditor::slotCurrentItemChanged(QAction *action) { QDesignerFormWindowInterface *fw = formWindow(); if (!fw) return; const bool hasCurrentAction = action != 0; m_actionEdit->setEnabled(hasCurrentAction); if (!action) { fw->clearSelection(); return; } QDesignerObjectInspector *oi = qobject_cast<QDesignerObjectInspector *>(core()->objectInspector()); if (action->associatedWidgets().empty()) { // Special case: action not in object tree. Deselect all and set in property editor fw->clearSelection(false); if (oi) oi->clearSelection(); core()->propertyEditor()->setObject(action); } else { if (oi) oi->selectObject(action); } }
void WizardPageChangeWatcher::pageChanged() { /* Use a bit more conservative approach than that for the QTabWidget, * change the selection only if a selected child becomes invisible by * changing the page. */ QWizard *wizard = static_cast<QWizard *>(parent()); QDesignerFormWindowInterface *fw = QDesignerFormWindowInterface::findFormWindow(wizard); if (!fw) return; QDesignerFormWindowCursorInterface *cursor = fw->cursor(); const int selCount = cursor->selectedWidgetCount(); for (int i = 0; i < selCount; i++) { if (!cursor->selectedWidget(i)->isVisible()) { fw->clearSelection(false); fw->selectWidget(wizard, true); break; } } }
void ButtonGroupCommand::breakButtonGroup() { if (debugButtonMenu) qDebug() << "Removing " << m_buttonGroup << " consisting of " << m_buttonList; QDesignerFormWindowInterface *fw = formWindow(); QDesignerFormEditorInterface *core = fw->core(); // Button group was selected, that is, break was invoked via its context menu. Remove it from property editor, select the buttons if (core->propertyEditor()->object() == m_buttonGroup) { fw->clearSelection(false); const ButtonList::const_iterator cend = m_buttonList.constEnd(); for (ButtonList::const_iterator it = m_buttonList.constBegin(); it != cend; ++it) fw->selectWidget(*it, true); } // Now remove and refresh object inspector removeButtonsFromGroup(); // Notify components (for example, signal slot editor) if (qdesigner_internal::FormWindowBase *fwb = qobject_cast<qdesigner_internal::FormWindowBase *>(fw)) fwb->emitObjectRemoved(m_buttonGroup); core->metaDataBase()->remove(m_buttonGroup); core->objectInspector()->setFormWindow(fw); }
bool DesignerStyleInput::filterEvent(const QEvent* event) { if (event->type()== QEvent::MouseButtonPress) { QMouseEvent* me = (QMouseEvent *)event; if (me->button() == Qt::LeftButton) { QDesignerFormWindowInterface* formWindow = QDesignerFormWindowInterface::findFormWindow(m_widget); formWindow->clearSelection(false); formWindow->core()->propertyEditor()->setObject(m_widget); formWindow->core()->propertyEditor()->setEnabled(true); return true; } else if (me->button() == Qt::RightButton) { QList<QAction *> actions; actions.append(m_actRemoveStyle); QMenu::exec(actions, QCursor::pos()); return true; } } return true; // Handle all input context events here. }