//==============================================================================
TextPropertyComponent::TextPropertyComponent (const String& name,
                                              const int maxNumChars,
                                              const bool isMultiLine)
    : PropertyComponent (name)
{
    createEditor (maxNumChars, isMultiLine);
}
예제 #2
0
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);
}
예제 #3
0
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);
    }
}
예제 #4
0
//==============================================================================
TextPropertyComponent::TextPropertyComponent (const String& name,
                                              int maxNumChars,
                                              bool multiLine,
                                              bool isEditable)
    : PropertyComponent (name),
      isMultiLine (multiLine)
{
    createEditor (maxNumChars, isEditable);
}
예제 #5
0
 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 );
 }
예제 #6
0
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);
}
예제 #8
0
bool DevGUI::load(const QString &f)
{
    if (!QFile::exists(f))
        return false;
    
    if (f.endsWith(".pro"))
    	return loadProject(f);
    
    createEditor(f);
    
    return true;
}
예제 #9
0
Widget *SourceEditor::XmlElement::restoreWidget()
{
    Editor *editor = createEditor();
    if (!editor)
        return NULL;
    if (!static_cast<SourceEditor *>(editor)->restore(*this))
    {
        editor->close();
        return NULL;
    }
    return editor;
}
예제 #10
0
//------------------------------------------------------------------------------------
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));
}
예제 #11
0
void SKKInputSession::Clear() {
    if(inEvent_) return;

    scoped_flag on(inEvent_);

    while(stack_.size()) {
        popEditor();
    }

    stack_.push_back(createEditor(new SKKPrimaryEditor(&context_)));

    top()->Output();
}
예제 #12
0
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();
}
예제 #13
0
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);
}
예제 #14
0
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);
	}
}
예제 #16
0
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();
    }
}
예제 #17
0
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;
}
예제 #19
0
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;
}
예제 #20
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;
    }
}
예제 #21
0
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;
}
예제 #22
0
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);
}
예제 #23
0
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);
}
예제 #24
0
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);
    }
}
예제 #25
0
void DevGUI::fileNew()
{
    createEditor();
}
예제 #26
0
QWidget *CSVWorld::IdCompletionDelegate::createEditor(QWidget *parent,
                                                      const QStyleOptionViewItem &option,
                                                      const QModelIndex &index) const
{
    return createEditor(parent, option, index, getDisplayTypeFromIndex(index));
}
예제 #27
0
파일: util.cpp 프로젝트: Kleptoid/openmw
QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleOptionViewItem& option,
    const QModelIndex& index) const
{
    return createEditor (parent, option, index, CSMWorld::ColumnBase::Display_None);
}
예제 #28
0
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);
}
예제 #29
0
void Spinner::setModel(SpinnerModelPtr model)
{
    _Model = model;
    setEditor(ComponentUnrecPtr(createEditor(_Model)));
}
예제 #30
0
SKKInputSession::SKKInputSession(SKKInputSessionParameter* param)
    : param_(param)
    , context_(param->FrontEnd())
    , inEvent_(false) {
    stack_.push_back(createEditor(new SKKPrimaryEditor(&context_)));
}