Example #1
0
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);
    }
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;
  }
Example #3
0
//加载完成
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);
	}
Example #4
0
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);
}
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 );
}
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);
    }
}
Example #7
0
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;
}
Example #8
0
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);
    }
}
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());
    }
Example #10
0
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);
    }
}
Example #11
0
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);
}
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)));
}
Example #13
0
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);
    QWidgetAction *radarCitiesAction = new QWidgetAction(this);
    QWidgetAction *radarCountiesAction = new QWidgetAction(this);
    QWidgetAction *radarHighwaysAction = new QWidgetAction(this);
    QWidgetAction *radarRiversAction = new QWidgetAction(this);
    QWidgetAction *radarRangeRingAction = new QWidgetAction(this);
    QWidgetAction *radarWarningsAction = new QWidgetAction(this);
    QWidgetAction *radarLegendAction = new QWidgetAction(this);

    radarTopographyAction->setDefaultWidget(checkTopography);
    radarCitiesAction->setDefaultWidget(checkCities);
    radarCountiesAction->setDefaultWidget(checkCounties);
    radarHighwaysAction->setDefaultWidget(checkHighways);
    radarRiversAction->setDefaultWidget(checkRivers);
    if (rangeRing) radarRangeRingAction->setDefaultWidget(checkRangeRing);
    radarWarningsAction->setDefaultWidget(checkWarnings);
    radarLegendAction->setDefaultWidget(checkLegend);

    radarOverlayMenu.addAction(radarTopographyAction);
    radarOverlayMenu.addAction(radarCitiesAction);
    radarOverlayMenu.addAction(radarCountiesAction);
    radarOverlayMenu.addAction(radarHighwaysAction);
    radarOverlayMenu.addAction(radarRiversAction);
    if (rangeRing) radarOverlayMenu.addAction(radarRangeRingAction);
    radarOverlayMenu.addAction(radarWarningsAction);
    radarOverlayMenu.addAction(radarLegendAction);

    connect(checkTopography, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(1); } );
    connect(checkCities, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(2); } );
    connect(checkCounties, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(3); } );
    connect(checkHighways, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(4); } );
    connect(checkRivers, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(5); } );
    if (rangeRing) connect(checkRangeRing, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(6); } );
    connect(checkWarnings, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(7); } );
    connect(checkLegend, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(8); } );

    radarImageContextMenu.addMenu(&radarOverlayMenu);

    ////////////////////////////////////////////////

    radarImageContextMenu.exec(ui->radarDisplay->mapToGlobal(pos));

    return;
}
QWidget* ConstraintTag::createWidget(QList<Tag *> tags, QWidget *parent)
{
    // === Create Widget ===
    QWidget* base = new QWidget(parent);
    QHBoxLayout* horLayout = new QHBoxLayout();
    QStringList comboboxItems = QStringList() << tr("ignore") << tr("local") << tr("global");

    QVBoxLayout* posLayout = new QVBoxLayout();
    posLayout->setSpacing(0);
    posLayout->setContentsMargins(0,0,0,0);
    QComboBox* posComboBox = new QComboBox(base);
    posComboBox->addItems(comboboxItems);
    posLayout->addWidget(posComboBox);
    QCheckBox* affectXCB = new QCheckBox("x", base);
    QCheckBox* affectYCB = new QCheckBox("y", base);
    QHBoxLayout* l = new QHBoxLayout();
    l->setContentsMargins(0,0,0,0);
    l->setSpacing(0);
    l->addWidget(affectXCB);
    l->addWidget(affectYCB);
    posLayout->addLayout(l);
    posLayout->addStretch();
    ObjectEdit* posObject = new ObjectEdit(base);
    posObject->setProject(tags.first()->owner()->project());
    posLayout->addWidget(posObject);

    QVBoxLayout* rotLayout = new QVBoxLayout();
    rotLayout->setSpacing(0);
    rotLayout->setContentsMargins(0,0,0,0);
    QComboBox* rotComboBox = new QComboBox(base);
    rotComboBox->addItems(comboboxItems);
    rotLayout->addWidget(rotComboBox);
    rotLayout->addStretch();
    ObjectEdit* rotObject = new ObjectEdit(base);
    rotObject->setProject(tags.first()->owner()->project());
    rotLayout->addWidget(rotObject);

    QVBoxLayout* scaleLayout = new QVBoxLayout();
    scaleLayout->setSpacing(0);
    scaleLayout->setContentsMargins(0,0,0,0);
    QComboBox* scaleComboBox = new QComboBox(base);
    scaleComboBox->addItems(comboboxItems);
    scaleLayout->addWidget(scaleComboBox);
    scaleLayout->addStretch();
    ObjectEdit* scaleObject = new ObjectEdit(base);
    scaleObject->setProject(tags.first()->owner()->project());
    scaleLayout->addWidget(scaleObject);

    horLayout->addLayout(posLayout);
    horLayout->addLayout(rotLayout);
    horLayout->addLayout(scaleLayout);
    // === end create Widget ===

    // === 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);
    };
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();
	}
}
void MusicWidget::setupGUI()
{
    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addSpacing(10);

    m_playlistView = new QTableWidget();
    RowDelegate *rowDelegate = new RowDelegate(this);
    m_playlistView->setItemDelegate(rowDelegate);
    m_playlistView->setStyleSheet(PLAYLIST_VIEW_STYLE);
    m_playlistView->setSelectionMode(QAbstractItemView::SingleSelection);
    m_playlistView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_playlistView->setVerticalScrollMode(QAbstractItemView::ScrollPerItem);
    m_playlistView->setEditTriggers(QAbstractItemView::NoEditTriggers);
    m_playlistView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_playlistView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    m_playlistView->setShowGrid(false);
    layout->addWidget(m_playlistView);
    connect(m_playlistView, SIGNAL(cellClicked(int,int))
            , this, SLOT(onCellClicked(int,int)));
    layout->addSpacing(4);

    m_currentSongLabel = new QLabel();
    m_currentSongLabel->setStyleSheet(CURRENT_LABEL_STYLE);
    layout->addWidget(m_currentSongLabel);

    QSize buttonSize(41, 33);
    m_playModeButton = new QPushButton(g_playmodeTexts[QMediaPlaylist::Loop], this);
    m_playModeButton->adjustSize();
#ifdef ANDROID
    QSize screenSize = qApp->primaryScreen()->size();
    if(screenSize.width() > 960 || screenSize.height() > 960)
    {
        buttonSize *= (m_playModeButton->height() / 33);
    }
#endif
    QHBoxLayout * controlLayout = new QHBoxLayout;
    controlLayout->setSpacing(4);
    layout->addLayout(controlLayout);
    controlLayout->addStretch(1);
    m_folderButton = new ImageButton(QPixmap(":/images/openfile.png")
                                     , QPixmap(":/images/openfile_down.png"));
    connect(m_folderButton, SIGNAL(clicked()), this, SIGNAL(selectSong()));
    m_folderButton->setFixedSize(buttonSize);
    controlLayout->addWidget(m_folderButton);

    m_prevButton = new ImageButton(QPixmap(":/images/preSong.png"),
                                   QPixmap(":/images/preSong_down.png"));
    m_prevButton->setFixedSize(buttonSize);
    connect(m_prevButton, SIGNAL(clicked()), m_playlist, SLOT(previous()));
    controlLayout->addWidget(m_prevButton);

    m_playpauseButton = new ImageButton(QPixmap(":/images/playpause.png")
                                        ,QPixmap(":/images/playpause_down.png"));
    m_playpauseButton->setFixedSize(buttonSize);
    connect(m_playpauseButton, SIGNAL(clicked()), this, SLOT(onPlayPauseButton()));
    controlLayout->addWidget(m_playpauseButton);

    m_stopButton = new ImageButton(QPixmap(":/images/stop.png")
                                   , QPixmap(":/images/stop_down.png"));
    m_stopButton->setFixedSize(buttonSize);
    connect(m_stopButton, SIGNAL(clicked()), this, SLOT(onStopButton()));
    controlLayout->addWidget(m_stopButton);

    m_nextButton = new ImageButton(QPixmap(":/images/nextSong.png")
                                   , QPixmap(":/images/nextSong_down.png"));
    m_nextButton->setFixedSize(buttonSize);
    connect(m_nextButton, SIGNAL(clicked()), m_playlist, SLOT(next()));
    controlLayout->addWidget(m_nextButton);

    QCheckBox *muteBox = new QCheckBox();
    muteBox->setStyleSheet(MUTE_CHECKBOX_STYLE);
    connect(muteBox, SIGNAL(stateChanged(int)),
            this, SLOT(onMuteButtonStateChanged(int)));
    controlLayout->addWidget(muteBox);

    connect(m_playModeButton, SIGNAL(clicked()),
            this, SLOT(onPlayModeButton()));
    controlLayout->addWidget(m_playModeButton);

    controlLayout->addStretch(1);

    QGridLayout *progressLayout = new QGridLayout();
    layout->addLayout(progressLayout);
    m_playProgress = new QSlider(Qt::Horizontal);
    //m_playProgress->setFixedWidth(280);
    m_playProgress->setStyleSheet(SLIDER_STYLE);
    progressLayout->addWidget(m_playProgress, 0, 0, 1, 2);
    connect(m_playProgress, SIGNAL(sliderPressed()),
            this, SLOT(onSliderPressed()));
    connect(m_playProgress, SIGNAL(sliderReleased()),
            this, SLOT(onSliderReleased()));
    m_positionLabel = new QLabel();
    m_positionLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
    progressLayout->addWidget(m_positionLabel, 1, 0, Qt::AlignLeft | Qt::AlignTop);
    m_durationLabel = new QLabel();
    m_durationLabel->setAlignment(Qt::AlignRight | Qt::AlignTop);
    progressLayout->addWidget(m_durationLabel, 1, 1, Qt::AlignRight | Qt::AlignTop);
}