本文整理汇总了C++中QCheckBox::setPalette方法的典型用法代码示例。如果您正苦于以下问题:C++ QCheckBox::setPalette方法的具体用法?C++ QCheckBox::setPalette怎么用?C++ QCheckBox::setPalette使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCheckBox
的用法示例。
在下文中一共展示了QCheckBox::setPalette方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createEditor
QWidget* DSiNo::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QCheckBox *editor = new QCheckBox( parent );
editor->setText( index.model()->headerData( index.column(), Qt::Horizontal ).toString() );
editor->setTristate( false );
editor->setPalette( option.palette );
editor->setFont( option.font );
editor->setBackgroundRole( QPalette::Background );
return editor;
}
示例2: QCheckBox
QList<QWidget*> ServiceItemDelegate::createItemWidgets() const
{
QCheckBox* checkBox = new QCheckBox();
QPalette palette = checkBox->palette();
palette.setColor(QPalette::WindowText, palette.color(QPalette::Text));
checkBox->setPalette(palette);
connect(checkBox, SIGNAL(clicked(bool)), this, SLOT(slotCheckBoxClicked(bool)));
KPushButton* configureButton = new KPushButton();
connect(configureButton, SIGNAL(clicked()), this, SLOT(slotConfigureButtonClicked()));
return QList<QWidget*>() << checkBox << configureButton;
}
示例3: headerDataChanged
void DiagramViewWrapper::headerDataChanged(Qt::Orientation orientation, int first, int last)
{
if (orientation == Qt::Horizontal)
{
for (int section = first; section <= last; ++section)
{
QCheckBox* cbox = m_lstCb[section];
cbox->setText(model()->headerData(section, orientation).toString());
// color highlight
QPalette p = cbox->palette();
QColor clrBkgd = qvariant_cast<QColor>(model()->headerData(section, Qt::Horizontal, Qt::DecorationRole));
p.setColor(cbox->backgroundRole(), clrBkgd);
if (clrBkgd.lightnessF() < 0.5)
{
p.setColor(cbox->foregroundRole(), Qt::white);
}
cbox->setPalette(p);
cbox->setAutoFillBackground(true);
}
}
}
示例4: QDialog
//.........这里部分代码省略.........
int curIdx = devices.indexOf(dev);
if(curIdx < 0)
{
#ifndef Q_OS_ANDROID
// assume its a file
ui->currentDeviceLabel->setText(dev);
m_filename = dev;
curIdx = devices.size() - 1;
#else
curIdx = 0;
#endif
}
ui->wifiDevice->setCurrentIndex(curIdx);
#ifndef Q_OS_ANDROID
// TODO confirm signal name
connect(ui->wifiDevice, SIGNAL(activated(int)), this, SLOT(wifiDeviceIdxChanged(int)));
#endif
ui->autoLocateAPs->setChecked(ms->autoGuessApLocations());
ui->guessMyLocation->setChecked(ms->showMyLocation());
MapRenderOptions renderOpts = ms->renderOpts();
ui->showReadingMarkers->setChecked(renderOpts.showReadingMarkers);
QStringList renderOptions = QStringList()
<< "(None)"
<< "Radial Lines"
<< "Circles"
<< "Rectangle";
MapGraphicsScene::RenderMode rm = ms->renderMode();
ui->renderType->addItems(renderOptions);
ui->renderType->setCurrentIndex((int)rm);
if(rm == MapGraphicsScene::RenderRadial)
{
ui->renderRadialOpts->setVisible(true);
ui->renderCircleOpts->setVisible(false);
}
else
if(rm == MapGraphicsScene::RenderCircles)
{
ui->renderRadialOpts->setVisible(false);
ui->renderCircleOpts->setVisible(true);
}
else
{
ui->renderRadialOpts->setVisible(false);
ui->renderCircleOpts->setVisible(false);
}
connect(ui->renderType, SIGNAL(currentIndexChanged(int)), this, SLOT(renderModeChanged(int)));
ui->multipleCircles->setChecked(renderOpts.multipleCircles);
ui->fillCircles->setChecked(renderOpts.fillCircles);
ui->circleSteps->setValue(renderOpts.radialCircleSteps);
ui->levelSteps->setValue(renderOpts.radialLevelSteps);
ui->angelDiff->setValue(renderOpts.radialAngleDiff);
ui->levelDiff->setValue(renderOpts.radialLevelDiff);
ui->lineWeight->setValue(renderOpts.radialLineWeight);
QList<MapApInfo*> apList = ms->apInfo();
QVBoxLayout *vbox = new QVBoxLayout(ui->apListBox);
QPushButton *btn;
QHBoxLayout *hbox = new QHBoxLayout();
btn = new QPushButton("Check All");
connect(btn, SIGNAL(clicked()), this, SLOT(selectAllAp()));
hbox->addWidget(btn);
btn = new QPushButton("Clear All");
connect(btn, SIGNAL(clicked()), this, SLOT(clearAllAp()));
hbox->addWidget(btn);
vbox->addLayout(hbox);
qSort(apList.begin(), apList.end(), OptionsDialog_sort_byEssid);
foreach(MapApInfo *info, apList)
{
QCheckBox *cb = new QCheckBox(QString("%1 (%2)").arg(info->essid).arg(info->mac.right(6)));
cb->setChecked(info->renderOnMap);
QPalette p = cb->palette();
p.setColor(QPalette::WindowText, m_scene->baseColorForAp(info->mac).darker());
cb->setPalette(p);
m_apCheckboxes[info->mac] = cb;
vbox->addWidget(cb);
}
示例5: pixm
//.........这里部分代码省略.........
{
layerTable->setColumnWidth(1, 40);
layerTable->setColumnWidth(0, 24);
}
layerTable->setSortingEnabled(false);
layerTable->setSelectionBehavior( QAbstractItemView::SelectRows );
QHeaderView *Header = layerTable->verticalHeader();
Header->setMovable(false);
Header->setResizeMode(QHeaderView::Fixed);
Header->hide();
FlagsSicht.clear();
int col2Width = 0;
int col1Width = 0;
if (info->layerInfo.count() != 0)
{
if ((info->isRequest) && (info->RequestProps.contains(0)))
{
opacitySpinBox->setValue(qRound(info->RequestProps[0].opacity / 255.0 * 100));
setCurrentComboItem(blendMode, blendModes[info->RequestProps[0].blend]);
}
else
{
opacitySpinBox->setValue(qRound(info->layerInfo[0].opacity / 255.0 * 100));
setCurrentComboItem(blendMode, blendModes[info->layerInfo[0].blend]);
}
opacitySpinBox->setEnabled(true);
blendMode->setEnabled(true);
QString tmp;
QList<PSDLayer>::iterator it2;
uint counter = 0;
for (it2 = info->layerInfo.begin(); it2 != info->layerInfo.end(); ++it2)
{
QCheckBox *cp = new QCheckBox((*it2).layerName, this);
cp->setPalette(palette);
QPixmap pm;
pm=QPixmap::fromImage((*it2).thumb);
col1Width = qMax(col1Width, pm.width());
cp->setIcon(pm);
FlagsSicht.append(cp);
connect(cp, SIGNAL(clicked()), this, SLOT(changedLayer()));
layerTable->setCellWidget(info->layerInfo.count()-counter-1, 0, cp);
if ((info->isRequest) && (info->RequestProps.contains(counter)))
cp->setChecked(info->RequestProps[counter].visible);
else
cp->setChecked(!((*it2).flags & 2));
if (!(*it2).thumb_mask.isNull())
{
QCheckBox *cp2 = new QCheckBox((*it2).layerName, this);
cp2->setPalette(palette);
QPixmap pm2;
pm2=QPixmap::fromImage((*it2).thumb_mask);
col2Width = qMax(col2Width, pm2.width());
cp2->setIcon(pm2);
connect(cp2, SIGNAL(clicked()), this, SLOT(changedLayer()));
layerTable->setCellWidget(info->layerInfo.count()-counter-1, 1, cp2);
if ((info->isRequest) && (info->RequestProps.contains(counter)))
cp2->setChecked(info->RequestProps[counter].useMask);
else
cp2->setChecked(true);
FlagsMask.append(cp2);
}
else
FlagsMask.append(0);
QTableWidgetItem *tW = new QTableWidgetItem((*it2).layerName);
tW->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
layerTable->setItem(info->layerInfo.count()-counter-1, 2, tW);