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


C++ QTabWidget::blockSignals方法代码示例

本文整理汇总了C++中QTabWidget::blockSignals方法的典型用法代码示例。如果您正苦于以下问题:C++ QTabWidget::blockSignals方法的具体用法?C++ QTabWidget::blockSignals怎么用?C++ QTabWidget::blockSignals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTabWidget的用法示例。


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

示例1: setCurrentTab

void Tabs::setCurrentTab(int index, bool suppressSignals)
{
    QTabWidget *qtabwidget = static_cast<QTabWidget*>(getQWidget());
    bool oldSignalsState = qtabwidget->blockSignals(suppressSignals);
    qtabwidget->setCurrentIndex(index);
    qtabwidget->blockSignals(oldSignalsState);
}
开发者ID:fferri,项目名称:v_repExtCustomUI,代码行数:7,代码来源:Tabs.cpp

示例2: QTabWidget


//.........这里部分代码省略.........
    pageDatabases = new QWidget(central);
    QHBoxLayout *db_toplayout = new QHBoxLayout(pageDatabases);
    QFrame      *db_lframe = new QFrame(pageDatabases);
    db_toplayout->addWidget(db_lframe);
    QVBoxLayout *db_llayout= new QVBoxLayout(db_lframe);
    
    tabs->addTab(pageDatabases, tr("Databases"));

    listDatabases = new QTreeWidget(pageDatabases);
    listDatabases->setRootIsDecorated(false);

    QStringList dbHeaders;
    dbHeaders << tr("Enabled") << tr("Name") << tr("Options") ;
    listDatabases->setHeaderLabels(dbHeaders);
    listDatabases->headerItem()->setTextAlignment(1, Qt::AlignCenter);
    listDatabases->headerItem()->setTextAlignment(2, Qt::AlignCenter);
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
    listDatabases->header()->setResizeMode(0,QHeaderView::ResizeToContents);
    listDatabases->header()->setResizeMode(2,QHeaderView::ResizeToContents);
#else
    listDatabases->header()->setSectionResizeMode(0,QHeaderView::ResizeToContents);
    listDatabases->header()->setSectionResizeMode(2,QHeaderView::ResizeToContents);
#endif
    db_llayout->addWidget(listDatabases);

    QFrame *grpBox = new QFrame(pageDatabases);
    QHBoxLayout *grp_layout = new QHBoxLayout(grpBox);
    grp_layout->setContentsMargins(5,5,5,5);

    // Add select all and unselect all buttons.
    selectAllReadersButton = new QPushButton(tr("Enable all"), grpBox);
    connect(selectAllReadersButton, SIGNAL(clicked()),
            this, SLOT(selectAllReadersButtonClicked()));
    grp_layout->addWidget(selectAllReadersButton);

    unSelectAllReadersButton = new QPushButton(tr("Disable all"), grpBox);
    connect(unSelectAllReadersButton, SIGNAL(clicked()),
            this, SLOT(unSelectAllReadersButtonClicked()));
    grp_layout->addWidget(unSelectAllReadersButton);
    db_llayout->addWidget(grpBox);

    QFrame      *db_rframe = new QFrame(pageDatabases);
    db_toplayout->addWidget(db_rframe);
    QVBoxLayout *db_rlayout= new QVBoxLayout(db_rframe);

    databaseOptionsSetButton = new QPushButton(tr("Set default open options"),
                                               pageDatabases);
    connect(databaseOptionsSetButton, SIGNAL(clicked()),
            this, SLOT(databaseOptionsSetButtonClicked()));
    connect(listDatabases, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), 
            this, SLOT(databaseSelectedItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
    
    db_rlayout->addWidget(databaseOptionsSetButton);
    
    dbAddToPreferedButton = new QPushButton(tr("Add to preferred list"),
                                            pageDatabases);
    connect(dbAddToPreferedButton, SIGNAL(clicked()),
            this, SLOT(dbAddToPreferedButtonClicked()));
    db_rlayout->addWidget(dbAddToPreferedButton);

    QGroupBox *preferredGroup = new QGroupBox("Preferred Database Plugins",
                                              pageDatabases);
    db_rlayout->addWidget(preferredGroup);
    QGridLayout *preferredLayout = new QGridLayout(preferredGroup);

    QLabel *preferredHintLabel = new QLabel(
        "This is an ordered list of plugins which take precedence when "
        "opening files.  When they accept the given file name pattern, these "
        "are tried frst.  And when all attempts to guess based on file "
        "name fail, these are tried before giving up.", preferredGroup);
    preferredHintLabel->setWordWrap(true);
    preferredLayout->addWidget(preferredHintLabel, 0,0, 1,3);

    listPreferredDBs = new QListWidget(preferredGroup);
    preferredLayout->addWidget(listPreferredDBs, 1,0, 1,3);
    connect(listPreferredDBs,
            SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), 
            this,
            SLOT(dbPreferredListItemChanged(QListWidgetItem*,QListWidgetItem*)));
    
    dbPreferredUpButton = new QPushButton(tr("Up"), preferredGroup);
    connect(dbPreferredUpButton, SIGNAL(clicked()),
            this, SLOT(dbPreferredUpButtonClicked()));
    preferredLayout->addWidget(dbPreferredUpButton, 2,0);

    dbPreferredDownButton = new QPushButton(tr("Down"), preferredGroup);
    connect(dbPreferredDownButton, SIGNAL(clicked()),
            this, SLOT(dbPreferredDownButtonClicked()));
    preferredLayout->addWidget(dbPreferredDownButton, 2,1);

    dbPreferredRemoveButton = new QPushButton(tr("Remove"), preferredGroup);
    connect(dbPreferredRemoveButton, SIGNAL(clicked()),
            this, SLOT(dbPreferredRemoveButtonClicked()));
    preferredLayout->addWidget(dbPreferredRemoveButton, 2,2);

    // Show the appropriate page based on the activeTab setting.
    tabs->blockSignals(true);
    tabs->setCurrentIndex(activeTab);
    tabs->blockSignals(false);
}
开发者ID:burlen,项目名称:visit_vtk_7_src,代码行数:101,代码来源:QvisPluginWindow.C


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