当前位置: 首页>>代码示例>>C++>>正文


C++ setSelectionBehavior函数代码示例

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


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

示例1: QTreeWidget

//----------------------------------------------------------------------------------------
OfsTreeWidget::OfsTreeWidget(QWidget *parent, unsigned int capabilities, QStringList initialSelection) : QTreeWidget(parent), mCapabilities(capabilities) 
{
    mSelectedItems = initialSelection;
    mRecycleBinParent = NULL;

    setColumnCount(1);
    setHeaderHidden(true);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setSelectionBehavior(QAbstractItemView::SelectItems);
    setContextMenuPolicy(Qt::CustomContextMenu);
    setDragDropOverwriteMode(false);
    setAutoScroll(true);
    
    if(capabilities & CAP_ALLOW_DROPS)
        setDragDropMode(QAbstractItemView::DragDrop);

    mUnknownFileIcon = mOgitorMainWindow->mIconProvider.icon(QFileIconProvider::File);

    mFile = Ogitors::OgitorsRoot::getSingletonPtr()->GetProjectFile();
    mFile->addTrigger(this, OFS::_OfsBase::CLBK_CREATE, &triggerCallback);
    mFile->addTrigger(this, OFS::_OfsBase::CLBK_DELETE, &triggerCallback);

    refreshWidget();

    mAddFilesThread = new AddFilesThread();
    mExtractorThread = new ExtractorThread();
    connect(mAddFilesThread, SIGNAL(finished()), this, SLOT(threadFinished()));
    connect(mExtractorThread, SIGNAL(finished()), this, SLOT(threadFinished()));
}
开发者ID:jacmoe,项目名称:ogitor,代码行数:30,代码来源:ofstreewidget.cpp

示例2: QTableView

QgsAttributeTableView::QgsAttributeTableView( QWidget *parent )
  : QTableView( parent )
  , mFilterModel( nullptr )
  , mFeatureSelectionModel( nullptr )
  , mFeatureSelectionManager( nullptr )
  , mActionPopup( nullptr )
  , mRowSectionAnchor( 0 )
  , mCtrlDragSelectionFlag( QItemSelectionModel::Select )
{
  QgsSettings settings;
  restoreGeometry( settings.value( QStringLiteral( "BetterAttributeTable/geometry" ) ).toByteArray() );

  //verticalHeader()->setDefaultSectionSize( 20 );
  horizontalHeader()->setHighlightSections( false );

  // We need mouse move events to create the action button on hover
  mTableDelegate = new QgsAttributeTableDelegate( this );
  setItemDelegate( mTableDelegate );

  setEditTriggers( QAbstractItemView::AllEditTriggers );

  setSelectionBehavior( QAbstractItemView::SelectRows );
  setSelectionMode( QAbstractItemView::ExtendedSelection );
  setSortingEnabled( true ); // At this point no data is in the model yet, so actually nothing is sorted.
  horizontalHeader()->setSortIndicatorShown( false ); // So hide the indicator to avoid confusion.

  verticalHeader()->viewport()->installEventFilter( this );

  connect( verticalHeader(), &QHeaderView::sectionPressed, this, [ = ]( int row ) { selectRow( row, true ); } );
  connect( verticalHeader(), &QHeaderView::sectionEntered, this, &QgsAttributeTableView::_q_selectRow );
  connect( horizontalHeader(), &QHeaderView::sectionResized, this, &QgsAttributeTableView::columnSizeChanged );
  connect( horizontalHeader(), &QHeaderView::sortIndicatorChanged, this, &QgsAttributeTableView::showHorizontalSortIndicator );
  connect( QgsGui::mapLayerActionRegistry(), &QgsMapLayerActionRegistry::changed, this, &QgsAttributeTableView::recreateActionWidgets );
}
开发者ID:exlimit,项目名称:QGIS,代码行数:34,代码来源:qgsattributetableview.cpp

示例3: QTableWidget

QQuestionsTableWidget::QQuestionsTableWidget(QWidget *parent,unsigned int rating, unsigned int choice_count) :
    QTableWidget(parent),
    RATING(rating),
    CHOICE_COUNT(choice_count),
    shortcut_new(QKeySequence(Qt::CTRL + Qt::Key_N),this)
{
    table_width = -1;
    QStringList sl;
    sl << tr("Вопрос");
    for (unsigned int i = 0; i < CHOICE_COUNT; i++)
        sl << tr("Ответ №%1").arg(QString::number(i + 1));
    sl << tr("Правильный ответ");
    if (RATING)
        sl << tr("Сложность");
    setColumnCount(sl.count());
    setHorizontalHeaderLabels(sl);
    initMenu();
    setSelectionBehavior(SelectRows);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    connect(this,SIGNAL(itemChanged(QTableWidgetItem*)),this,SIGNAL(signalNeedSave()));
    connect(&shortcut_new,SIGNAL(activated()),this,SLOT(addQuestionRow()));

}
开发者ID:ed-soiam,项目名称:Quiz,代码行数:25,代码来源:qquestionstablewidget.cpp

示例4: QTableView

QgsAttributeTableView::QgsAttributeTableView( QWidget *parent )
    : QTableView( parent )
    , mMasterModel( NULL )
    , mFilterModel( NULL )
    , mFeatureSelectionModel( NULL )
    , mFeatureSelectionManager( NULL )
    , mModel( NULL )
    , mActionPopup( NULL )
    , mLayerCache( NULL )
    , mRowSectionAnchor( 0 )
    , mCtrlDragSelectionFlag( QItemSelectionModel::Select )
{
  QSettings settings;
  restoreGeometry( settings.value( "/BetterAttributeTable/geometry" ).toByteArray() );

  //verticalHeader()->setDefaultSectionSize( 20 );
  horizontalHeader()->setHighlightSections( false );

  mTableDelegate = new QgsAttributeTableDelegate( this );
  setItemDelegate( mTableDelegate );

  setSelectionBehavior( QAbstractItemView::SelectRows );
  setSelectionMode( QAbstractItemView::ExtendedSelection );
  setSortingEnabled( true );

  verticalHeader()->viewport()->installEventFilter( this );

  connect( verticalHeader(), SIGNAL( sectionPressed( int ) ), this, SLOT( selectRow( int ) ) );
  connect( verticalHeader(), SIGNAL( sectionEntered( int ) ), this, SLOT( _q_selectRow( int ) ) );
}
开发者ID:dakcarto,项目名称:QGIS,代码行数:30,代码来源:qgsattributetableview.cpp

示例5: setColumnCount

CodeViewWidget::CodeViewWidget()
{
  setColumnCount(5);
  setShowGrid(false);
  setContextMenuPolicy(Qt::CustomContextMenu);
  setSelectionMode(QAbstractItemView::SingleSelection);
  setSelectionBehavior(QAbstractItemView::SelectRows);

  setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

  for (int i = 0; i < columnCount(); i++)
  {
    horizontalHeader()->setSectionResizeMode(i, QHeaderView::Fixed);
  }

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

  setFont(Settings::Instance().GetDebugFont());

  Update();

  connect(this, &CodeViewWidget::customContextMenuRequested, this, &CodeViewWidget::OnContextMenu);
  connect(this, &CodeViewWidget::itemSelectionChanged, this, &CodeViewWidget::OnSelectionChanged);
  connect(&Settings::Instance(), &Settings::DebugFontChanged, this, &QWidget::setFont);
  connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this] {
    m_address = PC;
    Update();
  });

  connect(&Settings::Instance(), &Settings::ThemeChanged, this, &CodeViewWidget::Update);
}
开发者ID:MerryMage,项目名称:dolphin,代码行数:33,代码来源:CodeViewWidget.cpp

示例6: QTableView

TableView::TableView(QWidget *parent) : QTableView(parent)
{
    passModel = new PasswordModel;
    setModel(passModel);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    show();
}
开发者ID:upcomingGit,项目名称:PasswordManager,代码行数:7,代码来源:tableview.cpp

示例7: TreeView

START_NS

ModelViewReadOnly::ModelViewReadOnly(QWidget * parent):
	TreeView(parent)
{
	setHeaderHidden(true);
	//header()->setResizeMode(QHeaderView::Stretch);
	setRootIsDecorated(false);
	setIndentation(0);
	setExpandsOnDoubleClick(true);
	setItemDelegateForColumn(0, new ModelTreeDelegate());
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);

	setSelectionMode( SingleSelection );
	setSelectionBehavior(SelectRows);
	// we disable the provided dnd features,
	// as we use a proprietary solution
	setDragDropMode(QAbstractItemView::DragDrop);
	setDragEnabled(true);
	setAcceptDrops(false);


	overlay()->setText(tr("Please load a model"));

	connect(this, SIGNAL(clicked(QModelIndex)), this, SLOT(__clicked(QModelIndex)));
}
开发者ID:ohager,项目名称:kantalupe,代码行数:27,代码来源:ModelViewReadOnly.cpp

示例8: _column_config

DbTable::DbTable(list<ColumnConfig> cc,const litesql::Expr & expr,Wt::WContainerWidget * parent):
    Wt::Ext::TableView(parent),
    _column_config(cc),
    _sql(sql) {
    setBorder(false);
    model=new DbTableModel(cc,expr,parent);
    setModel(model);
    setAlternatingRowColors(true);
    resizeColumnsToContents(true);
    setHighlightMouseOver(true);
    setSelectionBehavior(Wt::SelectRows);
    setSelectionMode(Wt::SingleSelection);
    std::list<ColumnConfig>::iterator confit=cc.begin();
    for(int a=0; confit!=cc.end(); confit++, a++) {
//          enableColumnHiding(a, true);
//          setColumnSortable(a, true);
        setColumnWidth(a,(*confit).getWidth());
    }
    _clickCount=0;
    cellClicked().connect(SLOT(this,DbTable::itemSelected));
    doubleClickTimer=new Wt::WTimer(this);
    doubleClickTimer->setInterval(200);
    doubleClickTimer->timeout().connect(SLOT(this, DbTable::emitClickCount));

}
开发者ID:psychobob666,项目名称:MediaEncodingCluster,代码行数:25,代码来源:DbTable.cpp

示例9: QSortFilterProxyModel

UProcessView::UProcessView(QWidget *parent /*= 0*/)
:QTableView(parent)
,killProcessAction_(0)
,selectColumnAction_(0)
{
    //设置Model。
    QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
    UProcessModel *processModel = new UProcessModel(this);
    connect(this,SIGNAL(processTerminated(unsigned int)),processModel,SLOT(refresh()));

    proxyModel->setSourceModel(processModel);
    proxyModel->setDynamicSortFilter(true);
    proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    setModel(proxyModel);
    setSortingEnabled(true);
    
    setSelectionBehavior(QAbstractItemView::SelectRows);
    horizontalHeader()->setStretchLastSection(true);
    verticalHeader()->hide();
    setSelectionMode(QAbstractItemView::SingleSelection);

    setContextMenuPolicy(Qt::ActionsContextMenu);
    setupActions();

    setupConnections();
}
开发者ID:gauldoth,项目名称:UniCore,代码行数:26,代码来源:UProcessView.cpp

示例10: QTableView

AvailableMusicView::AvailableMusicView(DataStore *dataStore, QWidget *parent):
  QTableView(parent),
  dataStore(dataStore)
{
  setEditTriggers(QAbstractItemView::NoEditTriggers);
  availableMusicModel = new MusicModel(getDataQuery(), dataStore, this);
  setModel(availableMusicModel);
//  horizontalHeader()->setStretchLastSection(true);
  configHeaders();
  setSelectionBehavior(QAbstractItemView::SelectRows);
  setContextMenuPolicy(Qt::CustomContextMenu);
  createActions();
  connect(this, SIGNAL(customContextMenuRequested(const QPoint&)),
    this, SLOT(handleContextMenuRequest(const QPoint&)));
  connect(
    this,
    SIGNAL(activated(const QModelIndex&)),
    this,
    SLOT(addSongToActivePlaylist(const QModelIndex&)));
  connect(
    dataStore,
    SIGNAL(availableSongsModified()),
    availableMusicModel,
    SLOT(refresh()));
}
开发者ID:jeung2,项目名称:UDJ,代码行数:25,代码来源:AvailableMusicView.cpp

示例11: QTreeView

KNMusicStoreAlbumTreeView::KNMusicStoreAlbumTreeView(QWidget *parent) :
    QTreeView(parent),
    m_mouseAnime(new QTimeLine(200, this))
{
    //Set properties.
    setAllColumnsShowFocus(true);
    setAlternatingRowColors(false); //We will use our own alternating drawing.
    setContentsMargins(0, 0, 0, 0);
    setFrameShape(QFrame::NoFrame);
    setIndentation(0);
    setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
    setSelectionBehavior(QAbstractItemView::SelectRows);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setUniformRowHeights(true);
    setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);

    //Configure the time line.
    m_mouseAnime->setEasingCurve(QEasingCurve::OutCubic);
    m_mouseAnime->setUpdateInterval(10);
    //Link the time line.
    connect(m_mouseAnime, &QTimeLine::frameChanged,
            this, &KNMusicStoreAlbumTreeView::onActionMouseInOut);

    //Initial the sense header.
    KNMouseSenseHeader *header=new KNMouseSenseHeader(this);
    header->setSectionsMovable(false);
    header->setSectionsClickable(false);
    header->setFixedHeight(38);
    setHeader(header);

    //Link with theme manager.
    connect(knTheme, &KNThemeManager::themeChange,
            this, &KNMusicStoreAlbumTreeView::onActionThemeUpdate);
}
开发者ID:ZhenZinian,项目名称:Mu,代码行数:34,代码来源:knmusicstorealbumtreeview.cpp

示例12: setSelectionMode

void OnlineList::createViewTitle()
{
	// 只允许单选
	setSelectionMode(QAbstractItemView::SingleSelection);
	
	// 每次选中一行
	setSelectionBehavior(QAbstractItemView::SelectRows);
	
	// 默认不允许用户编辑数据
	setEditTriggers(QAbstractItemView::NoEditTriggers);
	
	// 使列完全填充并平分
	horizontalHeader()->setResizeMode(QHeaderView::Stretch);
	
	// 数据头左对齐
	horizontalHeader()->setDefaultAlignment(Qt::AlignHCenter);
	
	// 隐藏左边垂直列号
	// verticalHeader()->setVisible(false);
	// 设置列数
	setColumnCount(3);
	
	// 设置不显示格子线
	setShowGrid(false);
	
	// 设置表头
	setHorizontalHeaderItem(0, new QTableWidgetItem(tr("昵称")));
	setHorizontalHeaderItem(1, new QTableWidgetItem(tr("主机名")));
	setHorizontalHeaderItem(2, new QTableWidgetItem(tr("IP地址")));
}
开发者ID:hurley25,项目名称:xylchat,代码行数:30,代码来源:OnlineList.cpp

示例13: setItemDelegate

SessionView::SessionView(QWidget *parent)
    : Utils::TreeView(parent)
{
    setItemDelegate(new RemoveItemFocusDelegate(this));
    setSelectionBehavior(QAbstractItemView::SelectRows);
    setSelectionMode(QAbstractItemView::SingleSelection);
    setWordWrap(false);
    setRootIsDecorated(false);

    setModel(&m_sessionModel);

    // Ensure that the full session name is visible.
    header()->setSectionResizeMode(0, QHeaderView::ResizeToContents);

    QItemSelection firstRow(m_sessionModel.index(0,0), m_sessionModel.index(
        0, m_sessionModel.columnCount() - 1));
    selectionModel()->select(firstRow, QItemSelectionModel::QItemSelectionModel::
        SelectCurrent);

    connect(this, &Utils::TreeView::activated, [this](const QModelIndex &index){
        emit activated(m_sessionModel.sessionAt(index.row()));
    });
    connect(selectionModel(), &QItemSelectionModel::currentRowChanged, [this]
            (const QModelIndex &index) {
        emit selected(m_sessionModel.sessionAt(index.row()));
    });

    connect(&m_sessionModel, &SessionModel::sessionSwitched,
        this, &SessionView::sessionSwitched);
    connect(&m_sessionModel, &SessionModel::modelReset,
        this, &SessionView::selectActiveSession);
    connect(&m_sessionModel, &SessionModel::sessionCreated,
        this, &SessionView::selectSession);
 }
开发者ID:kai66673,项目名称:qt-creator,代码行数:34,代码来源:sessionview.cpp

示例14: QListView

ActionView::ActionView(QWidget * parent /*= nullptr*/)
    : QListView(parent)
    , mModel{new QStandardItemModel{this}}
    , mProxy{new QSortFilterProxyModel{this}}
    , mMaxItemsToShow(10)
{
    setEditTriggers(QAbstractItemView::NoEditTriggers);
    setSizeAdjustPolicy(AdjustToContents);
    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setSelectionBehavior(SelectRows);
    setSelectionMode(SingleSelection);

    SingleActivateStyle * s = new SingleActivateStyle;
    s->setParent(this);
    setStyle(s);
    mProxy->setSourceModel(mModel);
    mProxy->setDynamicSortFilter(true);
    mProxy->setFilterRole(FilterRole);
    mProxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
    mProxy->sort(0);
    {
        QScopedPointer<QItemSelectionModel> guard{selectionModel()};
        setModel(mProxy);
    }
    {
        QScopedPointer<QAbstractItemDelegate> guard{itemDelegate()};
        setItemDelegate(new DelayedIconDelegate{this});
    }
    connect(this, &QAbstractItemView::activated, this, &ActionView::onActivated);
}
开发者ID:jsm222,项目名称:lxqt-panel,代码行数:30,代码来源:actionview.cpp

示例15: setSelectionBehavior

void Sbrowse::configureView()
{
	setSelectionBehavior(QAbstractItemView::SelectRows);
	resizeColumnsToContents();
	horizontalHeader()->setStretchLastSection(true);
	selectRow(0);
}
开发者ID:newey499,项目名称:genlib,代码行数:7,代码来源:sbrowse.cpp


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