From 851b658298afb9bafeda98ffbfa2ade612c656be Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Sun, 2 Jun 2019 22:17:11 +0200 Subject: New upstream version 2.1.0~rc6+repack --- MetaDataRegistry.cpp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'MetaDataRegistry.cpp') diff --git a/MetaDataRegistry.cpp b/MetaDataRegistry.cpp index bf2aab5d..e66a4300 100644 --- a/MetaDataRegistry.cpp +++ b/MetaDataRegistry.cpp @@ -14,16 +14,35 @@ #include "WFPalette.hpp" #include "models/IARURegions.hpp" #include "models/DecodeHighlightingModel.hpp" -#include "widgets/FrequencyLineEdit.hpp" +#include "widgets/DateTimeEdit.hpp" -QItemEditorFactory * item_editor_factory () +namespace { - static QItemEditorFactory * our_item_editor_factory = new QItemEditorFactory; - return our_item_editor_factory; + class ItemEditorFactory final + : public QItemEditorFactory + { + public: + ItemEditorFactory () + : default_factory_ {QItemEditorFactory::defaultFactory ()} + { + } + + QWidget * createEditor (int user_type, QWidget * parent) const override + { + auto editor = QItemEditorFactory::createEditor (user_type, parent); + return editor ? editor : default_factory_->createEditor (user_type, parent); + } + + private: + QItemEditorFactory const * default_factory_; + }; } void register_types () { + auto item_editor_factory = new ItemEditorFactory; + QItemEditorFactory::setDefaultFactory (item_editor_factory); + // types in Radio.hpp are registered in their own translation unit // as they are needed in the wsjtx_udp shared library too @@ -31,9 +50,7 @@ void register_types () // used as signal/slot connection arguments since the new Qt 5.5 // Q_ENUM macro only seems to register the unqualified name - item_editor_factory ()->registerEditor (qMetaTypeId (), new QStandardItemEditorCreator ()); - //auto frequency_delta_type_id = qRegisterMetaType ("FrequencyDelta"); - item_editor_factory ()->registerEditor (qMetaTypeId (), new QStandardItemEditorCreator ()); + item_editor_factory->registerEditor (qMetaTypeId (), new QStandardItemEditorCreator ()); // Frequency list model qRegisterMetaTypeStreamOperators ("Item_v2"); -- cgit v1.2.3