久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

我可以為 QObject 的子類設(shè)置復(fù)制構(gòu)造函數(shù)嗎?

Could I have copy constructor for subclass of QObject?(我可以為 QObject 的子類設(shè)置復(fù)制構(gòu)造函數(shù)嗎?)
本文介紹了我可以為 QObject 的子類設(shè)置復(fù)制構(gòu)造函數(shù)嗎?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

這里 我們可以讀到?jīng)]有復(fù)制構(gòu)造和復(fù)制賦值運(yùn)算符可評(píng)估.但是這里我們可以讀到qRegisterMetaTypeQ_DECLARE_METATYPE 必須有公共默認(rèn)構(gòu)造函數(shù)、公共復(fù)制構(gòu)造函數(shù)和公共析構(gòu)函數(shù).問題是:誰(shuí)在說謊?還是我沒有正確理解?

Here we can read that no copy construct and copy assignment operator evaluable. But here we can read that qRegisterMetaType and Q_DECLARE_METATYPE have to have public default constructor, public copy constructor and public destructor. The question is: who is telling a lie? Or I did not understand it correctly?

推薦答案

一切都是真的:
1.QObject不能被復(fù)制,它的所有后代也不能被復(fù)制.
2. Q_DECLARE_METATYPE 接受帶有公共構(gòu)造函數(shù)、復(fù)制構(gòu)造函數(shù)和析構(gòu)函數(shù)的對(duì)象.

Everything is true:
1. QObject can't be copied and all its descendants can't be copied also.
2. Q_DECLARE_METATYPE accepts objects with public constructor, copy constructor and destructor.

沒有矛盾,因?yàn)槟悴荒苡?code>Q_DECLARE_METATYPE注冊(cè)QObject后代.

There is no contradiction, because you can't register QObject descendants with Q_DECLARE_METATYPE.

當(dāng)您將類轉(zhuǎn)換為 QVariant 時(shí),它使用復(fù)制構(gòu)造函數(shù)來復(fù)制您的對(duì)象:

When you convert your class to QVariant it uses a copy constructor to make a copy of your object:

 void *ptr = QMetaType::construct(x->type, copy);

這篇關(guān)于我可以為 QObject 的子類設(shè)置復(fù)制構(gòu)造函數(shù)嗎?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

How can I read and manipulate CSV file data in C++?(如何在 C++ 中讀取和操作 CSV 文件數(shù)據(jù)?)
In C++ why can#39;t I write a for() loop like this: for( int i = 1, double i2 = 0; (在 C++ 中,為什么我不能像這樣編寫 for() 循環(huán): for( int i = 1, double i2 = 0;)
How does OpenMP handle nested loops?(OpenMP 如何處理嵌套循環(huán)?)
Reusing thread in loop c++(在循環(huán) C++ 中重用線程)
Precise thread sleep needed. Max 1ms error(需要精確的線程睡眠.最大 1ms 誤差)
Is there ever a need for a quot;do {...} while ( )quot; loop?(是否需要“do {...} while ()?環(huán)形?)
主站蜘蛛池模板: 九九热在线精品 | 欧美性猛交99久久久久99按摩 | 国产又粗又大又硬 | 亚洲69视频 | 欧美一区二区在线播放 | 中文字幕在线观看免费 | 91午夜精品亚洲一区二区三区 | www国产视频| 在线性视频 | 免费观看av网站 | 高清一级片 | 国产黄色在线观看 | 黄色大片在线 | 天天操天| 日韩黄色免费视频 | 精品免费在线 | 一级欧美一级日韩 | 91av在线看 | 在线视频日韩 | 在线观看a视频 | 一级免费黄色片 | 色综合久久88 | 亚洲欧美成人 | 亚洲天堂影院 | 成年在线观看 | 在线观看日韩av | 97在线观看免费视频 | 日韩中文字幕在线播放 | 国产一区免费视频 | 可以免费看av的网站 | 亚洲精品一二三 | 欧美成人精品一区二区三区 | 亚洲精品乱码久久久久久动漫 | 亚洲看片 | 天天看天天干 | 天天色天天干天天 | 久久久免费观看 | 国产片一区二区 | 国产亚洲视频在线观看 | 国产一区中文字幕 | 黑人精品一区二区 |