本文整理汇总了C++中QComboBox::setDisabled方法的典型用法代码示例。如果您正苦于以下问题:C++ QComboBox::setDisabled方法的具体用法?C++ QComboBox::setDisabled怎么用?C++ QComboBox::setDisabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QComboBox
的用法示例。
在下文中一共展示了QComboBox::setDisabled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: trigger
void ServerForm::trigger(bool start)
{
QToolButton* btnTrigger = qobject_cast<QToolButton*>(sender());
if (!btnTrigger) return;
bool istcp = (btnTrigger==m_ui.btnTcp);
QComboBox* cbAddr = istcp ? m_ui.cmbTcpAddr : m_ui.cmbUdpAddr;
QComboBox* cbPort = istcp ? m_ui.cmbTcpPort : m_ui.cmbUdpPort;
ServerSkt* server = istcp ? (ServerSkt*)&m_tcp : (ServerSkt*)&m_udp;
IPAddr addr;
if (start)
start = TK::popIPAddr(cbAddr, cbPort, addr);
lock();
if (start)
start = server->start(addr.ip, addr.port);
else
server->stop();
unlock();
cbAddr->setDisabled(start);
cbPort->setDisabled(start);
if (start)
TK::pushIPAddr(0, cbPort);
else
TK::resetPushBox(btnTrigger);
}
示例2: createPropItem
/* Creates a property item 'val' in a parameter category specified by
its 'box'. */
void QucsTranscalc::createPropItem (QGridLayout * parentGrid, TransValue * val,
int box, QButtonGroup * group) {
Q_UNUSED(group);
QRadioButton * r = NULL;
QLabel * l;
QLineEdit * e;
QComboBox * c;
QDoubleValidator * v = new QDoubleValidator (this);
// name label
l = new QLabel (val->name);
parentGrid->addWidget(l, parentGrid->rowCount(), 0);
l->setAlignment (Qt::AlignRight);
if (val->tip) l->setToolTip(*(val->tip));
val->label = l;
// editable value text
e = new QLineEdit ();
parentGrid->addWidget(e, parentGrid->rowCount()-1, 1);
e->setText (QString::number (val->value));
e->setAlignment (Qt::AlignRight);
e->setValidator (v);
connect(e, SIGNAL(textChanged(const QString&)), SLOT(slotValueChanged()));
if (!val->name) e->setDisabled (true);
val->lineedit = e;
// unit choice
c = new QComboBox ();
parentGrid->addWidget(c, parentGrid->rowCount()-1, 2);
if (!val->units[0]) {
c->addItem ("NA");
c->setDisabled(true);
}
else {
int nounit = 0;
for (int i = 0; val->units[i]; i++) {
c->addItem (val->units[i]);
if (!strcmp (val->units[i], "NA")) nounit++;
}
c->setDisabled (nounit != 0);
c->setCurrentIndex (0);
}
connect(c, SIGNAL(activated(int)), SLOT(slotValueChanged()));
val->combobox = c;
// special synthesize-computation choice
if (box == TRANS_PHYSICAL) {
r = new QRadioButton ();
r->setDisabled (true);
r->setHidden(true);
val->radio = r;
parentGrid->addWidget(r, parentGrid->rowCount()-1, 3);
}
}
示例3: QtnPropertyBrushStyleComboBoxHandler
QtnPropertyBrushStyleComboBoxHandler(QtnPropertyQBrushStyleBase& property, QComboBox& editor)
: QtnPropertyEditorHandlerType(property, editor)
{
updateEditor();
if (!property.isEditableByUser())
editor.setDisabled(true);
QObject::connect( &editor, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged)
, this, &QtnPropertyBrushStyleComboBoxHandler::onCurrentIndexChanged);
}
示例4: QtnPropertyQStringListComboBoxHandler
QtnPropertyQStringListComboBoxHandler(QtnPropertyQStringBase& property, QComboBox& editor)
: QtnPropertyEditorHandlerType(property, editor)
{
updateEditor();
if (!property.isEditableByUser())
editor.setDisabled(true);
QObject::connect( &editor, &QComboBox::currentTextChanged
, this, &QtnPropertyQStringListComboBoxHandler::onCurrentTextChanged);
}
示例5: QSqlQueryModel
void PretrazivanjeSredstavaD1::setModelOrgJedinica()
{
QComboBox *view = ui->cbOrgJedinica;
modelOrgJedinica = new QSqlQueryModel();
if(!tipNaloga.compare("rukovodilac"))
{
modelOrgJedinica->setQuery("select o.id_ogranka, o.naziv \
from ogranak o join nalog n on o.id_ogranka = n.id_ogranka \
where n.id = " + QString("%1").arg(_userId) + ";");
view->setModel(modelOrgJedinica);
view->setModelColumn(1);
view->setDisabled(true);
}
示例6: QMainWindow
//.........这里部分代码省略.........
connect(jsB, SIGNAL(hintMessage(QString,int)), ui->statusbar, SLOT(showMessage(QString,int)));
connect(jsB, SIGNAL(noteChanged(QString)), this, SLOT(updateTagsToolBar(QString)));
connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->actionDelete_Note, SLOT(setEnabled(bool)));
connect(jsB, SIGNAL(activeNoteSelectionChanged(bool)), ui->editButton, SLOT(setEnabled(bool)));
connect(jsB, SIGNAL(editingStarted(bool)), ui->editButton, SLOT(setChecked(bool)));
connect(jsB, SIGNAL(titleUpdated(QString,QString)), this, SLOT(updateNoteTitle(QString,QString)));
connect(jsB, SIGNAL(conflictAdded(qint64,QString,bool)), this, SLOT(addConflict(qint64,QString,bool)));
connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionNote_Info, SLOT(setEnabled(bool)));
connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionExport, SLOT(setEnabled(bool)));
connect(jsB, SIGNAL(noteSelectionChanged(bool)), ui->actionPrint, SLOT(setEnabled(bool)));
connect(ui->editor, SIGNAL(tagUpdated(QString,bool)), this, SLOT(updateTag(QString,bool)));
connect(tagsActions, SIGNAL(triggered(QAction*)), this, SLOT(tagClicked(QAction*)));
connect(newTag, SIGNAL(tagCreated(QString)), this, SLOT(createTag(QString)));
connect(ui->actionKeep_only_this_Version, SIGNAL(triggered()), this, SLOT(keepThisVersion()));
connect(ui->actionNote_Info, SIGNAL(triggered()), this, SLOT(showNoteInfo()));
connect(ui->actionExport, SIGNAL(triggered()), this, SLOT(exportNote()));
connect(ui->actionPrint, SIGNAL(triggered()), this, SLOT(print()));
connect(this, SIGNAL(titleChanged(QString,QString)), jsB, SIGNAL(titleChanged(QString,QString)));
setWindowIcon(appIcon);
setWindowTitle("Hippo Notes");
setTabOrder(ui->noteTitle, ui->editor);
ui->notebooks->setSortingEnabled(true);
ui->notebooks->sortByColumn(0, Qt::AscendingOrder);
ui->editBar->setVisible(false);
ui->mainToolBar->addAction(ui->actionNew_Note);
ui->mainToolBar->addAction(ui->actionSync);
QFontComboBox *font = new QFontComboBox(this);
font->setDisabled(true);
font->setFontFilters(QFontComboBox::ScalableFonts);
font->setEditable(false);
connect(this, SIGNAL(editButtonsStateChanged(bool)), font, SLOT(setEnabled(bool)));
connect(this, SIGNAL(updateFont(QFont)), font, SLOT(setCurrentFont(QFont)));
connect(font, SIGNAL(activated(QString)), this, SLOT(changeFont(QString)));
ui->editBar->addWidget(font);
QComboBox *fontSize = new QComboBox(this);
fontSize->setDisabled(true);
fontSize->setEditable(false);
for (int i = 1; i <= 7; i++)
fontSize->addItem(QString::number(i));
connect(this, SIGNAL(editButtonsStateChanged(bool)), fontSize, SLOT(setEnabled(bool)));
connect(this, SIGNAL(updateFontSize(int)), fontSize, SLOT(setCurrentIndex(int)));
connect(fontSize, SIGNAL(activated(QString)), this, SLOT(changeFontSize(QString)));
ui->editBar->addWidget(fontSize);
QAction *boldIco = ui->editor->pageAction(QWebPage::ToggleBold);
boldIco->setIcon(QIcon::fromTheme("format-text-bold"));
ui->editBar->addAction(boldIco);
QAction *italicIco = ui->editor->pageAction(QWebPage::ToggleItalic);
italicIco->setIcon(QIcon::fromTheme("format-text-italic"));
ui->editBar->addAction(italicIco);
QAction *underlineIco = ui->editor->pageAction(QWebPage::ToggleUnderline);
underlineIco->setIcon(QIcon::fromTheme("format-text-underline"));
ui->editBar->addAction(underlineIco);
QAction *strikethroughIco = ui->editor->pageAction(QWebPage::ToggleStrikethrough);
strikethroughIco->setIcon(QIcon::fromTheme("format-text-strikethrough"));
ui->editBar->addAction(strikethroughIco);
示例7: subsColor
//.........这里部分代码省略.........
}
qUsage = FROM_UTF8(CFunctionParameter::RoleNameDisplay[usage]);
switch (usage)
{
case CFunctionParameter::SUBSTRATE:
color = subsColor;
break;
case CFunctionParameter::PRODUCT:
color = prodColor;
break;
case CFunctionParameter::MODIFIER:
color = modiColor;
break;
case CFunctionParameter::PARAMETER:
color = paraColor;
break;
case CFunctionParameter::VOLUME:
color = volColor;
break;
case CFunctionParameter::TIME:
color = timeColor;
break;
case CFunctionParameter::VARIABLE:
color = QColor(250, 250, 250);
break;
default :
qUsage = "unknown";
color = QColor(255, 20, 20);
break;
}
// col. 0 (name)
QString Name = FROM_UTF8(params[j]->getObjectName());
if (!params[j]->isUsed())
Name += " (unused)";
if (Table1->item((int) j, COL_NAME) == NULL)
{
QTableWidgetItem *newItem = new QTableWidgetItem(Name);
newItem->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
Table1->setItem((int) j, COL_NAME, newItem);
}
else
Table1->item((int) j, COL_NAME)->setText(Name);
Table1->item((int) j, COL_NAME)->setBackground(QBrush(color));
// col. 1 (description)
QTableWidgetItem *newItem2 = new QTableWidgetItem();
newItem2->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
Table1->setItem((int) j, COL_USAGE, newItem2);
Table1->item((int) j, COL_USAGE)->setBackground(QBrush(color));
QComboBox *comboItem = new QComboBox(Table1);
comboItem->addItems(Usages);
comboItem->setCurrentIndex(comboItem->findText(qUsage));
comboItem->setDisabled(mReadOnly);
Table1->setCellWidget((int) j, COL_USAGE, comboItem);
// connection between comboItem and its parent, Table1
connect(comboItem, SIGNAL(activated(const QString &)), this, SLOT(slotTableValueChanged(const QString &)));
comboItem->setObjectName(QString::number(j)); // just need to save the row index
//col. 2 (units)
QString strUnit = FROM_UTF8(units[j]);
if (Table1->item((int) j, COL_UNIT) == NULL)
{
QTableWidgetItem *newItem = new QTableWidgetItem(strUnit);
newItem->setFlags(Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
Table1->setItem((int) j, COL_UNIT, newItem);
}
else
Table1->item((int) j, COL_UNIT)->setText(strUnit);
Table1->item((int) j, COL_UNIT)->setBackground(QBrush(color));
}
Table1->horizontalHeader()->setStretchLastSection(true);
Table1->resizeColumnsToContents();
Table1->resizeRowsToContents();
/*
Table1->setFixedSize(Table1->horizontalHeader()->length() + 10,
Table1->verticalHeader()->length() + 30);
*/
return true;
}