Название: Не могу засунуть свой тип в QList.... Отправлено: lolbla2 от Февраль 25, 2013, 06:43 Создал свой класс:
channel.h Код
channel.cpp Код почему при попытке засунуть его в QList<Channel> в списке данные превращаются в мусор? Засовываю вот так: Код
Получаю вывод: [09:42:22] Warning: size 156 [09:42:22] Warning: "" "" "" "" 147339080 147466176 [09:42:22] Warning: "" "" "" "" 147466080 147466208 [09:42:22] Warning: "" "" "" "" 147339080 147466176 [09:42:22] Warning: "" "" "" "" 147466080 147466208 [09:42:22] Warning: "" "" "" "" 147339080 147466176 [09:42:22] Warning: "" "" "" "" 147339080 147466208 [09:42:22] Warning: "" "" "" "" 147466256 147466176 [09:42:22] Warning: "" "" "" "" 147466256 147466208 [09:42:22] Warning: "" "" "" "" 147466256 147466176 [09:42:22] Warning: "" "" "" "" 147466256 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466720 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466176 [09:42:22] Warning: "" "" "" "" 147466464 147467472 [09:42:22] Warning: "" "" "" "" 147466464 147466208 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147339056 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147339056 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147339056 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147339056 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147339056 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147467464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 147466464 147466160 [09:42:22] Warning: "" "" "" "" 147466464 147468888 [09:42:22] Warning: "" "" "" "" 7143521 7208960 [09:42:22] Warning: "" "" "" "" 147466464 147465832 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 [09:42:22] Warning: "" "" "" "" 147466464 147468408 [09:42:22] Warning: "" "" "" "" 147466464 147468440 Название: Re: Не могу засунуть свой тип в QList.... Отправлено: Vass от Февраль 25, 2013, 08:08 Пустой конструктор копирования. Надо написать корректный.
Название: Re: Не могу засунуть свой тип в QList.... Отправлено: GreatSnake от Февраль 25, 2013, 08:17 Пустой конструктор копирования. Надо написать корректный. В данном случае удалить его вообще.Название: Re: Не могу засунуть свой тип в QList.... Отправлено: lolbla2 от Февраль 25, 2013, 08:32 Пустой конструктор копирования. Надо написать корректный. Да вот это уже выяснил, а что в нём по умолчанию? Не объявить его вообще я не могу ибо Q_DECLARE_METATYPE будет бузить что нет его. Название: Re: Не могу засунуть свой тип в QList.... Отправлено: GreatSnake от Февраль 25, 2013, 08:47 Код Ты засовываешь Channel и QList<Channel> в QVariant? Название: Re: Не могу засунуть свой тип в QList.... Отправлено: lolbla2 от Февраль 25, 2013, 09:14 Код Ты засовываешь Channel и QList<Channel> в QVariant? Пока нет, но может и понадобится засунуть в вариант. А вообще нужно для того чтобы использовать в сигналах слотах свой тип, сигнал channelsReceived(QList<Channels>). Так-то сигналы и слоты работают, но плювался ворнингом QMetaProperty::read: Unable to handle unregistered datatype 'QList<Channel>' for property 'QDeclarativeBoundSignalParameters::channels'. Сейчас чот пропал этот ворнинг, хотя вроде ничего такого не делал, а наоборот убрал эти Q_DECLARE_METATYPE Название: Re: Не могу засунуть свой тип в QList.... Отправлено: Vass от Февраль 25, 2013, 13:50 Да вот это уже выяснил, а что в нём по умолчанию? Не объявить его вообще я не могу ибо Q_DECLARE_METATYPE будет бузить что нет его. По умолчанию в нем поверхностное копирование всех полей, в конкретно вашем случае просто приравняйте всем членам класса их же аналоги из объекта other |