本文整理汇总了C++中QCheckBox::setStyleSheet方法的典型用法代码示例。如果您正苦于以下问题:C++ QCheckBox::setStyleSheet方法的具体用法?C++ QCheckBox::setStyleSheet怎么用?C++ QCheckBox::setStyleSheet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCheckBox
的用法示例。
在下文中一共展示了QCheckBox::setStyleSheet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QWidget
CheckPage::CheckPage(QWidget *parent) :
QWidget(parent),
ui(new Ui::CheckPage)
{
double dXfactor = (double)g_pResManModule->m_pProjectParm->m_nWidth / 800;//因为在UI文件中布局时候是假设面板大小为800*600;
ui->setupUi(this);
ui->tableWidget->setRowCount(8);
ui->tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
ui->tableWidget->verticalScrollBar()->setStyleSheet("QScrollBar:vertical{background:transparent;width:30px; border: 2px solid transparent;}");
ui->tableWidget->setColumnWidth(0, 27*dXfactor);
ui->tableWidget->setColumnWidth(1, 213*dXfactor);
//表格第一列;
for(int i = 0; i < 8; i++)
{
QCheckBox *pBox = new QCheckBox();
pBox->setStyleSheet( "QCheckBox::indicator:unchecked {image: url(:/res/uncheck.png);}"
"QCheckBox::indicator:checked {image: url(:/res/checkbox.png);}");
ui->tableWidget->setCellWidget(i,0, pBox);
#ifdef MYANDROID
ui->tableWidget->setRowHeight(i, 50);
#endif
}
//表格第二列;
QStringList list;
for(int i = 0; i < 4; i++)
{
list.append(tr("Fixture%1").arg(i+1));
}
for(int i = 0; i < 2; i++)
{
list.append(tr("Sucker%1").arg(i+1));
}
list.append("X037");
list.append("X023");
for(int i = 0; i < 8; i++)
{
QCheckBox *pBox = new QCheckBox(list.at(i));
pBox->setStyleSheet( "QCheckBox::indicator:unchecked {image: url(:/res/signalflag0.png);}"
"QCheckBox::indicator:checked {image: url(:/res/signalflag1.png);}");
ui->tableWidget->setCellWidget(i, 1, pBox);
}
setAttribute(Qt::WA_TranslucentBackground);
QObjectList childList = children();
foreach (QObject *obj, childList) {
QWidget *w = qobject_cast<QWidget *>(obj);
if(w)
w->setAttribute(Qt::WA_TranslucentBackground);
}
示例2: resetColor
void ChooseProgramList::resetColor()
{
// Get the count of all checked programs
int count1 = 0;
QCheckBox *checkBox;
foreach (checkBox, checkBoxes)
{
if (checkBox->isChecked())
++count1;
}
// Others programs
++count1;
// Set the color of the check boxes
int count2 = 0;
foreach (checkBox, checkBoxes)
{
QColor color = ColorManagement::getChartColor((checkBox->isChecked() ?
count2 :
count1 - 1) * 1.0 / count1);
checkBox->setStyleSheet(tr("color: rgb(%1, %2, %3);").
arg(color.red()).
arg(color.green()).
arg(color.blue()));
if (checkBox->isChecked())
++count2;
}
示例3: slot_LoadFinished
//加载完成
void SearchThread::slot_LoadFinished( QNetworkReply *replay )
{
QTextCodec *codec = QTextCodec::codecForName("utf8"); //转换成utf8编码格式
QString searchStr = codec->toUnicode(replay->readAll());
if (searchStr == "")
{
emit sig_SearchTimeout(); //搜索超时
return;
}
searchStr = QUrl::fromPercentEncoding(searchStr.toAscii()); //百分比编码
//解析Json
QJson::Parser parser;
bool ok;
QVariantMap result = parser.parse(searchStr.toUtf8(), &ok).toMap();
if (!ok)
{
qDebug() << "转换成QVariantMap失败";
return;
}
//搜索到的数量
m_nMusicNum = result["total"].toInt();
emit sig_SearchNum(m_nMusicNum);
//得到结果数组
QVariantList resultList = result["results"].toList();
foreach (QVariant var, resultList)
{
QVariantMap resultMap = var.toMap(); //得到每一项的map
//歌曲名
QCheckBox *musicNameCheckBox = new QCheckBox(resultMap["song_name"].toString());
musicNameCheckBox->setObjectName(tr("musicNameCheckBox"));
musicNameCheckBox->setToolTip(resultMap["song_name"].toString());
musicNameCheckBox->setFont(QFont("微软雅黑", 10));
musicNameCheckBox->setStyleSheet("QCheckBox{color:white;}"
"QCheckBox::indicator{width:10px;height:10px;border: 1px solid white;border-radius:2px}"
"QCheckBox::indicator:checked {image: url(:/app/images/checked2.png);}");
//艺人
QTableWidgetItem *artistItem = new QTableWidgetItem(resultMap["artist_name"].toString());
artistItem->setTextAlignment(Qt::AlignCenter);
artistItem->setToolTip(resultMap["artist_name"].toString());
artistItem->setFont(QFont("微软雅黑", 10));
//专辑
QTableWidgetItem *albumItem = new QTableWidgetItem("《" + resultMap["album_name"].toString() + "》");
albumItem->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
albumItem->setToolTip("《" + resultMap["album_name"].toString() + "》");
albumItem->setFont(QFont("微软雅黑", 10));
//插入播放列表
int currentRows = m_searchList->rowCount();//返回列表中的行数
m_searchList->insertRow(currentRows);//从播放列表中的当前行插入
m_searchList->setCellWidget(currentRows, 0, musicNameCheckBox);
m_searchList->setItem(currentRows, 1, artistItem);
m_searchList->setItem(currentRows, 2, albumItem);
}
示例4: QStyledItemDelegate
BooleanDelegate::BooleanDelegate(QObject *parent, bool defaultValue) :
QStyledItemDelegate(parent), defaultValue(defaultValue)
{
QCheckBox checkbox;
checkbox.setStyleSheet("background-color:transparent");
uncheckedPixmap=QPixmap::grabWidget(&checkbox);
checkbox.setChecked(true);
checkedPixmap=QPixmap::grabWidget(&checkbox);
}
示例5: addCheckBox
void RedBullDialog::addCheckBox( QString referenceName, QString text, bool defaultValue ) {
QCheckBox* checkBox = new QCheckBox( text, this );
if ( !_styleSheet.isEmpty() ) {
checkBox->setStyleSheet( _styleSheet );
}
if ( !referenceName.isEmpty() ) {
_checkBoxes.insert( referenceName, checkBox );
}
checkBox->setChecked( defaultValue );
ui->bodyLayout->addWidget( checkBox );
}
示例6: UpdateActivateUserWidget
void AddUserDialog::UpdateActivateUserWidget()
{
ui->listWidgetActivateUser->clear();
QCheckBox* checkbox;
QListWidgetItem* listItem;
//display list
std::vector<std::string>::iterator it=vActivatedUsers.begin();
for(;it!=vActivatedUsers.end();++it){
checkbox=new QCheckBox(it->c_str());
checkbox->setStyleSheet("color:green;font-size:13px");
listItem=new QListWidgetItem(ui->listWidgetActivateUser);
ui->listWidgetActivateUser->addItem(listItem);
ui->listWidgetActivateUser->setItemWidget(listItem,checkbox);
}
}
示例7: createIconButton
QAbstractButton* MainWindow::createIconButton(const QString &iconPath, const QString &text, QWidget *parent) const
{
QCheckBox *button = new QCheckBox(text, parent);
//button->setIcon(QIcon(iconPath));
button->setStyleSheet("QCheckBox::indicator { image: url(" + iconPath.arg("") + "); }"
"QCheckBox::indicator:hover { image: url(" + iconPath.arg("_hovered") + "); }"
"QCheckBox::indicator:pressed { image: url(" + iconPath.arg("_pressed") + "); }");
button->setIconSize(QImage(iconPath).size());
button->setContentsMargins(0, 0, 0, 0);
button->setCursor(Qt::PointingHandCursor);
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
return button;
}
示例8: createEditor
QWidget *
AttributeDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
switch (index.column())
{
case AttributesModel::TYPE:
{
// Create the combobox and populate it
QComboBox* cb = new QComboBox(parent);
foreach(QString str, mTypes)
cb->addItem(str);
foreach(QString str, Util::getUserDefinedTypes())
cb->addItem(str);
return cb;
}
case AttributesModel::REQUIRED:
{
QCheckBox* cb = new QCheckBox(parent);
cb->setStyleSheet("QCheckBox {margin-left: 43%; margin-right: 57%;}");
return cb;
}
case AttributesModel::ABSTRACT:
{
QCheckBox* cb = new QCheckBox(parent);
cb->setStyleSheet("QCheckBox {margin-left: 43%; margin-right: 57%;}");
return cb;
}
default:
return QItemDelegate::createEditor(parent, option, index);
}
}
示例9: initWidget
void MusicSoundKMicroSettingPopWidget::initWidget()
{
setFixedSize(54, 24);
setTranslucentBackground();
m_recordCore = nullptr;
m_containWidget->setFixedSize(310, 190);
m_containWidget->setStyleSheet(MusicUIObject::MBackgroundStyle08 + MusicUIObject::MColorStyle03);
QCheckBox *checkBox = new QCheckBox(tr("Hear Yourself Singing"), m_containWidget);
checkBox->setGeometry(10, 20, 280, 25);
checkBox->setStyleSheet(MusicUIObject::MCheckBoxStyle05);
QCheckBox *checkBox2 = new QCheckBox(tr("Noise Elimination"), m_containWidget);
checkBox2->setGeometry(10, 50, 280, 25);
checkBox2->setStyleSheet(MusicUIObject::MCheckBoxStyle05);
#ifdef Q_OS_UNIX
checkBox->setFocusPolicy(Qt::NoFocus);
checkBox2->setFocusPolicy(Qt::NoFocus);
#endif
QLabel *microIconLabel = new QLabel(m_containWidget);
microIconLabel->setGeometry(10, 92, 26, 18);
QSlider *slider = new QSlider(Qt::Horizontal, m_containWidget);
slider->setGeometry(36, 90, 150, 25);
slider->setStyleSheet(QString("QSlider{%1}").arg(MusicUIObject::MBackgroundStyle01) + MusicUIObject::MSliderStyle01);
slider->setRange(0, 100);
slider->setValue(100);
connect(slider, SIGNAL(valueChanged(int)), SLOT(volumeChanged(int)));
QLabel *inputLabel = new QLabel(tr("Input"), m_containWidget);
inputLabel->setGeometry(10, 120, 50, 25);
inputLabel->setStyleSheet(MusicUIObject::MBackgroundStyle01);
m_inputComboBox = new QComboBox(m_containWidget);
m_inputComboBox->setGeometry(60, 120, 230, 25);
m_inputComboBox->setStyleSheet(MusicUIObject::MBorderStyle04);
m_inputComboBox->setItemDelegate(new QStyledItemDelegate(m_inputComboBox));
m_inputComboBox->view()->setStyleSheet(MusicUIObject::MScrollBarStyle01);
foreach(const QAudioDeviceInfo &info, QAudioDeviceInfo::availableDevices(QAudio::AudioInput))
{
m_inputComboBox->addItem(info.deviceName());
}
示例10: LoadCheats
void CheatDialog::LoadCheats() {
cheats = Core::System::GetInstance().CheatEngine().GetCheats();
ui->tableCheats->setRowCount(cheats.size());
for (size_t i = 0; i < cheats.size(); i++) {
QCheckBox* enabled = new QCheckBox();
enabled->setChecked(cheats[i]->IsEnabled());
enabled->setStyleSheet("margin-left:7px;");
ui->tableCheats->setItem(i, 0, new QTableWidgetItem());
ui->tableCheats->setCellWidget(i, 0, enabled);
ui->tableCheats->setItem(
i, 1, new QTableWidgetItem(QString::fromStdString(cheats[i]->GetName())));
ui->tableCheats->setItem(
i, 2, new QTableWidgetItem(QString::fromStdString(cheats[i]->GetType())));
enabled->setProperty("row", static_cast<int>(i));
connect(enabled, &QCheckBox::stateChanged, this, &CheatDialog::OnCheckChanged);
}
}
示例11: populateLineGraphActorsList
void MainWindow::populateLineGraphActorsList()
{
QCheckBox * actor;
lineGraphActorsCheckBoxList.clear();
lineGraphCheckedActorsIdList.clear();
lineActorCBList.clear();
QWidget* widget = new QWidget;
QVBoxLayout *layout = new QVBoxLayout(widget);
for(int actorsCount = 0; actorsCount < actorsName.count(); ++actorsCount)
{
actor = new QCheckBox(actorsName.at(actorsCount));
actor->setChecked(true);
QColor mycolor = colorsList.at(actorsCount);
QString style = "background: rgb(%1, %2, %3);";
style = style.arg(mycolor.red()).arg(mycolor.green()).arg(mycolor.blue());
style += "color:white; font-size:15px;";
style += "font-weight:bold;";
actor->setStyleSheet(style);
actor->setObjectName(QString::number(actorsCount));
layout->addWidget(actor);
layout->stretch(0);
lineGraphActorsCheckBoxList.append(actor);
//setting all checkboxes as checked as initial condition
lineGraphCheckedActorsIdList.append(true);
connect(actor,SIGNAL(toggled(bool)),this,SLOT(lineGraphActorsCheckboxClicked(bool)));
lineActorCBList.append(actor);
}
lineGraphActorsScrollArea->setWidget(widget);
}
示例12: createDateFilter
void EventsWindow::createDateFilter(QBoxLayout *layout)
{
QCheckBox *title = new QCheckBox(tr("Date after..."));
title->setStyleSheet(QLatin1String("font-weight:bold;"));
layout->addWidget(title);
connect(title, SIGNAL(clicked(bool)), SLOT(setStartDateEnabled(bool)));
m_startDate = new QDateEdit(QDate::currentDate());
m_startDate->setCalendarPopup(true);
m_startDate->setMaximumDate(QDate::currentDate());
m_startDate->setDisplayFormat(QLatin1String("dddd, MMM dd, yyyy"));
m_startDate->setVisible(false);
layout->addWidget(m_startDate);
connect(m_startDate, SIGNAL(dateTimeChanged(QDateTime)), m_resultsView->eventsModel(),
SLOT(setFilterBeginDate(QDateTime)));
connect(m_startDate, SIGNAL(dateTimeChanged(QDateTime)), SLOT(setEndDateMinimum(QDateTime)));
title->setChecked(false);
/* Start date disabled in favor of setFilterDay for now. */
title->hide();
m_startDate->hide();
QLabel *title2 = new QLabel(tr("Date"));
title2->setStyleSheet(QLatin1String("font-weight:bold;"));
layout->addWidget(title2);
m_endDate = new QDateEdit(QDate::currentDate());
m_endDate->setCalendarPopup(true);
m_endDate->setMaximumDate(QDate::currentDate());
m_endDate->setDisplayFormat(QLatin1String("ddd, MMM dd, yyyy"));
m_endDate->setTime(QTime(23, 59, 59, 999));
m_endDate->setFixedWidth(m_sourcesView->width());
layout->addWidget(m_endDate);
connect(m_endDate, SIGNAL(dateTimeChanged(QDateTime)), m_resultsView->eventsModel(),
SLOT(setFilterDay(QDateTime)));
}
示例13: slotRadarMenu
void MainWindow::slotRadarMenu(QPoint pos){
qDebug() << "MainWindow::slotRadarMenu(QPoint pos)";
//////////////////////////////////////////////
///
/// radarTypeMenu
///
//////////////////////////////////////////////
QMenu radarTypeMenu(tr("Radar Type"), this);
QAction action1("Base", this);
QAction action2("Long Range", this);
QAction action3("Storm Motion", this);
QAction action4("Velocity", this);
QAction action5("One-Hour Precipitation", this);
QAction action6("Composite", this);
QAction action7("Storm Precipitation", this);
radarTypeMenu.addAction(&action1);
radarTypeMenu.addAction(&action2);
radarTypeMenu.addAction(&action3);
radarTypeMenu.addAction(&action4);
radarTypeMenu.addAction(&action5);
radarTypeMenu.addAction(&action6);
radarTypeMenu.addAction(&action7);
//radarTypeMenu.setStyleSheet("QMenu::item:selected{border:1px solid red;}");
connect(&action1, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::N0R); });
connect(&action2, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::N0Z); });
connect(&action3, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::N0S); });
connect(&action4, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::N0V); });
connect(&action5, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::N1P); });
connect(&action6, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::NCR); });
connect(&action7, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::NTP); });
QMenu radarImageContextMenu(tr("Context Menu"), this);
radarImageContextMenu.addMenu(&radarTypeMenu);
//////////////////////////////////////////////
///
/// radarStationMenu
///
//////////////////////////////////////////////
QMenu radarStationMenu(tr("Radar Station"), this);
RadarTreeWidget radarTreeWidget(this);
connect(&radarTreeWidget, SIGNAL(signalDoubleClick(QString)), this, SLOT(slotWeatherStationSelected(QString)));
QWidgetAction *radarTreeAction = new QWidgetAction(this);
radarTreeAction->setDefaultWidget(&radarTreeWidget);
radarStationMenu.addAction(radarTreeAction);
radarImageContextMenu.addMenu(&radarStationMenu);
//////////////////////////////////////////////
///
/// radarOverlayMenu
///
//////////////////////////////////////////////
bool rangeRing = m_radar_station->getCurrentRadarProductType() != RadarType::N0Z;
QMenu radarOverlayMenu(tr("Overlays"), this);
QCheckBox *checkTopography = new QCheckBox("Topography", this);
QCheckBox *checkCities = new QCheckBox("Cities", this);
QCheckBox *checkCounties = new QCheckBox("Counties", this);
QCheckBox *checkHighways = new QCheckBox("Highways", this);
QCheckBox *checkRivers = new QCheckBox("Rivers", this);
QCheckBox *checkRangeRing = new QCheckBox("Range Ring", this);
QCheckBox *checkWarnings = new QCheckBox("Warnings", this);
QCheckBox *checkLegend = new QCheckBox("Legend", this);
checkTopography->setStyleSheet("padding: 6px;");
checkCities->setStyleSheet("padding: 6px;");
checkCounties->setStyleSheet("padding: 6px;");
checkHighways->setStyleSheet("padding: 6px;");
checkRivers->setStyleSheet("padding: 6px;");
if (rangeRing) checkRangeRing->setStyleSheet("padding: 6px;");
checkWarnings->setStyleSheet("padding: 6px;");
checkLegend->setStyleSheet("padding: 6px;");
checkTopography->setChecked(this->m_radar_settings.topoEnabled);
checkCities->setChecked(this->m_radar_settings.cityEnabled);
checkCounties->setChecked(this->m_radar_settings.countiesEnabled);
checkHighways->setChecked(this->m_radar_settings.highwaysEnabled);
checkRivers->setChecked(this->m_radar_settings.riversEnabled);
if (rangeRing) checkRangeRing->setChecked(this->m_radar_settings.rangeEnabled);
checkWarnings->setChecked(this->m_radar_settings.warningsEnabled);
checkLegend->setChecked(this->m_radar_settings.legendEnabled);
QWidgetAction *radarTopographyAction = new QWidgetAction(this);
//.........这里部分代码省略.........
示例14: createWidget
//.........这里部分代码省略.........
// === define update function ===
auto update = [=]() {
posComboBox->blockSignals(true);
posObject->blockSignals(true);
affectXCB->blockSignals(true);
affectYCB->blockSignals(true);
rotComboBox->blockSignals(true);
rotObject->blockSignals(true);
scaleComboBox->blockSignals(true);
scaleObject->blockSignals(true);
bool pModeDifference = false;
bool affectXDifference = false;
bool affectYDifference = false;
bool pIdDifference = false;
bool rModeDifference = false;
bool rIdDifference = false;
bool sModeDifference = false;
bool sIdDifference = false;
Mode pMode = ((ConstraintTag*) tags.first())->_positionMode;
bool affectX = ((ConstraintTag*) tags.first())->_affectX;
bool affectY = ((ConstraintTag*) tags.first())->_affectY;
quint64 pId = ((ConstraintTag*) tags.first())->_posId;
bool hasPId = ((ConstraintTag*) tags.first())->_hasPosId;
Mode rMode = ((ConstraintTag*) tags.first())->_rotationMode;
quint64 rId = ((ConstraintTag*) tags.first())->_rotId;
bool hasRId = ((ConstraintTag*) tags.first())->_hasRotId;
Mode sMode = ((ConstraintTag*) tags.first())->_scalationMode;
quint64 sId = ((ConstraintTag*) tags.first())->_scaleId;
bool hasSId = ((ConstraintTag*) tags.first())->_hasScaleId;
foreach (Tag* t, tags) {
ConstraintTag* ct = (ConstraintTag*) t;
if (ct->_positionMode != pMode) pModeDifference = true;
if (ct->_affectX != affectX) affectXDifference = true;
if (ct->_affectY != affectY) affectYDifference = true;
if ((ct->_hasPosId != hasPId)
|| (ct->_hasPosId && hasPId && ct->_posId != pId)) pIdDifference = true;
if (ct->_rotationMode != rMode) rModeDifference = true;
if ((ct->_hasRotId != hasRId)
|| (ct->_hasRotId && hasRId && ct->_rotId != rId)) rIdDifference = true;
if (ct->_scalationMode != sMode) sModeDifference = true;
if ((ct->_hasScaleId != hasSId)
|| (ct->_hasScaleId && hasSId && ct->_scaleId != sId)) sIdDifference = true;
}
if (pModeDifference) posComboBox->setStyleSheet(QString("background-color:%1").arg(Property::MULTIPLE_VALUES_COLOR));
else posComboBox->setStyleSheet("");
if (affectXDifference) affectXCB->setStyleSheet(QString("background-color:%1").arg(Property::MULTIPLE_VALUES_COLOR));
else affectXCB->setStyleSheet("");
if (affectYDifference) affectYCB->setStyleSheet(QString("background-color:%1").arg(Property::MULTIPLE_VALUES_COLOR));
else affectYCB->setStyleSheet("");
if (pIdDifference) posObject->setStyleSheet(QString("background-color:%1").arg(Property::MULTIPLE_VALUES_COLOR));
else posObject->setStyleSheet("");
posComboBox->setCurrentIndex(modeToIndex(pMode));
affectXCB->setChecked(affectX);
affectXCB->setEnabled(pMode != Mode::ignore);
affectYCB->setChecked(affectY);
affectYCB->setEnabled(pMode != Mode::ignore);
posObject->setEnabled(pMode != Mode::ignore);
if (hasPId)
posObject->setId(pId);
else
posObject->clear();
if (rModeDifference) rotComboBox->setStyleSheet(QString("background-color:%1").arg(Property::MULTIPLE_VALUES_COLOR));
else rotComboBox->setStyleSheet("");
if (rIdDifference) rotObject->setStyleSheet(QString("background-color:%1").arg(Property::MULTIPLE_VALUES_COLOR));
else rotObject->setStyleSheet("");
rotComboBox->setCurrentIndex(modeToIndex(rMode));
rotObject->setEnabled(rMode != Mode::ignore);
if (hasRId)
rotObject->setId(rId);
else
rotObject->clear();
if (sModeDifference) scaleComboBox->setStyleSheet(QString("background-color:%1").arg(Property::MULTIPLE_VALUES_COLOR));
else scaleComboBox->setStyleSheet("");
if (sIdDifference) scaleObject->setStyleSheet(QString("background-color:%1").arg(Property::MULTIPLE_VALUES_COLOR));
else scaleObject->setStyleSheet("");
scaleComboBox->setCurrentIndex(modeToIndex(sMode));
scaleObject->setEnabled(sMode != Mode::ignore);
if (hasSId)
scaleObject->setId(sId);
else
scaleObject->clear();
posComboBox->blockSignals(false);
posObject->blockSignals(false);
affectXCB->blockSignals(false);
affectYCB->blockSignals(false);
rotComboBox->blockSignals(false);
rotObject->blockSignals(false);
scaleComboBox->blockSignals(false);
scaleObject->blockSignals(false);
};
示例15: ShowHideTabs
void NewGeneMainWindow::ShowHideTabs(int const checkState)
{
// From http://stackoverflow.com/a/31147349/368896 - there is no way to add/remove individual styles from a stylesheet,
// so we just build out the whole thing
// No availability of raw string literals in VS2013
QString tabStylesheetMain =
"#tabWidgetMain pane {border-top: 2px solid #C2C7CB; position: absolute; top: -0.5em;} #tabWidgetMain QTabBar::tab {background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #E1E1E1, stop: 0.4 #DDDDDD, stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3); border: 2px solid #C4C4C3; border-bottom-color: #C2C7CB; border-top-left-radius: 4px; border-top-right-radius: 4px; min-width: 8ex; padding: 2px;} #tabWidgetMain QTabBar::tab:selected, QTabBar::tab:hover { background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #fafafa, stop: 0.4 #f4f4f4, stop: 0.5 #e7e7e7, stop: 1.0 #fafafa); } #tabWidgetMain QTabBar::tab:selected { border-color: #9B9B9B; border-bottom-color: #C2C7CB; /* same as pane color */ } #tabWidgetMain > QTabBar { margin: 20px; } ";
QString tabStylesheetSub;
QString overallStylesheet;
QString kadBoxStylesheet;
QString kadBoxInnerStylesheet;
QString checkboxSimpleModeStylesheet;
NewGeneTabWidget * highLevelTabWindow { findChild<NewGeneTabWidget *>("tabWidgetMain") };
NewGeneTabWidget * tabOutput { findChild<NewGeneTabWidget *>("tabWidgetOutput") };
QMenu * menuInput { findChild<QMenu *>("menuInput") };
QMenu * menuOutput { findChild<QMenu *>("menuOutput") };
QMenu * menuAbout { findChild<QMenu *>("menuAbout") };
QMenuBar * menuBar { findChild<QMenuBar *>("menuBar") };
NewGeneCreateOutput * CreateOutputPane { findChild<NewGeneCreateOutput *>("CreateOutputPane") };
// The following nesting is NOT NECESSARY to obtain pointers to the widgets.
// I did it to debug failure which turned out to be just using the class name as the ID in the 'findChild' function.
// But I left the code in place for convenience in case I want to access the intermediate levels in the future.
if (highLevelTabWindow && tabOutput && menuInput && menuOutput && menuAbout && menuBar && CreateOutputPane)
{
NewGeneSelectVariables * widgetSelectVariablesPane { CreateOutputPane->findChild<NewGeneSelectVariables *>("widgetSelectVariablesPane") };
if (widgetSelectVariablesPane)
{
KAdColumnSelectionBox * kadBox { widgetSelectVariablesPane->findChild<KAdColumnSelectionBox *>("frameKAdSelectionArea") };
if (kadBox)
{
QCheckBox * checkBoxSimpleMode { kadBox->findChild<QCheckBox *>("checkBoxSimpleMode") };
if (checkBoxSimpleMode /* && kadBoxInner */)
{
if (checkState == Qt::Checked)
{
highLevelTabWindow->setCurrentIndex(0);
tabOutput->setCurrentIndex(0);
tabOutput->setTabText(1, "");
overallStylesheet += "QTabBar {background-color: #FFFFE0;}";
setStyleSheet(overallStylesheet);
tabStylesheetMain +=
"#tabWidgetMain > pane { border: 0px; padding: 0px; height: 0px; } #tabWidgetMain > QTabBar::tab {margin: 0px; border: 0px; padding: 0px; height: 0px; } #tabWidgetMain > QTabBar::tab:selected, #tabWidgetMain > QTabBar::tab:hover { margin: 0px; border: 0px; padding: 0px; height: 0px; } #tabWidgetMain > QTabBar::tab:selected { margin: 0px; border: 0px; padding: 0px; height: 0px; } #tabWidgetMain > QTabBar { margin: 0px; border: 0px; padding: 0px; height: 0px; }";
tabStylesheetSub += "QTabBar::tab:middle {width: 0px; min-width: 0px; max-width: 0px; border: 0px; padding: 0px; margin: 0px;}";
highLevelTabWindow->setStyleSheet(tabStylesheetMain);
tabOutput->setStyleSheet(tabStylesheetSub);
kadBoxStylesheet += "QFrame#frameKAdSelectionArea {background-color: #DDEEDD;}";
kadBox->setStyleSheet(kadBoxStylesheet);
checkboxSimpleModeStylesheet += "QCheckBox#checkBoxSimpleMode {font: bold 11px; color: blue;}";
checkBoxSimpleMode->setStyleSheet(checkboxSimpleModeStylesheet);
menuInput->menuAction()->setVisible(false);
menuOutput->menuAction()->setVisible(false);
menuAbout->menuAction()->setVisible(false);
menuBar->setVisible(false);
}
else
{
highLevelTabWindow->setStyleSheet(tabStylesheetMain);
tabOutput->setStyleSheet(tabStylesheetSub);
tabOutput->setTabText(1, " Limit DMUs ");
setStyleSheet(overallStylesheet);
kadBox->setStyleSheet(kadBoxStylesheet);
checkBoxSimpleMode->setStyleSheet(checkboxSimpleModeStylesheet);
menuBar->setVisible(true);
menuAbout->menuAction()->setVisible(true);
menuOutput->menuAction()->setVisible(true);
menuInput->menuAction()->setVisible(true);
}
}
}
}
}
NewGeneVariablesToolboxWrapper * vgToolboxPane { CreateOutputPane->findChild<NewGeneVariablesToolboxWrapper *>("toolbox") };
if (vgToolboxPane && vgToolboxPane->newgeneToolBox)
{
vgToolboxPane->newgeneToolBox->resetAllBarColors();
}
}