本文整理汇总了C++中QLabel::setEnabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QLabel::setEnabled方法的具体用法?C++ QLabel::setEnabled怎么用?C++ QLabel::setEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLabel
的用法示例。
在下文中一共展示了QLabel::setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resetSliders
// scale and adjust the upper slider group
void TriangleDensityWidget::resetSliders(double norm)
{
TriangleList triangles = triangleScene->triangles();
int n = 0;
foreach (Triangle* t, triangles)
{
QSlider* sl = sliders[n];
QLabel* la = slider_names[n];
sl->blockSignals(true);
sl->setSliderPosition((int)( t->xform()->density / norm * 1000. ));
sl->blockSignals(false);
sl->setVisible(true);
la->setVisible(true);
sl->setToolTip(triangleScene->getInfoLabel(t));
if (genome_ptr->final_xform_enable
&& genome_ptr->final_xform_index == n)
{
sl->setEnabled(false);
la->setEnabled(false);
}
else
{
sl->setEnabled(true);
la->setEnabled(true);
}
n++;
}
示例2: QDialog
AnimationPropertiesDialog::AnimationPropertiesDialog(Animation *pAnim, QWidget *pParent) : QDialog(pParent), mpAnim(pAnim), mChangingTimes(false)
{
bool timeBased = mpAnim->getFrameType() == FRAME_TIME;
QLabel *pNameLabel = new QLabel("Name:", this);
QLabel *pStartLabel = new QLabel("Start Time:", this);
pStartLabel->setEnabled(timeBased);
QLabel *pStopLabel = new QLabel("Stop Time:", this);
pStopLabel->setEnabled(timeBased);
mpName = new QLineEdit(QString::fromStdString(mpAnim->getName()), this);
mpStart = new QDateTimeEdit(this);
mpStart->setCalendarPopup(true);
mpStart->setDisplayFormat("yyyy/MM/dd\nhh:mm:ss.zzzZ");
mpStart->setEnabled(timeBased);
mpStop = new QDateTimeEdit(this);
mpStop->setCalendarPopup(true);
mpStop->setDisplayFormat("yyyy/MM/dd\nhh:mm:ss.zzzZ");
mpStop->setEnabled(timeBased);
mpMaintainDuration = new QCheckBox("Maintain Duration", this);
mpMaintainDuration->setChecked(true);
mpMaintainDuration->setEnabled(timeBased);
QDialogButtonBox *pButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, this);
QVBoxLayout *pTopLayout = new QVBoxLayout(this);
QHBoxLayout *pNameLayout = new QHBoxLayout();
pTopLayout->addLayout(pNameLayout);
pNameLayout->addWidget(pNameLabel);
pNameLayout->addWidget(mpName, 5);
QHBoxLayout *pTimeLayout = new QHBoxLayout();
pTopLayout->addLayout(pTimeLayout);
pTimeLayout->addWidget(pStartLabel);
pTimeLayout->addWidget(mpStart, 5);
pTimeLayout->addWidget(pStopLabel);
pTimeLayout->addWidget(mpStop, 5);
QHBoxLayout *pMaintainLayout = new QHBoxLayout();
pTopLayout->addLayout(pMaintainLayout);
pMaintainLayout->addWidget(mpMaintainDuration);
pMaintainLayout->addStretch(5);
pTopLayout->addWidget(pButtons);
pTopLayout->addStretch();
connect(mpStart, SIGNAL(dateTimeChanged(const QDateTime&)), this, SLOT(startTimeChanged(const QDateTime&)));
connect(mpStop, SIGNAL(dateTimeChanged(const QDateTime&)), this, SLOT(stopTimeChanged(const QDateTime&)));
connect(mpMaintainDuration, SIGNAL(toggled(bool)), this, SLOT(adjustDuration(bool)));
connect(pButtons, SIGNAL(accepted()), this, SLOT(accept()));
connect(pButtons, SIGNAL(rejected()), this, SLOT(reject()));
if(timeBased)
{
mpStart->setDateTime(TimelineUtils::timetToQDateTime(mpAnim->getStartValue()));
mpStop->setDateTime(TimelineUtils::timetToQDateTime(mpAnim->getStopValue()));
}
}
示例3: updatePluginInformations
/** ***************************************************************************/
void SettingsWidget::updatePluginInformations(const QModelIndex & current) {
// Hidde the placehodler text
QLayoutItem *i = ui.widget_pluginInfos->layout()->takeAt(1);
delete i->widget();
delete i;
if (extensionManager_->extensionSpecs()[current.row()]->state() == ExtensionSpec::State::Loaded){
Extension *extension = dynamic_cast<Extension*>(extensionManager_->extensionSpecs()[current.row()]->instance());
if (!extension){
qWarning() << "Cannot cast an object of extension spec to an extension!";
return; // Should no happen
}
QWidget *pw = extension->widget();
if ( pw->layout() != nullptr)
pw->layout()->setMargin(0);
ui.widget_pluginInfos->layout()->addWidget(pw);// Takes ownership
ui.label_pluginTitle->setText(extension->name());
ui.label_pluginTitle->show();
}
else{
QString msg("Plugin not loaded.\n%1");
QLabel *lbl = new QLabel(msg.arg(extensionManager_->extensionSpecs()[current.row()]->lastError()));
lbl->setEnabled(false);
lbl->setAlignment(Qt::AlignCenter);
ui.widget_pluginInfos->layout()->addWidget(lbl);
ui.label_pluginTitle->hide();
}
}
示例4: setPinModeOutput
// _____________________________________________________________________
void CRaspiGPIO::setPinModeOutput(unsigned int gpio_num, unsigned int init_state)
{
pinMode(gpio_num, OUTPUT);
digitalWrite(gpio_num, init_state);
QString txt = "O";
QString tooltip = "Digital Output";
QLabel *lbl = m_ihm.findChild<QLabel*>(PREFIX_MODE_GPIO + QString::number(gpio_num));
if (lbl) {
lbl->setText(txt);
lbl->setToolTip(tooltip);
lbl->setEnabled(true);
}
QLabel *lbl_name = m_ihm.findChild<QLabel*>(PREFIX_GPIO_NAME + QString::number(gpio_num));
if (lbl_name) {
lbl_name->setEnabled(true);
}
QCheckBox *checkbox = m_ihm.findChild<QCheckBox*>(PREFIX_CHECKBOX_WRITE + QString::number(gpio_num));
if (checkbox) {
checkbox->setEnabled(true);
}
m_raspi_pins_config[gpio_num] = tRaspiPinConfig { OUTPUT, PUD_OFF, init_state};
// Crée la data dans le data manager et l'associe à une callback pour déclencher l'écriture sur le port sur changement de valeur de la data
QString dataname = PREFIX_RASPI_OUT_DATANAME + QString::number(gpio_num);
m_application->m_data_center->write(dataname, init_state);
CData *data = m_application->m_data_center->getData(dataname);
if (data) {
connect (data, SIGNAL(valueUpdated(QVariant)), this, SLOT(onDataChangeWrite(QVariant)));
}
}
示例5: QLabel
QLabel * KviOptionsWidget::addLabel(QWidget * pParent,const QString & text,bool bEnabled)
{
QLabel * l = new QLabel(text,pParent);
l->setWordWrap(true);
l->setEnabled(bEnabled);
return l;
}
示例6: CryptoConfigEntryGUI
Kleo::CryptoConfigEntryURL::CryptoConfigEntryURL(
CryptoConfigModule* module,
Kleo::CryptoConfigEntry* entry, const QString& entryName,
QGridLayout * glay, QWidget* widget )
: CryptoConfigEntryGUI( module, entry, entryName ),
mLineEdit( 0 )
#ifndef KDEPIM_ONLY_KLEO
, mUrlRequester( 0 )
#endif
{
const int row = glay->rowCount();
QWidget * req;
#ifdef KDEPIM_ONLY_KLEO
req = mLineEdit = new QLineEdit( widget );
#else
req = mUrlRequester = new KUrlRequester( widget );
mUrlRequester->setMode( KFile::File | KFile::ExistingOnly );
#endif
QLabel *label = new QLabel( description(), widget );
label->setBuddy( req );
glay->addWidget( label, row, 1 );
glay->addWidget( req, row, 2 );
if ( entry->isReadOnly() ) {
label->setEnabled( false );
#ifndef KDEPIM_ONLY_KLEO
if ( mUrlRequester )
mUrlRequester->setEnabled( false );
#endif
if ( mLineEdit )
mLineEdit->setEnabled( false );
} else {
connect( req, SIGNAL(textChanged(QString)),
this, SLOT(slotChanged()) );
}
}
示例7: KviOptionsWidget
OptionsWidget_userListGrid::OptionsWidget_userListGrid(QWidget * parent)
: KviOptionsWidget(parent)
{
createLayout();
KviBoolSelector * b = addBoolSelector(0, 0, 0, 0, __tr2qs_ctx("Draw nickname grid", "options"), KviOption_boolUserListViewDrawGrid);
KviColorSelector * s = addColorSelector(0, 1, 0, 1, __tr2qs_ctx("Grid color:", "options"), KviOption_colorUserListViewGrid, KVI_OPTION_BOOL(KviOption_boolUserListViewDrawGrid));
connect(b, SIGNAL(toggled(bool)), s, SLOT(setEnabled(bool)));
KviTalHBox * hb = new KviTalHBox(this);
addWidgetToLayout(hb, 0, 2, 0, 2);
hb->setSpacing(4);
QLabel * l = new QLabel(__tr2qs_ctx("Grid type:", "options"), hb);
l->setEnabled(KVI_OPTION_BOOL(KviOption_boolUserListViewDrawGrid));
connect(b, SIGNAL(toggled(bool)), l, SLOT(setEnabled(bool)));
m_pGridTypeCombo = new QComboBox(hb);
m_pGridTypeCombo->addItem(__tr2qs_ctx("3D Grid", "options"));
m_pGridTypeCombo->addItem(__tr2qs_ctx("3D Buttons", "options"));
m_pGridTypeCombo->addItem(__tr2qs_ctx("Plain Grid", "options"));
m_pGridTypeCombo->addItem(__tr2qs_ctx("Dotted Grid", "options"));
m_pGridTypeCombo->setCurrentIndex(KVI_OPTION_UINT(KviOption_uintUserListViewGridType));
m_pGridTypeCombo->setEnabled(KVI_OPTION_BOOL(KviOption_boolUserListViewDrawGrid));
connect(b, SIGNAL(toggled(bool)), m_pGridTypeCombo, SLOT(setEnabled(bool)));
addRowSpacer(0, 3, 0, 3);
}
示例8: QLabel
void ImportExport::MD5CheckPage::createRow( QGridLayout* layout, int& row, const QString& name, const QString& title, bool anyClashes, bool allowMerge )
{
if ( row % 3 == 0 ) {
QFrame* line = new QFrame;
line->setFrameShape( QFrame::HLine );
layout->addWidget( line, ++row, 0, 1, 4 );
}
QLabel* label = new QLabel( title );
label->setEnabled( anyClashes );
layout->addWidget( label, ++row, 0 );
QButtonGroup* group = new QButtonGroup(this);
m_groups[name]=group;
for ( int i = 1; i<4;++i ) {
if ( i == 3 && !allowMerge )
continue;
QRadioButton* rb = new QRadioButton;
layout->addWidget( rb, row, i );
group->addButton( rb, i );
rb->setEnabled( anyClashes );
if (i == 1 )
rb->setChecked(true);
}
}
示例9: KDialogBase
NewIdentityDialog::NewIdentityDialog(const QStringList &identities,
QWidget *parent, const char *name,
bool modal)
: KDialogBase(parent, name, modal, i18n("New Identity"),
Ok | Cancel | Help, Ok, true)
{
setHelp(QString::fromLatin1("configure-identity-newidentitydialog"));
QWidget *page = makeMainWidget();
QVBoxLayout *vlay = new QVBoxLayout(page, 0, spacingHint());
// row 0: line edit with label
QHBoxLayout *hlay = new QHBoxLayout(vlay); // inherits spacing
mLineEdit = new KLineEdit(page);
mLineEdit->setFocus();
hlay->addWidget(new QLabel(mLineEdit, i18n("&New identity:"), page));
hlay->addWidget(mLineEdit, 1);
connect(mLineEdit, SIGNAL(textChanged(const QString &)),
this, SLOT(slotEnableOK(const QString &)));
mButtonGroup = new QButtonGroup(page);
mButtonGroup->hide();
// row 1: radio button
QRadioButton *radio = new QRadioButton(i18n("&With empty fields"), page);
radio->setChecked(true);
mButtonGroup->insert(radio, Empty);
vlay->addWidget(radio);
// row 2: radio button
radio = new QRadioButton(i18n("&Use Control Center settings"), page);
mButtonGroup->insert(radio, ControlCenter);
vlay->addWidget(radio);
// row 3: radio button
radio = new QRadioButton(i18n("&Duplicate existing identity"), page);
mButtonGroup->insert(radio, ExistingEntry);
vlay->addWidget(radio);
// row 4: combobox with existing identities and label
hlay = new QHBoxLayout(vlay); // inherits spacing
mComboBox = new QComboBox(false, page);
mComboBox->insertStringList(identities);
mComboBox->setEnabled(false);
QLabel *label = new QLabel(mComboBox, i18n("&Existing identities:"), page);
label->setEnabled(false);
hlay->addWidget(label);
hlay->addWidget(mComboBox, 1);
vlay->addStretch(1); // spacer
// enable/disable combobox and label depending on the third radio
// button's state:
connect(radio, SIGNAL(toggled(bool)),
label, SLOT(setEnabled(bool)));
connect(radio, SIGNAL(toggled(bool)),
mComboBox, SLOT(setEnabled(bool)));
enableButtonOK(false); // since line edit is empty
}
示例10: KviOptionsWidget
OptionsWidget_privmsg::OptionsWidget_privmsg(QWidget * parent)
: KviOptionsWidget(parent)
{
setObjectName("privmsg_options_widget");
createLayout();
KviTalGroupBox * g = addGroupBox(0,0,0,0,Qt::Horizontal,__tr2qs_ctx("General","options"));
addBoolSelector(g,__tr2qs_ctx("Show message icons","options"),KviOption_boolIrcViewShowImages);
addBoolSelector(g,__tr2qs_ctx("Draw some emoticons (smileys) as pictures","options"),KviOption_boolDrawEmoticons);
addBoolSelector(g,__tr2qs_ctx("Don't show colors in user messages","options"),KviOption_boolStripMircColorsInUserMessages);
g = addGroupBox(0,1,0,1,Qt::Horizontal,__tr2qs_ctx("Nicknames","options"));
m_pUseSmartColorSelector = addBoolSelector(g,__tr2qs_ctx("\"Smart\" nickname colors","options"),KviOption_boolColorNicks);
KviTalHBox * hb = new KviTalHBox(g);
hb->setSpacing(4);
m_pSpecialSmartColorSelector = addBoolSelector(hb,__tr2qs_ctx("Use specified colors for own nick:","options"),KviOption_boolUseSpecifiedSmartColorForOwnNick,KVI_OPTION_BOOL(KviOption_boolColorNicks));
m_pSmartColorSelector = addMircTextColorSelector(hb,"",KviOption_uintUserIrcViewOwnForeground,KviOption_uintUserIrcViewOwnBackground,KVI_OPTION_BOOL(KviOption_boolColorNicks) && KVI_OPTION_BOOL(KviOption_boolUseSpecifiedSmartColorForOwnNick));
connect(m_pSpecialSmartColorSelector,SIGNAL(toggled(bool)),this,SLOT(enableDisableSmartColorSelector(bool)));
connect(m_pUseSmartColorSelector,SIGNAL(toggled(bool)),m_pSpecialSmartColorSelector,SLOT(setEnabled(bool)));
KviBoolSelector * b2 = addBoolSelector(g,__tr2qs_ctx("Use same colors as in the userlist","options"),KviOption_boolUseUserListColorsAsNickColors,!KVI_OPTION_BOOL(KviOption_boolColorNicks));
connect(m_pUseSmartColorSelector,SIGNAL(toggled(bool)),b2,SLOT(setNotEnabled(bool)));
addBoolSelector(g,__tr2qs_ctx("Show nicknames in bold","options"),KviOption_boolBoldedNicks);
addBoolSelector(g,__tr2qs_ctx("Show user and host","options"),KviOption_boolShowUserAndHostInPrivmsgView);
addBoolSelector(g,__tr2qs_ctx("Show channel mode prefix","options"),KviOption_boolShowChannelUserFlagInPrivmsgView);
KviBoolSelector * b = addBoolSelector(g,__tr2qs_ctx("User-defined prefix and postfix","options"),KviOption_boolUseExtendedPrivmsgView);
QLabel * l = addLabel(g,__tr2qs_ctx("[PREFIX]nickname[[email protected]][POSTFIX] message","options"));
l->setEnabled(KVI_OPTION_BOOL(KviOption_boolUseExtendedPrivmsgView));
connect(b,
SIGNAL(toggled(bool)),
l,
SLOT(setEnabled(bool)));
KviTalVBox * vb = new KviTalVBox(g);
vb->setSpacing(5);
connect(
b,
SIGNAL(toggled(bool)),
addStringSelector(vb,__tr2qs_ctx("Prefix:","options"),KviOption_stringExtendedPrivmsgPrefix,KVI_OPTION_BOOL(KviOption_boolUseExtendedPrivmsgView)),
SLOT(setEnabled(bool)));
connect(
b,
SIGNAL(toggled(bool)),
addStringSelector(vb,__tr2qs_ctx("Postfix:","options"),KviOption_stringExtendedPrivmsgPostfix,KVI_OPTION_BOOL(KviOption_boolUseExtendedPrivmsgView)),
SLOT(setEnabled(bool)));
addRowSpacer(0,3,0,3);
}
示例11: enable
void diaElemAspectRatio::enable(uint32_t onoff)
{
QSpinBox *numBox = (QSpinBox*)myWidget;
QSpinBox *denBox = (QSpinBox*)denControl;
QLabel *label = (QLabel*)this->label;
numBox->setEnabled(onoff);
denBox->setEnabled(onoff);
label->setEnabled(onoff);
}
示例12: addLabel
// Create new label widget
QtWidgetObject* AtenTreeGuiDialog::addLabel(TreeGuiWidget* widget, QString text)
{
QtWidgetObject* qtwo = widgetObjects_.add();
QLabel *label = new QLabel(this);
qtwo->set(widget, label, text);
label->setText(text);
label->setEnabled(widget->enabled());
label->setVisible(widget->visible());
label->setMinimumHeight(WIDGETHEIGHT);
label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
return qtwo;
}
示例13:
//! [4]
QLabel *IconPreviewArea::createPixmapLabel()
{
QLabel *label = new QLabel;
label->setEnabled(false);
label->setAlignment(Qt::AlignCenter);
label->setFrameShape(QFrame::Box);
label->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
label->setBackgroundRole(QPalette::Base);
label->setAutoFillBackground(true);
label->setMinimumSize(132, 132);
return label;
}
示例14: QLabel
QWidget * Label::createQtWidget(Proxy *proxy, UIProxy *uiproxy, QWidget *parent)
{
QLabel *label = new QLabel(QString::fromStdString(text), parent);
label->setEnabled(enabled);
label->setVisible(visible);
label->setStyleSheet(QString::fromStdString(style));
label->setWordWrap(wordWrap);
label->setOpenExternalLinks(false);
QObject::connect(label, &QLabel::linkActivated, uiproxy, &UIProxy::onLinkActivated);
setQWidget(label);
setProxy(proxy);
return label;
}
示例15: setupGui
void DefinitionBoxWidget::setupGui(){
ui->labelDefinition->show();
ui->lineEditDefinition->hide();
ui->labelDefinition->setText((m_definitionMap["value"]).toString());
ui->lineEditDefinition->setText((m_definitionMap["value"]).toString());
ui->plainTextEditExampleUsage->setPlainText((m_definitionMap["usage"]).toString());
ui->plainTextEditNotes->setPlainText((m_definitionMap["notes"]).toString());
this->setToolTip( ( m_definitionMap["key"]).toString().prepend(trUtf8("Definition of ")) );
//Type tag
if((m_definitionMap["type"]).toString() != QString()){
QLabel *pTypeLabel = new QLabel((m_definitionMap["type"]).toString());
pTypeLabel->setFrameShape(QFrame::StyledPanel);
pTypeLabel->setEnabled(false);
pTypeLabel->setToolTip(trUtf8("Word Type"));
ui->horizontalLayoutTag->addWidget(pTypeLabel, 0, Qt::AlignLeft);
}
//TODO: sex tag
//TODO: antonym-synonym tag
}