ciao.
Ho questo codice(tratto da qt)che vorrei integrare nel mio codice:
file .cpp:
solo che non so come accedere alla classe , perchè il tipo è incluso in un namespace del file cpp e non posso includere un cpp , anche perchè il linker dopo mi da errore.codice:namespace qdesigner_internal { /* WidgetBoxCategoryModel, representing a list of category entries. Uses a * QAbstractListModel since the behaviour depends on the view mode of the list * view, it does not return text in the case of IconMode. */ class WidgetBoxCategoryModel : public QAbstractListModel { public: explicit WidgetBoxCategoryModel(QDesignerFormEditorInterface *core, QObject *parent = 0); // QAbstractListModel virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole); virtual Qt::ItemFlags flags (const QModelIndex & index ) const; virtual bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); // The model returns no text in icon mode, so, it also needs to know it QListView::ViewMode viewMode() const; void setViewMode(QListView::ViewMode vm); void addWidget(const QDesignerWidgetBoxInterface::Widget &widget, const QIcon &icon, bool editable); QDesignerWidgetBoxInterface::Widget widgetAt(const QModelIndex & index) const; QDesignerWidgetBoxInterface::Widget widgetAt(int row) const; int indexOfWidget(const QString &name); QDesignerWidgetBoxInterface::Category category() const; bool removeCustomWidgets(); private: typedef QList<WidgetBoxCategoryEntry> WidgetBoxCategoryEntrys; QRegExp m_classNameRegExp; QDesignerFormEditorInterface *m_core; WidgetBoxCategoryEntrys m_items; QListView::ViewMode m_viewMode; }; }
Esiste un modo rapio e pulito per accedere alla classe o devo spostare tutte le definizioni nel .h ?
Ed è un lavoro tremendo!
ma ci deve pur essere un perchè di come è fatto questo codice!
anche perchè non posso accedere al namespace da un altro punto , perchè il namespacece qdesigner_internal è nel c++!!
grazie

Rispondi quotando