//============================================================================== TextPropertyComponent::TextPropertyComponent (const String& name, const int maxNumChars, const bool isMultiLine) : PropertyComponent (name) { createEditor (maxNumChars, isMultiLine); }
void KexiDBAutoField::setColumnInfoInternal(KDbQueryColumnInfo* cinfo, KDbQueryColumnInfo* visibleColumnInfo) { // change widget type depending on field type if (d->widgetType_property == Auto) { WidgetType newWidgetType = Auto; KDbField::Type fieldType; if (cinfo) fieldType = visibleColumnInfo->field->type(); else if (dataSource().isEmpty()) fieldType = KDbField::InvalidType; else fieldType = KDbField::Text; if (fieldType != KDbField::InvalidType) { newWidgetType = KexiDBAutoField::widgetTypeForFieldType(fieldType); } if (d->widgetType != newWidgetType || newWidgetType == Auto) { d->widgetType = newWidgetType; createEditor(); } } // update label's text changeText((cinfo && d->autoCaption) ? cinfo->captionOrAliasOrName() : d->caption); KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>((QWidget*)subwidget()); if (iface) iface->setColumnInfo(visibleColumnInfo); }
QWidget* QItemDelegate_QtDShell::__override_createEditor(QWidget* parent0, const QStyleOptionViewItem& option1, const QModelIndex& index2, bool static_call) const { if (static_call) { return QItemDelegate::createEditor((QWidget* )parent0, (const QStyleOptionViewItem& )option1, (const QModelIndex& )index2); } else { return createEditor((QWidget* )parent0, (const QStyleOptionViewItem& )option1, (const QModelIndex& )index2); } }
//============================================================================== TextPropertyComponent::TextPropertyComponent (const String& name, int maxNumChars, bool multiLine, bool isEditable) : PropertyComponent (name), isMultiLine (multiLine) { createEditor (maxNumChars, isEditable); }
QWidget * createEditor( QWidget * parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const override { if ( index.column() == c_fcn ) { auto combo = new QComboBox( parent ); for ( int fcn = 0; fcn < index.data( Qt::UserRole + 1 ).toInt(); ++fcn ) combo->addItem( QString::number( fcn ) ); return combo; } return createEditor( parent, option, index ); }
void PropertyEditor::slotClicked(QListViewItem *item) { if (!item) return; PropertyEditorItem *i = static_cast<PropertyEditorItem *>(item); createEditor(i); justClickedItem = true; }
TextPropertyComponent::TextPropertyComponent (const Value& valueToControl, const String& name, const int maxNumChars, const bool isMultiLine) : PropertyComponent (name) { createEditor (maxNumChars, isMultiLine); textEditor->getTextValue().referTo (valueToControl); }
bool DevGUI::load(const QString &f) { if (!QFile::exists(f)) return false; if (f.endsWith(".pro")) return loadProject(f); createEditor(f); return true; }
Widget *SourceEditor::XmlElement::restoreWidget() { Editor *editor = createEditor(); if (!editor) return NULL; if (!static_cast<SourceEditor *>(editor)->restore(*this)) { editor->close(); return NULL; } return editor; }
//------------------------------------------------------------------------------------ TutorialVST2Effect::TutorialVST2Effect (audioMasterCallback audioMaster) : AudioEffectX (audioMaster, 1, kNumParameters) { setUniqueID (CCONST('G', 'U', 'I', '0')); setNumInputs (2); setNumOutputs (2); parameters[kLeftVolumeParameter] = 1.f; parameters[kRightVolumeParameter] = 1.f; extern AEffGUIEditor* createEditor (AudioEffectX*); setEditor (createEditor (this)); }
void SKKInputSession::Clear() { if(inEvent_) return; scoped_flag on(inEvent_); while(stack_.size()) { popEditor(); } stack_.push_back(createEditor(new SKKPrimaryEditor(&context_))); top()->Output(); }
void KexiDBComboBox::setEditable(bool set) { if (d->isEditable == set) return; d->isEditable = set; d->paintedCombo->setEditable(set); if (set) createEditor(); else { delete subwidget(); setSubwidget(0); } update(); }
void KexiDBAutoField::setInvalidState(const QString &text) { // Widget with an invalid dataSource is just a QLabel if (designMode()) return; d->widgetType = Auto; createEditor(); setFocusPolicy(Qt::NoFocus); if (subwidget()) subwidget()->setFocusPolicy(Qt::NoFocus); //! @todo or set this to editor's text? d->label->setText(text); }
void MainWindow::createListContextMenu() { m_listContextMenu = new QMenu; m_nodePropertyAct=m_listContextMenu->addAction(tr("Property")); m_removeNodeAct=m_listContextMenu->addAction(tr("Remove Slide")); //insertBeforeAct=m_listContextMenu->addAction(tr("InsertBefore")); //m_insertAfterAct=m_listContextMenu->addAction(tr("InsertAfter")); connect(m_nodePropertyAct,SIGNAL(triggered()),this,SLOT(createEditor())); connect(m_removeNodeAct,SIGNAL(triggered()),this,SLOT(removeItemInList())); //connect(insertBeforeAct,SIGNAL(triggered()),this,SLOT(insertBefore())); //connect(m_insertAfterAct,SIGNAL(triggered()),this,SLOT(insertAfter())); }
//============================================================================== CtrlrTextPropertyComponent::CtrlrTextPropertyComponent (const Value& _valueToControl, const int maxNumChars, const bool isMultiLine, const bool isReadOnly) : valueToControl(_valueToControl) { createEditor (maxNumChars, isMultiLine); textEditor->getTextValue().referTo (valueToControl); if (isReadOnly) { textEditor->setColour (Label::backgroundColourId, textEditor->findColour(Label::backgroundColourId,false).withAlpha(0.5f)); textEditor->setColour (Label::textColourId, textEditor->findColour(Label::textColourId,false).brighter(0.5f)); textEditor->setEditable (false, false, false); } }
void KexiDBAutoField::setWidgetType(WidgetType type) { const bool differ = (type != d->widgetType_property); d->widgetType_property = type; if (differ) { if (type == Auto) {// try to guess type from data source type if (visibleColumnInfo()) d->widgetType = KexiDBAutoField::widgetTypeForFieldType(visibleColumnInfo()->field->type()); else d->widgetType = Auto; } else d->widgetType = d->widgetType_property; createEditor(); } }
bool KexiReportFactory::startEditing(const QCString &c, QWidget *w, KFormDesigner::Container *container) { m_container = container; if(c == "Label") { QLabel *label = static_cast<QLabel*>(w); if(label->textFormat() == RichText) { m_widget = w; editText(); } else createEditor(c, label->text(), label, container, label->geometry(), label->alignment()); return true; } return false; }
AudioProcessorEditor* AudioProcessor::createEditorIfNeeded() { if (activeEditor != 0) return activeEditor; AudioProcessorEditor* const ed = createEditor(); if (ed != 0) { // you must give your editor comp a size before returning it.. jassert (ed->getWidth() > 0 && ed->getHeight() > 0); const ScopedLock sl (callbackLock); activeEditor = ed; } return ed; }
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch(msg) { case WM_CREATE: createEditor(hwnd); break; case WM_SIZE: resizeEditor(hwnd); break; case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: PostQuitMessage(0); break; case WM_COMMAND: switch(LOWORD(wParam)) { case ID_FILE_EXIT: PostMessage(hwnd, WM_CLOSE, 0, 0); break; case ID_FILE_NEW: SetDlgItemText(hwnd, IDC_MAIN_EDIT, ""); break; case ID_FILE_OPEN: openFile(hwnd); break; case ID_FILE_SAVEAS: saveFile(hwnd); break; case ID_EDIT_FONT: changeFont(hwnd); //InvalidateRect(hEdit, NULL, TRUE); //UpdateWindow(hEdit); break; } break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0; }
void SKKInputSession::endEvent() { switch(context_.registration) { case SKKRegistration::Started: context_.registration.Clear(); stack_.push_back(createEditor(new SKKRegisterEditor(&context_))); break; case SKKRegistration::Finished: case SKKRegistration::Aborted: if(stack_.size() != 1) { popEditor(); top()->Input(SKKEvent(context_.registration == SKKRegistration::Finished ? SKK_ENTER : SKK_CANCEL, 0)); } break; default: break; } }
AudioProcessorEditor* AudioProcessor::createEditorIfNeeded() { if (activeEditor != nullptr) return activeEditor; AudioProcessorEditor* const ed = createEditor(); // You must make your hasEditor() method return a consistent result! jassert (hasEditor() == (ed != nullptr)); if (ed != nullptr) { // you must give your editor comp a size before returning it.. jassert (ed->getWidth() > 0 && ed->getHeight() > 0); const ScopedLock sl (callbackLock); activeEditor = ed; } return ed; }
QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleOptionViewItem& option, const QModelIndex& index) const { CSMWorld::ColumnBase::Display display = getDisplayTypeFromIndex(index); // This createEditor() method is called implicitly from tables. // For boolean values in tables use the default editor (combobox). // Checkboxes is looking ugly in the table view. // TODO: Find a better solution? if (display == CSMWorld::ColumnBase::Display_Boolean) { return QItemEditorFactory::defaultFactory()->createEditor(QVariant::Bool, parent); } // For tables the pop-up of the color editor should appear immediately after the editor creation // (the third parameter of ColorEditor's constructor) else if (display == CSMWorld::ColumnBase::Display_Colour) { return new CSVWidget::ColorEditor(index.data().value<QColor>(), parent, true); } return createEditor (parent, option, index, display); }
void KexiDBAutoField::setFieldTypeInternal(int kexiDBFieldType) { d->fieldTypeInternal = (KexiDB::Field::Type)kexiDBFieldType; KexiDB::Field::Type fieldType; //find real fied type to use if (d->fieldTypeInternal == KexiDB::Field::InvalidType) { if (visibleColumnInfo()) fieldType = KexiDB::Field::Text; else fieldType = KexiDB::Field::InvalidType; } else fieldType = d->fieldTypeInternal; const WidgetType newWidgetType = KexiDBAutoField::widgetTypeForFieldType(fieldType); if (d->widgetType != newWidgetType) { d->widgetType = newWidgetType; createEditor(); } setFieldCaptionInternal(d->fieldCaptionInternal); }
ItemEditorWidget::ItemEditorWidget( const std::shared_ptr<ItemWidget> &itemWidget, const QModelIndex &index, bool editNotes, QWidget *parent) : QWidget(parent) , m_itemWidget(itemWidget) , m_index(index) , m_editor(nullptr) , m_noteEditor(nullptr) , m_toolBar(nullptr) , m_saveOnReturnKey(false) { m_noteEditor = editNotes ? new QPlainTextEdit(parent) : nullptr; QWidget *editor = editNotes ? m_noteEditor : createEditor(); if (editor == nullptr) { m_itemWidget = nullptr; } else { initEditor(editor); if (m_noteEditor != nullptr) m_noteEditor->setPlainText( index.data(contentType::notes).toString() ); else itemWidget->setEditorData(editor, index); } }
void DevGUI::fileNew() { createEditor(); }
QWidget *CSVWorld::IdCompletionDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { return createEditor(parent, option, index, getDisplayTypeFromIndex(index)); }
QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleOptionViewItem& option, const QModelIndex& index) const { return createEditor (parent, option, index, CSMWorld::ColumnBase::Display_None); }
void QtGroupBoxPropertyBrowserPrivate::propertyInserted(QtBrowserItem *index, QtBrowserItem *afterIndex) { WidgetItem *afterItem = m_indexToItem.value(afterIndex); WidgetItem *parentItem = m_indexToItem.value(index->parent()); WidgetItem *newItem = new WidgetItem(); newItem->parent = parentItem; QGridLayout *layout = 0; QWidget *parentWidget = 0; int row = -1; if (!afterItem) { row = 0; if (parentItem) parentItem->children.insert(0, newItem); else m_children.insert(0, newItem); } else { if (parentItem) { row = parentItem->children.indexOf(afterItem) + 1; parentItem->children.insert(row, newItem); } else { row = m_children.indexOf(afterItem) + 1; m_children.insert(row, newItem); } } if (parentItem && hasHeader(parentItem)) row += 2; if (!parentItem) { layout = m_mainLayout; parentWidget = q_ptr; } else { if (!parentItem->groupBox) { m_recreateQueue.removeAll(parentItem); WidgetItem *par = parentItem->parent; QWidget *w = 0; QGridLayout *l = 0; int oldRow = -1; if (!par) { w = q_ptr; l = m_mainLayout; oldRow = m_children.indexOf(parentItem); } else { w = par->groupBox; l = par->layout; oldRow = par->children.indexOf(parentItem); if (hasHeader(par)) oldRow += 2; } parentItem->groupBox = new QGroupBox(w); parentItem->layout = new QGridLayout(); parentItem->groupBox->setLayout(parentItem->layout); if (parentItem->label) { l->removeWidget(parentItem->label); delete parentItem->label; parentItem->label = 0; } if (parentItem->widget) { l->removeWidget(parentItem->widget); parentItem->widget->setParent(parentItem->groupBox); parentItem->layout->addWidget(parentItem->widget, 0, 0, 1, 2); parentItem->line = new QFrame(parentItem->groupBox); } else if (parentItem->widgetLabel) { l->removeWidget(parentItem->widgetLabel); delete parentItem->widgetLabel; parentItem->widgetLabel = 0; } if (parentItem->line) { parentItem->line->setFrameShape(QFrame::HLine); parentItem->line->setFrameShadow(QFrame::Sunken); parentItem->layout->addWidget(parentItem->line, 1, 0, 1, 2); } l->addWidget(parentItem->groupBox, oldRow, 0, 1, 2); updateItem(parentItem); } layout = parentItem->layout; parentWidget = parentItem->groupBox; } newItem->label = new QLabel(parentWidget); newItem->label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed)); newItem->widget = createEditor(index->property(), parentWidget); if (!newItem->widget) { newItem->widgetLabel = new QLabel(parentWidget); newItem->widgetLabel->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed)); newItem->widgetLabel->setTextFormat(Qt::PlainText); } else { QObject::connect(newItem->widget, SIGNAL(destroyed()), q_ptr, SLOT(slotEditorDestroyed())); m_widgetToItem[newItem->widget] = newItem; } insertRow(layout, row); int span = 1; if (newItem->widget) layout->addWidget(newItem->widget, row, 1); else if (newItem->widgetLabel) layout->addWidget(newItem->widgetLabel, row, 1); else span = 2; layout->addWidget(newItem->label, row, 0, 1, span); m_itemToIndex[newItem] = index; m_indexToItem[index] = newItem; updateItem(newItem); }
void Spinner::setModel(SpinnerModelPtr model) { _Model = model; setEditor(ComponentUnrecPtr(createEditor(_Model))); }
SKKInputSession::SKKInputSession(SKKInputSessionParameter* param) : param_(param) , context_(param->FrontEnd()) , inEvent_(false) { stack_.push_back(createEditor(new SKKPrimaryEditor(&context_))); }