• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ setItemDelegate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中setItemDelegate函数的典型用法代码示例。如果您正苦于以下问题:C++ setItemDelegate函数的具体用法?C++ setItemDelegate怎么用?C++ setItemDelegate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setItemDelegate函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: QListView

ConditionWidget::ConditionWidget(ComplexCondition* condition, QWidget *parent) :
    QListView(parent)
{
    mModel = new QStandardItemModel(this);
    setModel(mModel);
    setEditTriggers(QAbstractItemView::NoEditTriggers);
    setItemDelegate(new ConditionWidgetDelegate(this));
    setCondition(condition);
    setContextMenuPolicy(Qt::ActionsContextMenu);
    mSelectedCondition = 0;

    QAction* deleteAction = new QAction(QIcon(":/media/delete.png"), tr("Delete"), this);
    deleteAction->setShortcut(QKeySequence::Delete);
    deleteAction->setShortcutContext(Qt::WidgetShortcut);
    addAction(deleteAction);
    connect(deleteAction, SIGNAL(triggered()), this, SLOT(onDeleteTriggered()));
}
开发者ID:fr33mind,项目名称:Belle,代码行数:17,代码来源:condition_widget.cpp


示例2: QTreeWidget

LayerTreeWidget::LayerTreeWidget(QWidget *parent) :
  QTreeWidget(parent)
{
  m_itemDelegate = new MyItemDelegate(this);
  setItemDelegate(m_itemDelegate);

//  QAction* act = new QAction("Select All", this);
//  act->setShortcut(QKeySequence("Ctrl+A"));
//  act->setShortcutContext(Qt::WidgetWithChildrenShortcut);
//  connect(act, SIGNAL(triggered()), SLOT(selectAll()));
//  this->addAction(act);

  setDragEnabled(true);
  viewport()->setAcceptDrops(true);
  setDropIndicatorShown(true);
  setDragDropMode(QAbstractItemView::InternalMove);
}
开发者ID:zkaufman,项目名称:freesurfer,代码行数:17,代码来源:LayerTreeWidget.cpp


示例3: QTreeWidget

PlayerListWidget::PlayerListWidget(TabSupervisor *_tabSupervisor, AbstractClient *_client, TabGame *_game, QWidget *parent)
    : QTreeWidget(parent), tabSupervisor(_tabSupervisor), client(_client), game(_game), gameStarted(false)
{
    readyIcon = QIcon(":/resources/icon_ready_start.svg");
    notReadyIcon = QIcon(":/resources/icon_not_ready_start.svg");
    concededIcon = QIcon(":/resources/icon_conceded.svg");
    playerIcon = QIcon(":/resources/icon_player.svg");
    spectatorIcon = QIcon(":/resources/icon_spectator.svg");
    lockIcon = QIcon(":/resources/lock.svg");
    
    if (tabSupervisor) {
        itemDelegate = new PlayerListItemDelegate(this);
        setItemDelegate(itemDelegate);
        
        userContextMenu = new UserContextMenu(tabSupervisor, this, game);
        connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
    } else
开发者ID:Akira586,项目名称:Cockatrice,代码行数:17,代码来源:playerlistwidget.cpp


示例4: TreeListWidget

TupItemManager::TupItemManager(QWidget *parent) : TreeListWidget(parent), m_currentFolder(0)
{
    currentSelection = "";
    setHeaderLabels(QStringList() << "" << "");

    header()->setSectionResizeMode(QHeaderView::ResizeToContents);

    setItemDelegate(new TupTreeDelegate(this));
    setColumnCount(3);

    setAcceptDrops(true);
    setDragEnabled(true);
    setDropIndicatorShown(true); 
    setDragDropMode(QAbstractItemView::InternalMove);

    foldersTotal = 1;
}
开发者ID:xtingray,项目名称:tupi,代码行数:17,代码来源:tupitemmanager.cpp


示例5: QTreeView

QtPropertyEditor::QtPropertyEditor(QWidget *parent /* = 0 */)
	: QTreeView(parent)
	, updateTimeout(0)
	, doUpdateOnPaintEvent(false)
{
	curModel = new QtPropertyModel();
	setModel(curModel);

	curItemDelegate = new QtPropertyItemDelegate();
	setItemDelegate(curItemDelegate);

	QObject::connect(this, SIGNAL(clicked(const QModelIndex &)), this, SLOT(OnItemClicked(const QModelIndex &)));
	QObject::connect(this, SIGNAL(expanded(const QModelIndex &)), curItemDelegate, SLOT(expand(const QModelIndex &)));
	QObject::connect(this, SIGNAL(collapsed(const QModelIndex &)), curItemDelegate, SLOT(collapse(const QModelIndex &)));
	QObject::connect(curModel, SIGNAL(ItemEdited(const QString &, QtPropertyData *)), this, SLOT(OnItemEdited(const QString &, QtPropertyData *)));
	QObject::connect(&updateTimer, SIGNAL(timeout()), this, SLOT(OnUpdateTimeout()));
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:17,代码来源:QtPropertyEditor.cpp


示例6: QTreeView

TestLevelTreeView::TestLevelTreeView(TestLevelController* controller, QWidget* parent):
  QTreeView(parent),
  _controller(controller),
  _oldX(-1),
  _oldY(-1) {

  _delegate = new TestLevelTreeItemDelegate;
  setItemDelegate(_delegate);

  setItemsExpandable(false);

  connect(_delegate, SIGNAL(moveVertex(QModelIndex,int,bool)), this, SLOT(movingVertex(QModelIndex,int,bool)));
  connect(_controller, SIGNAL(update(void)), this, SLOT(expandAll(void)));
  connect(_controller, SIGNAL(selection(void)), this, SLOT(selection(void)));

  resize(375, 500);
}
开发者ID:vmichele,项目名称:PieceOfCake,代码行数:17,代码来源:TestLevelTreeView.cpp


示例7: setItemDelegate

void TreeView::init()
{
	if (!check())
	{
		return;
	}
	m_treeViewDelegate->setParent(this);
	setItemDelegate(m_treeViewDelegate);
	setModel(m_treeViewModel);
	setHeader(m_treeViewHeader);
	setAttribute(Qt::WA_TranslucentBackground);
	setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
	setFrameStyle(QFrame::NoFrame);
	//È¥µô×ó²à¿Õ°×
	setIndentation(0);
	setEditTriggers(TreeView::NoEditTriggers);
}
开发者ID:xylsxyls,项目名称:xueyelingshuang,代码行数:17,代码来源:TreeView.cpp


示例8: setModel

void XTableView::setTable()
{
  if (_model->tableName() == _tableName)
    return;
      
  if (!_tableName.isEmpty())
  {
    QString tablename=_tableName;
    if (!_schemaName.isEmpty())
      tablename = _schemaName + "." + tablename;
    _model->setTable(tablename,_keyColumns);
    
    setModel(_model);
    setItemDelegate(new XItemDelegate(this));
  //  setRelations();
  }
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:17,代码来源:xtableview.cpp


示例9: QTreeWidget

NTrashTree::NTrashTree(QWidget *parent) :
    QTreeWidget(parent)
{
    this->count = 0;
    QFont f = this->font();
    f.setPointSize(8);
    this->setFont(f);

    filterPosition = -1;
    // setup options
    this->setEditTriggers(QAbstractItemView::NoEditTriggers);
    this->setSelectionBehavior(QAbstractItemView::SelectRows);
    this->setSelectionMode(QAbstractItemView::ExtendedSelection);
    this->setRootIsDecorated(true);
    this->setSortingEnabled(false);
    this->header()->setVisible(false);
    this->setContentsMargins(10,10,10,10);
    //this->setStyleSheet("QTreeWidget {  border: none; background-color:transparent; }");

    // Build the root item
    QIcon icon(":trash.png");
    root = new QTreeWidgetItem(this);
    root->setIcon(0,icon);
    root->setData(0, Qt::UserRole, "root");
    root->setData(0, Qt::DisplayRole, tr("Trash"));
    QFont font = root->font(0);
    font.setBold(true);
    root->setFont(0,font);
    this->setMinimumHeight(1);
    this->addTopLevelItem(root);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    connect(this, SIGNAL(itemExpanded(QTreeWidgetItem*)), this, SLOT(calculateHeight()));
    connect(this, SIGNAL(itemCollapsed(QTreeWidgetItem*)), this, SLOT(calculateHeight()));
    connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(buildSelection()));

    restoreAction = contextMenu.addAction(tr("Restore Deleted Notes"));
    connect(restoreAction, SIGNAL(triggered()), SLOT(restoreAll()));
    contextMenu.addSeparator();
    expungeAction = contextMenu.addAction(tr("Empty Trash"));
    connect(expungeAction, SIGNAL(triggered()), this, SLOT(expungeAll()));

    setItemDelegate(new NTrashViewDelegate());
    this->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
    this->setFrameShape(QFrame::NoFrame);
}
开发者ID:Hexcles,项目名称:Nixnote2,代码行数:46,代码来源:ntrashtree.cpp


示例10: QListView

AnimationView::AnimationView( Project* project, QWidget *parent /*= 0 */ ) :
	QListView( parent )
{
	this->project = project;

	setFlow( QListView::LeftToRight );
	setItemDelegate(new AnimationViewDelegate);

	setDragEnabled( true );
	setAcceptDrops( true );
	setDropIndicatorShown( true );

	setDragDropMode( QAbstractItemView::DragDrop );
	setDefaultDropAction( Qt::MoveAction );

	setSelectionMode( ExtendedSelection );
}
开发者ID:vladimirgamalian,项目名称:composer,代码行数:17,代码来源:AnimationView.cpp


示例11: QTreeView

DISABLE_COMPILER_WARNINGS
#include <QApplication>
#include <QDragMoveEvent>
#include <QHeaderView>
#include <QKeyEvent>
#include <QMouseEvent>
RESTORE_COMPILER_WARNINGS

#include <time.h>
#include <set>

#if defined __linux__ || defined __APPLE__
#include "cfocusframestyle.h"
#endif

CFileListView::CFileListView(QWidget *parent) :
	QTreeView(parent),
	_controller(CController::get()),
	_panelPosition(UnknownPanel),
	_bHeaderAdjustmentRequired(true),
	_singleMouseClickValid(false),
	_shiftPressedItemSelected(false)
{
	setMouseTracking(true);
	setItemDelegate(new CFileListItemDelegate);
	connect(this, &QTreeView::doubleClicked, [this](const QModelIndex &idx) {

		_itemUnderCursorBeforeMouseClick = QModelIndex();
		_singleMouseClickValid = false;

		for(FileListViewEventObserver* observer: _eventObservers)
		{
			if (observer->fileListReturnPressOrDoubleClickPerformed(idx))
				break;
		}
	});

	QHeaderView * headerView = header();
	assert_r(headerView);

	headerView->installEventFilter(this);

#if defined __linux__ || defined __APPLE__
	setStyle(new CFocusFrameStyle);
#endif
}
开发者ID:antis81,项目名称:file-commander,代码行数:46,代码来源:cfilelistview.cpp


示例12: QTreeWidget

TagListWidget::TagListWidget( QWidget* parent ) 
             : QTreeWidget( parent )
			 , m_currentReply( 0 )
{
    setColumnCount( 2 );
    setRootIsDecorated( false );
    setContextMenuPolicy( Qt::CustomContextMenu );
    setFrameStyle( NoFrame );
    setAlternatingRowColors( true );
    setDragEnabled( true );

    class TallerRowDelegate : public QItemDelegate
    {
        virtual QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const
        {
            return QItemDelegate::sizeHint( option, index ) + QSize( 0, 4 );
        }
    };

    setItemDelegate( new TallerRowDelegate );
    
    QTreeWidget::hideColumn( 1 );
    QTreeWidget::header()->hide();
    
    m_menu = new QMenu( this );
    QActionGroup* group = new QActionGroup( this );
    
    QAction* a = m_menu->addAction( tr( "Sort by Popularity" ) );
    connect( a, SIGNAL(triggered()), SLOT(sortByPopularity()) );
    group->addAction( a );
    a->setCheckable( true );
    a->setChecked( true );

    a = m_menu->addAction( tr( "Sort Alphabetically" ) );
    connect( a, SIGNAL(triggered()), SLOT(sortAlphabetically()) );
    group->addAction( a );
    a->setCheckable( true );
    
    m_menu->addSeparator();
    a = m_menu->addAction( tr("Open Last.fm Page for this Tag") );
    connect( a, SIGNAL(triggered()), SLOT(openTagPageForCurrentItem()) );
    
    connect( this, SIGNAL(customContextMenuRequested( QPoint )), SLOT(showMenu( QPoint )) );
    connect( this, SIGNAL(doubleClicked( const QModelIndex& )), SLOT(onDoubleClicked ( const QModelIndex& )) );
}
开发者ID:AICIDNN,项目名称:lastfm-desktop,代码行数:45,代码来源:TagListWidget.cpp


示例13: QComboBox

AddressWidget::AddressWidget(Window *window, QWidget *parent) : QComboBox(parent),
    m_window(NULL),
    m_completer(new QCompleter(AddressCompletionModel::getInstance(), this)),
    m_bookmarkLabel(NULL),
    m_feedsLabel(NULL),
    m_loadPluginsLabel(NULL),
    m_urlIconLabel(NULL),
    m_removeModelTimer(0),
    m_isHistoryDropdownEnabled(SettingsManager::getValue(QLatin1String("AddressField/EnableHistoryDropdown")).toBool()),
    m_isUsingSimpleMode(false),
    m_wasPopupVisible(false)
{
    m_completer->setCaseSensitivity(Qt::CaseInsensitive);
    m_completer->setCompletionMode(QCompleter::InlineCompletion);
    m_completer->setCompletionRole(Qt::DisplayRole);
    m_completer->setFilterMode(Qt::MatchStartsWith);

    setEditable(true);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    setMinimumWidth(100);
    setItemDelegate(new AddressDelegate(this));
    setInsertPolicy(QComboBox::NoInsert);
    setWindow(window);

    lineEdit()->setCompleter(m_completer);
    lineEdit()->setStyleSheet(QLatin1String("QLineEdit {background:transparent;}"));
    lineEdit()->setMouseTracking(true);
    lineEdit()->installEventFilter(this);

    ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parent);

    if (toolBar)
    {
        optionChanged(QLatin1String("AddressField/ShowBookmarkIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowBookmarkIcon")));
        optionChanged(QLatin1String("AddressField/ShowUrlIcon"), SettingsManager::getValue(QLatin1String("AddressField/ShowUrlIcon")));

        lineEdit()->setPlaceholderText(tr("Enter address or search…"));

        connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));

        if (toolBar->getIdentifier() != ToolBarsManager::NavigationBar)
        {
            connect(toolBar, SIGNAL(windowChanged(Window*)), this, SLOT(setWindow(Window*)));
        }
    }
开发者ID:zhengw1985,项目名称:otter-browser,代码行数:45,代码来源:AddressWidget.cpp


示例14: QTreeView

MessagesTreeView::MessagesTreeView(QWidget *parent) : QTreeView(parent)
{
    setRootIsDecorated(true);
    setItemsExpandable(true);
    setUniformRowHeights(true);
    setAlternatingRowColors(true);
    QPalette pal = palette();
    setPalette(pal);

    setSelectionBehavior(QAbstractItemView::SelectRows);
    setSelectionMode(QAbstractItemView::SingleSelection);

    setItemDelegate(new MessagesItemDelegate(this));
    header()->setSortIndicatorShown(true);
    header()->setClickable(true);
    header()->setMovable(false);
    setSortingEnabled(true);
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:18,代码来源:messagestreeview.cpp


示例15: setItemDelegate

void TCellView::setup()
{
    setItemDelegate(new TCellViewItemDelegate(this));

    setSelectionBehavior(QAbstractItemView::SelectItems);
    setSelectionMode(QAbstractItemView::SingleSelection);

    verticalHeader()->hide();
    horizontalHeader()->hide();

    setItemSize(18, 18);

    // horizontalHeader()->setResizeMode(QHeaderView::Custom);
    // verticalHeader()->setResizeMode(QHeaderView::Custom);

    horizontalHeader()->setSectionResizeMode(QHeaderView::Custom);
    verticalHeader()->setSectionResizeMode(QHeaderView::Custom);
}
开发者ID:KDE,项目名称:tupi,代码行数:18,代码来源:tcellview.cpp


示例16: QListWidget

SymbolView::SymbolView(QWidget* parent) : QListWidget(parent)
{
	setDragEnabled(true);
	setViewMode(QListView::IconMode);
	setFlow(QListView::LeftToRight);
	setSortingEnabled(true);
	setWrapping(true);
	setAcceptDrops(true);
	setDropIndicatorShown(true);
	setDragDropMode(QAbstractItemView::DragDrop);
	setResizeMode(QListView::Adjust);
	setSelectionMode(QAbstractItemView::SingleSelection);
	setContextMenuPolicy(Qt::CustomContextMenu);
	delegate = new ScListWidgetDelegate(this, this);
	setItemDelegate(delegate);
	setIconSize(QSize(48, 48));
	connect(this, SIGNAL(customContextMenuRequested (const QPoint &)), this, SLOT(HandleContextMenu(QPoint)));
}
开发者ID:pvanek,项目名称:scribus-cuba-trunk,代码行数:18,代码来源:symbolpalette.cpp


示例17: m_textColumnDefaultWidth

TodoOutputTreeView::TodoOutputTreeView(QWidget *parent) :
    Utils::TreeView(parent),
    m_textColumnDefaultWidth(0),
    m_fileColumnDefaultWidth(0)
{
    setRootIsDecorated(false);
    setFrameStyle(QFrame::NoFrame);
    setSortingEnabled(true);
    setAttribute(Qt::WA_MacShowFocusRect, false);
    setSelectionBehavior(QTreeView::SelectRows);
    setItemDelegate(new TodoOutputTreeViewDelegate(this));

    header()->setSectionResizeMode(QHeaderView::Interactive);
    header()->setStretchLastSection(true);
    header()->setSectionsMovable(false);
    connect(header(), SIGNAL(sectionResized(int,int,int)), SLOT(todoColumnResized(int,int,int)));
    loadDisplaySettings();
}
开发者ID:AgnosticPope,项目名称:qt-creator,代码行数:18,代码来源:todooutputtreeview.cpp


示例18: QTableWidget

CrosswordGrid::CrosswordGrid( QWidget* parent )
    : QTableWidget( parent )
    , m_puzzle( 0 )
    , m_focusOrientation( FocusHorizontal )
    , m_selectedNumber( 0 )
{
    setEditTriggers( QAbstractItemView::NoEditTriggers );
    setSelectionMode( QAbstractItemView::SingleSelection );
    setSortingEnabled( false );

    setItemDelegate( new CrosswordCellDelegate(this) );

    horizontalHeader()->hide();
    verticalHeader()->hide();
    
    connect( this, SIGNAL( currentCellChanged(int, int, int, int) ),
             this, SLOT  ( cellSelectedChanged() ) );
}
开发者ID:sebr,项目名称:crossie,代码行数:18,代码来源:CrosswordGrid.cpp


示例19: QComboBox

AMPenStyleComboBox::AMPenStyleComboBox(QWidget *parent) :
	QComboBox(parent)
{
	setToolTip(QString("Line Style"));



	for(int iPenStyle = Qt::NoPen, lastPenStyle = Qt::CustomDashLine;
		iPenStyle < lastPenStyle; ++iPenStyle)
	{
		addItem(QString(), QVariant(iPenStyle));
	}

	setItemDelegate(new AMPenStyleDelegate(this));
	setCurrentIndex(1);
	connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onCurrentIndexChanged(int)));

}
开发者ID:acquaman,项目名称:acquaman,代码行数:18,代码来源:AMPenStyleComboBox.cpp


示例20: AutoExpandingTreeView

DeviceView::DeviceView(QWidget* parent)
  : AutoExpandingTreeView(parent),
    app_(NULL),
    merged_model_(NULL),
    sort_model_(NULL),
    properties_dialog_(new DeviceProperties),
    device_menu_(NULL),
    library_menu_(NULL)
{
  setItemDelegate(new DeviceItemDelegate(this));
  SetExpandOnReset(false);
  setAttribute(Qt::WA_MacShowFocusRect, false);
  setHeaderHidden(true);
  setAllColumnsShowFocus(true);
  setDragEnabled(true);
  setDragDropMode(QAbstractItemView::DragOnly);
  setSelectionMode(QAbstractItemView::ExtendedSelection);
}
开发者ID:BrummbQ,项目名称:Clementine,代码行数:18,代码来源:deviceview.cpp



注:本文中的setItemDelegate函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ setKey函数代码示例发布时间:2022-05-30
下一篇:
C++ setItem函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap