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

C++ setCheckable函数代码示例

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

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



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

示例1: QAction

QAction* CodeNavigator::configMenu(QWidget *parent)
{
    static QAction *configAction = nullptr;
    if (!configAction) {
        configAction = new QAction(QIcon::fromTheme(QStringLiteral("applications-development")), QObject::tr("Code Navigation"), parent);
        auto menu = new QMenu(parent);
        auto group = new QActionGroup(parent);
        group->setExclusive(true);

        QSettings settings;
        settings.beginGroup(QStringLiteral("CodeNavigator"));
        const auto currentIdx = settings.value(QStringLiteral("IDE"), -1).toInt();

        for (int i = 0; i < ide_settings_size; ++i) {
            auto action = new QAction(menu);
            action->setText(QObject::tr(ide_settings[i].name));
            if (ide_settings[i].icon)
                action->setIcon(QIcon::fromTheme(ide_settings[i].icon));
            action->setCheckable(true);
            action->setChecked(currentIdx == i);
            action->setData(i);
            action->setEnabled(!QStandardPaths::findExecutable(ide_settings[i].app).isEmpty());
            group->addAction(action);
            menu->addAction(action);
        }
        menu->addSeparator();

        auto action = new QAction(menu);
        action->setText(QObject::tr("Custom..."));
        action->setCheckable(true);
        action->setChecked(currentIdx == -1);
        group->addAction(action);
        menu->addAction(action);

        QObject::connect(group, &QActionGroup::triggered, [parent](QAction *action) {
            QSettings settings;
            settings.beginGroup(QStringLiteral("CodeNavigator"));

            if (!action->data().isValid()) {
                const auto customCmd = QInputDialog::getText(
                    parent, QObject::tr("Custom Code Navigation"),
                    QObject::tr("Specify command to use for code navigation, '%f' will be replaced by the file name, '%l' by the line number."),
                    QLineEdit::Normal, settings.value(QStringLiteral("CustomCommand")).toString()
                );
                if (!customCmd.isEmpty()) {
                    settings.setValue(QStringLiteral("CustomCommand"), customCmd);
                    settings.setValue(QStringLiteral("IDE"), -1);
                }
                return;
            }

            const auto defaultIdx = action->data().toInt();
            settings.setValue(QStringLiteral("IDE"), defaultIdx);
        });

        configAction->setMenu(menu);
    }

    return configAction;
}
开发者ID:KDE,项目名称:elf-dissector,代码行数:60,代码来源:codenavigator.cpp


示例2: parser

//*****************************************************************************
bool Kwave::MenuItem::specialCommand(const QString &command)
{
    Kwave::Parser parser(command);

    if (command == _("#checkable")) {
	// checking/selecting of the item (non-exclusive)
	setCheckable(true);
    }
    else if (parser.command() == _("#exclusive")) {
	// join to a list of groups
	QString group = parser.firstParam();
	while (group.length()) {
	    if (!m_exclusive_group.length()) {
		m_exclusive_group = group;
		joinGroup(group, Kwave::MenuGroup::EXCLUSIVE);
	    } else if (m_exclusive_group != group) {
		qWarning("menu item '%s' already member of "
			"exclusive group '%s'",
			DBG(name()), DBG(m_exclusive_group));
	    }
	    group = parser.nextParam();
	}

	// make the item checkable
	setCheckable(true);
	return true;
    }
    else if (command == _("#hidden")) {
	setVisible(false);
    }

    return (Kwave::MenuNode::specialCommand(command));
}
开发者ID:KDE,项目名称:kwave,代码行数:34,代码来源:MenuItem.cpp


示例3: QToolButton

DesktopSwitchButton::DesktopSwitchButton(QWidget * parent, int index, const QString &path, const QString &shortcut, const QString &title)
    : QToolButton(parent)
    , m_shortcut(0)
    , mIndex(index)
{
    setText(QString::number(index + 1));
    setCheckable(true);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    
    if (!shortcut.isEmpty())
    {
        QString description = tr("Switch to desktop %1").arg(index + 1);
        if (!title.isEmpty())
        {
            description.append(QString(" (%1)").arg(title));
        }
        m_shortcut = GlobalKeyShortcut::Client::instance()->addAction(QString(), path, description, this);
        if (m_shortcut)
        {
            if (m_shortcut->shortcut().isEmpty())
                m_shortcut->changeShortcut(shortcut);
            connect(m_shortcut, SIGNAL(activated()), this, SIGNAL(activated()));
        }
    }
    
    if (!title.isEmpty())
    {
        setToolTip(title);
    }
}
开发者ID:MoonLightDE,项目名称:lxqt-panel,代码行数:30,代码来源:desktopswitchbutton.cpp


示例4: m_id

StelShortcut::StelShortcut(const QString &id,
                           StelShortcutGroup* group,
                           const QString &text,
                           const QString &primaryKey,
                           const QString &altKey,
                           bool checkable,
                           bool autoRepeat,
                           bool global,
                           QGraphicsWidget *parent) :
    m_id(id), m_temporary(false)
{
	if (parent == NULL)
	{
		parent = StelMainGraphicsView::getInstance().getStelAppGraphicsWidget();
	}
	m_action = new QAction(parent);
	m_action->setObjectName(id);
	m_group = group;

	setText(text);
	setPrimaryKey(primaryKey);
	setAltKey(altKey);
	setCheckable(checkable);
	setAutoRepeat(autoRepeat);
	setGlobal(global);

	parent->addAction(m_action);
}
开发者ID:incadoi,项目名称:stellarium-1,代码行数:28,代码来源:StelShortcutGroup.cpp


示例5: QPushButton

void PageNavigator::makeNumberedButtons()
{
    for (QAbstractButton * button : m_buttonGroup->buttons().toVector().toStdVector()) {
        m_buttonGroup->removeButton(button);
        if(button) {
            delete button;
            button = nullptr;
        }
    }

    int id = 0;
    QString num;
    for(int i = 0; i < m_numPagesListed; ++i)
    {
        auto button = new QPushButton();
        button->setText(num.setNum(i+1));
        button->setFixedSize(40,20);
        button->setCheckable(true);
        m_buttonLayout->addWidget(button);
        m_buttonGroup->addButton(button);
        m_buttonGroup->setId(button, id++);
    }
    if(m_buttonGroup->button(0)) {
        m_buttonGroup->button(0)->setChecked(true);
    }
    OS_ASSERT(m_numPagesListed == m_buttonGroup->buttons().size());
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:27,代码来源:PageNavigator.cpp


示例6: QPushButton

CSVWidget::PushButton::PushButton (const QIcon& icon, Type type, const QString& tooltip,
    QWidget *parent)
: QPushButton (icon, "", parent), mKeepOpen (false), mType (type), mToolTip (tooltip)
{
    setCheckable (type==Type_Mode);
    setExtendedToolTip (tooltip);
}
开发者ID:Allxere,项目名称:openmw,代码行数:7,代码来源:pushbutton.cpp


示例7: QPushButton

void PatVerticalTabWidget::addTab( int id,
                                   QString toolTip,
                                   const QString & selectedImagePath,
                                   const QString & unSelectedImagePath,
                                   const QString & disabledImagePath,
                                   const QString & doneImagePath,
                                   bool enabled )
{
  auto button = new QPushButton(m_tabBar);

  button->setFixedSize(QSize(39,42));

  button->setToolTip(toolTip);

  button->setCheckable(true);

  button->setEnabled(enabled);

  m_buttonGroup->addButton(button);
  m_buttonGroup->setId(button,m_buttonGroup->buttons().size() - 1);

  m_selectedPixmaps.push_back(selectedImagePath); 

  m_unSelectedPixmaps.push_back(unSelectedImagePath);

  m_disabledPixmaps.push_back(disabledImagePath);

  m_donePixmaps.push_back(doneImagePath);

  setCurrentIndex(0);
}
开发者ID:Anto-F,项目名称:OpenStudio,代码行数:31,代码来源:PatVerticalTabWidget.cpp


示例8: QGroupBox

QFESPIMB040SimpleCameraConfig::QFESPIMB040SimpleCameraConfig(QWidget* parent):
    QGroupBox(parent)
{
    m_camViewID=0;
    m_extManager=NULL;
    camView=NULL;
    locked=false;
    restartPreview=false;
    m_magnification=1;
    m_lastUserPreview="";


    // initialize raw image memory ...
    viewData.reset();

    // create widgets and actions

    createWidgets();
    createActions();
    displayStates(QFESPIMB040SimpleCameraConfig::Disconnected);
    if (cmbAcquisitionDevice->count()<=0) displayStates(QFESPIMB040SimpleCameraConfig::Inactive);
    init(0, NULL, "", NULL);
    setCheckable(true);
    setChecked(true);
}
开发者ID:jkriege2,项目名称:QuickFit3,代码行数:25,代码来源:qfespimb040simplecameraconfig.cpp


示例9:

// Slots
//============================================================
// Connected to this->customContextMenuRequested
void Chain::Chain_Tableview::slot_customContextMenuRequested(QPoint const& pos)
{
    // Assume this has the right model type and cast to it
    Chain_Table_Model* true_model = static_cast<Chain_Table_Model*>(this->model());

    // Get the index at the given position
    QModelIndex index = this->indexAt(pos);

    // If the model correct and not nullptr, and the index we're at is within the chain data
    if (true_model && true_model->is_within_chain(index))
    {
        // Make a context menu
        QMenu context_menu{};

        // Add an action as a title that is the tooltip (date) of the given data point
        context_menu.addAction(true_model->get_tooltip(index))->setEnabled(false);
        context_menu.addSeparator();

        // Make an action for setting the data and capture the pointer to it
        auto did_stuff_action = context_menu.addAction("Did Stuff?");

        // Make that action checkable and set its state to that of the data
        did_stuff_action->setCheckable(true);
        did_stuff_action->setChecked(true_model->link_did_stuff(index));

        // Connect the action to a lambda that will set the data appropriately when the action is triggered
        QObject::connect(did_stuff_action, &QAction::toggled,
                         [true_model, &index] (bool state) { true_model->set_link_did_stuff(index, state); } );

        // Execute the menu at the cursor position
        context_menu.exec(QCursor::pos());
        // this one isn't putting the menu in the right place.
        //context_menu.exec(this->mapToGlobal(pos));
    }
}
开发者ID:Elbagast,项目名称:Dont_Break_The_Chain,代码行数:38,代码来源:chain_tableview.cpp


示例10: QCommandLinkButton

GameButton::GameButton(int width, QString nom, QString desc, QString path, bool pwd, bool steam, QString gameID, QWidget *parent) :
    QCommandLinkButton  (parent),
    nom                 (nom),
    desc                (desc),
    path                (path),
    pwd                 (pwd),
    steam               (steam),
    gameID              (gameID),
    proc                (new QProcess(this))
{
    //Définition de l'apparence du bouton
    setMaximumSize(width / 21.875f, (width / 21.875f));
    setIconSize(QSize(maximumWidth()-16, maximumHeight()-16));
    setIcon(QIcon("./icons/" + nom + ".png"));
    setCheckable(true);

    //On définit le working directory du jeu représenté
    proc->setWorkingDirectory(QFileInfo(path).absolutePath());

    //connexion signaux/slots
    connect(this, SIGNAL(clicked()), this, SLOT(click()));
    connect(proc, SIGNAL(error(QProcess::ProcessError)), this, SLOT(error(QProcess::ProcessError)));
    connect(proc, SIGNAL(started()), this, SLOT(started()));
    connect(proc, SIGNAL(finished(int)), this, SLOT(finished(int)));
}
开发者ID:RallyPointFR,项目名称:RP_App,代码行数:25,代码来源:GameButton.cpp


示例11: QPushButton

LayoutButton::LayoutButton(QString text, QWidget *parent)
    : QPushButton(parent)
{
    setObjectName("LayoutButton");
    setCheckable(true);

    m_text = text;
    m_iconLabel = new QLabel(this);
    QPixmap pix(":img/tick_hover.png");
    m_iconLabel->setPixmap(pix);
    m_iconLabel->setMinimumSize(pix.size());
    m_textLabel = new QLabel;
    m_textLabel->setObjectName("LayoutTextLabel");
    m_textLabel->setText(text);
    m_iconLabel->hide();

    QHBoxLayout* m_Layout = new QHBoxLayout;
    m_Layout->setContentsMargins(20, 0, 0, 0);
    m_Layout->setSpacing(0);

    m_Layout->addSpacing(5);
    m_Layout->addWidget(m_textLabel);
    m_Layout->addStretch();
    setLayout(m_Layout);

    m_iconLabel->move(this->x() + 5, this->y() + 4);


    updateStyle(":/skin/layoutbutton.qss", this);
}
开发者ID:Kirek,项目名称:deepin-session-ui-manjaro,代码行数:30,代码来源:kblayoutwidget.cpp


示例12: setCheckable

void QtPropertyItem::ApplyDataFlags()
{
	if(NULL != itemData)
	{
		int dataFlags = itemData->GetFlags();

		if(dataFlags & QtPropertyData::FLAG_IS_CHECKABLE)
		{
			setCheckable(true);
			if(itemData->GetValue().toBool())
			{
				setCheckState(Qt::Checked);
			}
		}

		if(dataFlags & QtPropertyData::FLAG_IS_DISABLED)
		{
			setEnabled(false);
		}

		if(dataFlags & QtPropertyData::FLAG_IS_NOT_EDITABLE)
		{
			setEditable(false);
		}
	}
}
开发者ID:boyjimeking,项目名称:dava.framework,代码行数:26,代码来源:QtPropertyItem.cpp


示例13: rgba

void RoundItemButton::initUI() {
    m_itemIcon->setFocusPolicy(Qt::NoFocus);
    m_itemIcon->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    m_itemText->setWordWrap(true);
    m_itemText->setStyleSheet("color: rgba(255, 255, 255, 255);"
                              "font-size:16px; margin:0 5px;");
    m_itemText->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
    m_itemText->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->setMargin(0);
    mainLayout->addSpacing(10);
    mainLayout->addWidget(m_itemIcon);
    mainLayout->setAlignment(m_itemIcon, Qt::AlignHCenter);
    mainLayout->addWidget(m_itemText);

    setFocusPolicy(Qt::NoFocus);
    setFocusPolicy(Qt::StrongFocus);
    setLayout(mainLayout);
    setFixedSize(QSize(140, 140));
    setCheckable(true);

    QGraphicsDropShadowEffect *nameShadow = new QGraphicsDropShadowEffect(m_itemText);
    nameShadow->setBlurRadius(16);
    nameShadow->setColor(QColor(0, 0, 0, 85));
    nameShadow->setOffset(0, 4);
//    m_itemText->setGraphicsEffect(nameShadow);
}
开发者ID:Kirek,项目名称:deepin-session-ui-manjaro,代码行数:29,代码来源:rounditembutton.cpp


示例14: num

PokemonBoxButton::PokemonBoxButton(int num) : num(num)
{
    setText(tr("e&%1").arg(num+1));
    setIcon(Theme::WhiteBall());
    setCheckable(true);
    setAcceptDrops(true);
}
开发者ID:Ozma1992,项目名称:pokemon-online,代码行数:7,代码来源:box.cpp


示例15: CWizToolButton

 CWizToolButton(QWidget* parent = 0) : QPushButton(parent)
 {
     setFocusPolicy(Qt::NoFocus);
     setCheckable(true);
     setIconSize(QSize(24, 24));
     setMaximumSize(24, 24);
 }
开发者ID:liuyd07,项目名称:WizQTClient,代码行数:7,代码来源:wizEditorToolBar.cpp


示例16: QToolButton

LXQtTaskButton::LXQtTaskButton(const WId window, LXQtTaskBar * taskbar, QWidget *parent) :
    QToolButton(parent),
    mWindow(window),
    mUrgencyHint(false),
    mOrigin(Qt::TopLeftCorner),
    mDrawPixmap(false),
    mParentTaskBar(taskbar),
    mPlugin(mParentTaskBar->plugin()),
    mDNDTimer(new QTimer(this))
{
    Q_ASSERT(taskbar);

    setCheckable(true);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    setMinimumWidth(1);
    setMinimumHeight(1);
    setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    setAcceptDrops(true);

    updateText();
    updateIcon();

    mDNDTimer->setSingleShot(true);
    mDNDTimer->setInterval(700);
    connect(mDNDTimer, SIGNAL(timeout()), this, SLOT(activateWithDraggable()));
    connect(LXQt::Settings::globalSettings(), SIGNAL(iconThemeChanged()), this, SLOT(updateIcon()));
    connect(mParentTaskBar, &LXQtTaskBar::iconByClassChanged, this, &LXQtTaskButton::updateIcon);
}
开发者ID:Atalanttore,项目名称:lxqt-panel,代码行数:29,代码来源:lxqttaskbutton.cpp


示例17: button

/*!
  Constructs a QtColorPicker widget. The popup will display a grid
  with \a cols columns, or if \a cols is -1, the number of columns
  will be calculated automatically.

  If \a enableColorDialog is true, the popup will also have a "More"
  button (signified by an ellipsis "...") that presents a
  QColorDialog when clicked.

  After constructing a QtColorPicker, call insertColor() to add
  individual colors to the popup grid, or call setStandardColors()
  to add all the standard colors in one go.

  The \a parent argument is passed to QFrame's constructor.

  \sa QFrame
*/
QtColorPicker::QtColorPicker(QWidget *parent,
                             int cols, bool enableColorDialog)
    :  QPushButton(parent), popup(0), withColorDialog(enableColorDialog), _labels(false)
{
    setFocusPolicy(Qt::StrongFocus);
    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    setAutoDefault(false);
    setAutoFillBackground(true);
    setCheckable(true);

    // Set text
    setText(tr("Black"));
    firstInserted = false;

    // Create and set icon
    col = Qt::black;
    dirty = true;

    // Create color grid popup and connect to it.
    popup = new ColorPickerPopup(this, cols, withColorDialog, this);
    connect(popup, SIGNAL(selected(const QColor &)),
            SLOT(setCurrentColor(const QColor &)));
    connect(popup, SIGNAL(hid()), SLOT(popupClosed()));

    // Connect this push button's pressed() signal.
    connect(this, SIGNAL(toggled(bool)), SLOT(buttonPressed(bool)));
}
开发者ID:project-renard-survey,项目名称:utopia-documents-mirror,代码行数:44,代码来源:qtcolorpicker.cpp


示例18: QAction

KexiToggleViewModeAction::KexiToggleViewModeAction(
    Kexi::ViewMode mode, QObject* parent)//, QObject* receiver, const char* slot)
        : QAction(
            KIcon(Kexi::iconNameForViewMode(mode)),
            Kexi::nameForViewMode(mode, true/*withAmpersand*/),
            parent)
// , d( new Private )
{
// d->mode = mode;
// connect(this, SIGNAL(toggled(bool)), this, SLOT(slotToggled(bool)));
// if (receiver && slot)
//  connect(this, SIGNAL(switchedTo(Kexi::ViewMode)), receiver, slot);
    setCheckable(true);
    if (mode == Kexi::DataViewMode) {
        setObjectName("view_data_mode");
        setToolTip(i18n("Switch to data view"));
        setWhatsThis(i18n("Switches to data view."));
    } else if (mode == Kexi::DesignViewMode) {
        setObjectName("view_design_mode");
        setToolTip(i18n("Switch to design view"));
        setWhatsThis(i18n("Switches to design view."));
    } else if (mode == Kexi::TextViewMode) {
        setObjectName("view_text_mode");
        setToolTip(i18n("Switch to text view"));
        setWhatsThis(i18n("Switches to text view."));
    } else {
        kWarning() << "KexiToggleViewModeAction: invalid mode " << mode;
    }
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:29,代码来源:KexiView.cpp


示例19: KAction

AbstractMusicAction::AbstractMusicAction(const QString& text, SimpleEntryTool* tool)
    : KAction(text, tool)
    , m_isVoiceAware(false)
    , m_tool(tool)
{
    setCheckable(true);
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:7,代码来源:AbstractMusicAction.cpp


示例20: QPushButton

MyPushButton::MyPushButton(int index) : QPushButton(0)
{
    _index = index;
    setCheckable(true);
    setMaximumWidth(30);
    connect(this, SIGNAL(toggled(bool)), this, SLOT(handleClick()));
}
开发者ID:ustinski,项目名称:3dModeler,代码行数:7,代码来源:mypushbutton.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ setChecked函数代码示例发布时间:2022-05-30
下一篇:
C++ setCheckState函数代码示例发布时间: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