本文整理汇总了C++中QDesignerFormEditorInterface类的典型用法代码示例。如果您正苦于以下问题:C++ QDesignerFormEditorInterface类的具体用法?C++ QDesignerFormEditorInterface怎么用?C++ QDesignerFormEditorInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDesignerFormEditorInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
QT_BEGIN_NAMESPACE
QDesignerFormWindow::QDesignerFormWindow(QDesignerFormWindowInterface *editor, QDesignerWorkbench *workbench, QWidget *parent, Qt::WindowFlags flags)
: QWidget(parent, flags),
m_editor(editor),
m_workbench(workbench),
m_action(new QAction(this)),
m_initialized(false),
m_windowTitleInitialized(false)
{
Q_ASSERT(workbench);
setMaximumSize(0xFFF, 0xFFF);
QDesignerFormEditorInterface *core = workbench->core();
if (m_editor) {
m_editor->setParent(this);
} else {
m_editor = core->formWindowManager()->createFormWindow(this);
}
QVBoxLayout *l = new QVBoxLayout(this);
l->setMargin(0);
l->addWidget(m_editor);
m_action->setCheckable(true);
connect(m_editor->commandHistory(), SIGNAL(indexChanged(int)), this, SLOT(updateChanged()));
connect(m_editor, SIGNAL(geometryChanged()), this, SLOT(geometryChanged()));
qdesigner_internal::FormWindowBase::setupDefaultAction(m_editor);
}
示例2: getSelection
void QDesignerIntegrationPrivate::getSelection(Selection &s)
{
QDesignerFormEditorInterface *core = q->core();
// Get multiselection from object inspector
if (QDesignerObjectInspector *designerObjectInspector = qobject_cast<QDesignerObjectInspector *>(core->objectInspector())) {
designerObjectInspector->getSelection(s);
// Action editor puts actions that are not on the form yet
// into the property editor only.
if (s.empty())
if (QObject *object = core->propertyEditor()->object())
s.objects.push_back(object);
} else {
// Just in case someone plugs in an old-style object inspector: Emulate selection
s.clear();
QDesignerFormWindowInterface *formWindow = core->formWindowManager()->activeFormWindow();
if (!formWindow)
return;
QObject *object = core->propertyEditor()->object();
if (object->isWidgetType()) {
QWidget *widget = static_cast<QWidget*>(object);
QDesignerFormWindowCursorInterface *cursor = formWindow->cursor();
if (cursor->isWidgetSelected(widget)) {
s.managed.push_back(widget);
} else {
s.unmanaged.push_back(widget);
}
} else {
s.objects.push_back(object);
}
}
}
示例3: formWindow
void QDesignerDockWidget::setDocked(bool b)
{
if (QMainWindow *mainWindow = findMainWindow()) {
QDesignerFormEditorInterface *core = formWindow()->core();
QDesignerContainerExtension *c;
c = qt_extension<QDesignerContainerExtension*>(core->extensionManager(), mainWindow);
if (b && !docked()) {
// Dock it
// ### undo/redo stack
setParent(0);
c->addWidget(this);
formWindow()->selectWidget(this, formWindow()->cursor()->isWidgetSelected(this));
} else if (!b && docked()) {
// Undock it
for (int i = 0; i < c->count(); ++i) {
if (c->widget(i) == this) {
c->remove(i);
break;
}
}
// #### restore the position
setParent(mainWindow->centralWidget());
show();
formWindow()->selectWidget(this, formWindow()->cursor()->isWidgetSelected(this));
}
}
}
示例4: editMetaDataBase
bool SignalSlotDialog::editMetaDataBase(QDesignerFormWindowInterface *fw, QObject *object, QWidget *parent, FocusMode mode)
{
QDesignerFormEditorInterface *core = fw->core();
SignalSlotDialog dlg(core->dialogGui(), parent, mode);
dlg.setWindowTitle(tr("Signals/Slots of %1").arg(object->objectName()));
SignalSlotDialogData slotData;
SignalSlotDialogData signalData;
existingMethodsFromMemberSheet(core, object, slotData.m_existingMethods, signalData.m_existingMethods);
fakeMethodsFromMetaDataBase(core, object, slotData.m_fakeMethods, signalData.m_fakeMethods);
const QStringList oldSlots = slotData.m_fakeMethods;
const QStringList oldSignals = signalData.m_fakeMethods;
if (dlg.showDialog(slotData, signalData) == QDialog::Rejected)
return false;
if (oldSlots == slotData.m_fakeMethods && oldSignals == signalData.m_fakeMethods)
return false;
FakeMethodMetaDBCommand *cmd = new FakeMethodMetaDBCommand(fw);
cmd->init(object, oldSlots, oldSignals, slotData.m_fakeMethods, signalData.m_fakeMethods);
fw->commandHistory()->push(cmd);
return true;
}
示例5: formWindow
QDesignerContainerExtension *QDesignerQ3WidgetStack::container()
{
if (formWindow()) {
QDesignerFormEditorInterface *core = formWindow()->core();
return qt_extension<QDesignerContainerExtension*>(core->extensionManager(), this);
}
return 0;
}
示例6:
QDesignerActionProviderExtension *QDesignerMenuBar::actionProvider()
{
if (QDesignerFormWindowInterface *fw = formWindow()) {
QDesignerFormEditorInterface *core = fw->core();
return qt_extension<QDesignerActionProviderExtension*>(core->extensionManager(), this);
}
return 0;
}
示例7: mousePressEvent
void TabOrderEditor::mousePressEvent(QMouseEvent *e)
{
e->accept();
if (!m_indicator_region.contains(e->pos())) {
if (QWidget *child = m_bg_widget->childAt(e->pos())) {
QDesignerFormEditorInterface *core = m_form_window->core();
if (core->widgetFactory()->isPassiveInteractor(child)) {
QMouseEvent event(QEvent::MouseButtonPress,
child->mapFromGlobal(e->globalPos()),
e->button(), e->buttons(), e->modifiers());
qApp->sendEvent(child, &event);
QMouseEvent event2(QEvent::MouseButtonRelease,
child->mapFromGlobal(e->globalPos()),
e->button(), e->buttons(), e->modifiers());
qApp->sendEvent(child, &event2);
updateBackground();
}
}
return;
}
if (e->button() != Qt::LeftButton)
return;
const int target_index = widgetIndexAt(e->pos());
if (target_index == -1)
return;
m_beginning = false;
if (e->modifiers() & Qt::ControlModifier) {
m_current_index = target_index + 1;
if (m_current_index >= m_tab_order_list.size())
m_current_index = 0;
update();
return;
}
if (m_current_index == -1)
return;
m_tab_order_list.swap(target_index, m_current_index);
++m_current_index;
if (m_current_index == m_tab_order_list.size())
m_current_index = 0;
TabOrderCommand *cmd = new TabOrderCommand(formWindow());
cmd->init(m_tab_order_list);
formWindow()->commandHistory()->push(cmd);
}
示例8: qDeleteAll
PromotionTaskMenu::PromotionState PromotionTaskMenu::createPromotionActions(QDesignerFormWindowInterface *formWindow)
{
// clear out old
if (!m_promotionActions.empty()) {
qDeleteAll(m_promotionActions);
m_promotionActions.clear();
}
// No promotion of main container
if (formWindow->mainContainer() == m_widget)
return NotApplicable;
// Check for a homogenous selection
const PromotionSelectionList promotionSelection = promotionSelectionList(formWindow);
if (promotionSelection.empty())
return NoHomogenousSelection;
QDesignerFormEditorInterface *core = formWindow->core();
// if it is promoted: demote only.
if (isPromoted(formWindow->core(), m_widget)) {
const QString label = m_demoteLabel.arg( promotedExtends(core , m_widget));
QAction *demoteAction = new QAction(label, this);
connect(demoteAction, SIGNAL(triggered()), this, SLOT(slotDemoteFromCustomWidget()));
m_promotionActions.push_back(demoteAction);
return CanDemote;
}
// figure out candidates
const QString baseClassName = WidgetFactory::classNameOf(core, m_widget);
const WidgetDataBaseItemList candidates = promotionCandidates(core->widgetDataBase(), baseClassName );
if (candidates.empty()) {
// Is this thing promotable at all?
return QDesignerPromotionDialog::baseClassNames(core->promotion()).contains(baseClassName) ? CanPromote : NotApplicable;
}
// Set up a signal mapper to associate class names
if (!m_promotionMapper) {
m_promotionMapper = new QSignalMapper(this);
connect(m_promotionMapper, SIGNAL(mapped(QString)), this, SLOT(slotPromoteToCustomWidget(QString)));
}
QMenu *candidatesMenu = new QMenu();
// Create a sub menu
const WidgetDataBaseItemList::const_iterator cend = candidates.constEnd();
// Set up actions and map class names
for (WidgetDataBaseItemList::const_iterator it = candidates.constBegin(); it != cend; ++it) {
const QString customClassName = (*it)->name();
QAction *action = new QAction((*it)->name(), this);
connect(action, SIGNAL(triggered()), m_promotionMapper, SLOT(map()));
m_promotionMapper->setMapping(action, customClassName);
candidatesMenu->addAction(action);
}
// Sub menu action
QAction *subMenuAction = new QAction(m_promoteLabel, this);
subMenuAction->setMenu(candidatesMenu);
m_promotionActions.push_back(subMenuAction);
return CanPromote;
}
示例9: formWindow
bool QDesignerFormWindowCommand::hasLayout(QWidget *widget) const
{
QDesignerFormEditorInterface *core = formWindow()->core();
if (widget && LayoutInfo::layoutType(core, widget) != LayoutInfo::NoLayout) {
const QDesignerMetaDataBaseItemInterface *item = core->metaDataBase()->item(widget);
return item != 0;
}
return false;
}
示例10: qDebug
void ButtonGroupCommand::createButtonGroup()
{
if (debugButtonMenu)
qDebug() << "Creating " << m_buttonGroup << " from " << m_buttonList;
QDesignerFormWindowInterface *fw = formWindow();
QDesignerFormEditorInterface *core = fw->core();
core->metaDataBase()->add(m_buttonGroup);
addButtonsToGroup();
// Make button group visible
core->objectInspector()->setFormWindow(fw);
}
示例11: widgetMode
ConnectDialog::WidgetMode ConnectDialog::widgetMode(QWidget *w, QDesignerFormWindowInterface *formWindow)
{
QDesignerFormEditorInterface *core = formWindow->core();
if (qt_extension<QDesignerLanguageExtension*>(core->extensionManager(), core))
return NormalWidget;
if (w == formWindow || formWindow->mainContainer() == w)
return MainContainer;
if (isPromoted(formWindow->core(), w))
return PromotedWidget;
return NormalWidget;
}
示例12: adjustDragIndicator
void ToolBarEventFilter::adjustDragIndicator(const QPoint &pos)
{
if (QDesignerFormWindowInterface *fw = formWindow()) {
QDesignerFormEditorInterface *core = fw->core();
if (QDesignerActionProviderExtension *a = qt_extension<QDesignerActionProviderExtension*>(core->extensionManager(), m_toolBar))
a->adjustIndicator(pos);
}
}
示例13: updateCustomWidgetPlugins
void QDesignerIntegrationPrivate::updateCustomWidgetPlugins()
{
QDesignerFormEditorInterface *formEditor = q->core();
if (QDesignerPluginManager *pm = formEditor->pluginManager())
pm->registerNewPlugins();
initializePlugins(formEditor);
// Do not just reload the last file as the WidgetBox merges the compiled-in resources
// and $HOME/.designer/widgetbox.xml. This would also double the scratchpad.
if (QDesignerWidgetBox *wb = qobject_cast<QDesignerWidgetBox*>(formEditor->widgetBox())) {
const QDesignerWidgetBox::LoadMode oldLoadMode = wb->loadMode();
wb->setLoadMode(QDesignerWidgetBox::LoadCustomWidgetsOnly);
wb->load();
wb->setLoadMode(oldLoadMode);
}
}
示例14: handleMousePressEvent
bool ToolBarEventFilter::handleMousePressEvent(QMouseEvent *event)
{
if (event->button() != Qt::LeftButton || withinHandleArea(m_toolBar, event->pos()))
return false;
if (QDesignerFormWindowInterface *fw = formWindow()) {
QDesignerFormEditorInterface *core = fw->core();
// Keep selection in sync
fw->clearSelection(false);
if (QDesignerObjectInspector *oi = qobject_cast<QDesignerObjectInspector *>(core->objectInspector())) {
oi->clearSelection();
oi->selectObject(m_toolBar);
}
core->propertyEditor()->setObject(m_toolBar);
}
m_startPosition = m_toolBar->mapFromGlobal(event->globalPos());
event->accept();
return true;
}
示例15: formWindow
void TabOrderEditor::initTabOrder()
{
m_tab_order_list.clear();
QDesignerFormEditorInterface *core = formWindow()->core();
if (const QDesignerMetaDataBaseItemInterface *item = core->metaDataBase()->item(formWindow())) {
m_tab_order_list = item->tabOrder();
}
// Remove any widgets that have been removed form the form
for (int i = 0; i < m_tab_order_list.size(); ) {
QWidget *w = m_tab_order_list.at(i);
if (!formWindow()->mainContainer()->isAncestorOf(w) || skipWidget(w))
m_tab_order_list.removeAt(i);
else
++i;
}
// Append any widgets that are in the form but are not in the tab order
QDesignerFormWindowCursorInterface *cursor = formWindow()->cursor();
for (int i = 0; i < cursor->widgetCount(); ++i) {
QWidget *widget = cursor->widget(i);
if (skipWidget(widget))
continue;
if (!m_tab_order_list.contains(widget))
m_tab_order_list.append(widget);
}
m_indicator_region = QRegion();
for (int i = 0; i < m_tab_order_list.size(); ++i) {
if (m_tab_order_list.at(i)->isVisible())
m_indicator_region |= indicatorRect(i);
}
if (m_current_index >= m_tab_order_list.size())
m_current_index = m_tab_order_list.size() - 1;
if (m_current_index < 0)
m_current_index = 0;
}