首页| 论坛| 消息

标题:哪位大神能给解释一下setCellWidget(int,int,qwidget*)这个接口的实现原理
作者:菜鸟一个
日期:2019-02-21 10:32
内容:

想写一个类似于qtabelwidget的setCellWidget()的接口,可以在第三个参数传自己想用的控件,如checkbox,combobox等控件指针,比如我传一个checkbox*进去,传进去之后不是会向上转化成父类了吗,假如在不基于模型的情况下,怎么样知道我传的是checkbox*呢,哪位大神能给点意见


#1 [liudianwu 02-21 11:11]
自己if判断下实例化不就行了。
#2 回 liudianwu 的帖子 [菜鸟一个 02-21 14:43]
liudianwu:自己if判断下实例化不就行了。
 (2019-02-21 11:11) 
在没有模型的情况下,不知道委托类型,怎么确定是哪个控件呢
#3 回 liudianwu 的帖子 [automoblie0 02-21 15:48]
liudianwu:自己if判断下实例化不就行了。
 (2019-02-21 11:11) 
delegateType?
#4 [yysr 02-21 20:02]
// *************************************************************************************************
//
// QPropertyEditor v 0.3
//
// --------------------------------------
// Copyright (C) 2007 Volker Wiendl
// Acknowledgements to Roman alias banal from qt-apps.org for the Enum enhancement
//
//
// The QPropertyEditor Library is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation version 3 of the License
//
// The Horde3D Scene Editor is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.If not, see .
//
// *************************************************************************************************
#ifndef COLORSELECTIONBUTTON_H_
#define COLORSELECTIONBUTTON_H_
#include
class QSignalMapper;
/**
* This class is used to create the editor widgets for datatypes encapsulated in QVariant variables
*/
class QVariantDelegate : public QItemDelegate
{
Q_OBJECT
public:
/**
* Constructor
* @param parent optional parent object
*/
QVariantDelegate(QObject* parent = 0);
/// Destructor
virtual ~QVariantDelegate();
/**
* Creates an editor widget as child of a given widget for a specific QModelIndex
*
* @param parent the parent widget for the editor
* @param option some sty ..
#5 回 菜鸟一个 的帖子 [沉默小ai 04-30 15:03]
菜鸟一个:在没有模型的情况下,不知道委托类型,怎么确定是哪个控件呢 (2019-02-21 14:43) 
classnameQObject内的函数

回复 发表
主题 版块