Exemple #1
0
QGroupBox* Tippeligaen::createTeamOfTheRoundGroupBox(){
    QGroupBox *box = new QGroupBox(tr("Rundens lag"));

    QLabel *fieldImage = new QLabel();
    fieldImage->setPixmap(QPixmap(":/bilder/field.png"));
    box->setStyleSheet("QGroupBox { "
                            "background-image: url(:/bilder/field.png);"
                            "background-repeat: none;"
                            "border: 20px solid;"
                            "border-color: none; "
                        "}");

    _keeper = new QLabel;
    _rightBack = new QLabel;
    _rightCenterBack = new QLabel;
    _leftCenterBack = new QLabel;
    _leftBack = new QLabel;
    _leftWing = new QLabel;
    _rightWing = new QLabel;
    _rightCenterMidfielder = new QLabel;
    _leftCenterMidfielder = new QLabel;
    _leftStriker = new QLabel;
    _rightStriker = new QLabel;
    _teamOfTheRoundIdLabel= new QLabel;
    _teamOfTheRoundIdLabel->setText("Rundens lag 1");

    makeUnknownShirt();

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(keeper(), 0, 2, 1, 4);
    layout->addWidget(rightBack(), 1, 0);
    layout->addWidget(rightCenterBack(), 1, 1);
    layout->addWidget(leftCenterBack(), 1, 3);
    layout->addWidget(leftBack(), 1, 4);
    layout->addWidget(rightWing(), 2, 0);
    layout->addWidget(rightCenterMidfielder(), 2, 1);
    layout->addWidget(leftCenterMidfielder(), 2, 3);
    layout->addWidget(leftWing(), 2, 4);
    layout->addWidget(rightStriker(), 3, 1);
    layout->addWidget(leftStriker(), 3, 3);
    layout->addWidget(teamOfTheRoundIdLabel(), 4, 0, 4, 0, Qt::AlignHCenter);
    teamOfTheRoundIdLabel()->setStyleSheet("color: #fff; font-size: 20px;");
    box->setLayout(layout);
    return box;
}
Exemple #2
0
void MotorWidget::createLabelButton()
{
	QSignalMapper *mapper = new QSignalMapper(this);

	QFont fontLine("Arial", 10);

	for (int i=0; i<m_NumberButton; ++i)
	{
		QLineEdit *tempLineEdit = new QLineEdit(this);
		tempLineEdit->setFont(fontLine);
		if (m_Motor->setVectorNameWinding().empty())
			tempLineEdit->setText(tr("Wpisz nazwę uzwojenia"));
		else
			tempLineEdit->setText(QString::fromStdString(m_Motor->returnsNameWinding(i)));

		QPushButton *tempButton = new QPushButton(tr("Dodaj dane uzwojenia"));

		m_VectorLabelButton.push_back(qMakePair(tempLineEdit, tempButton));

		QHBoxLayout *hBox = new QHBoxLayout(this);
		hBox->addWidget(m_VectorLabelButton[i].first);
		hBox->addWidget(m_VectorLabelButton[i].second);

		QGroupBox *tempGrBox = new QGroupBox(tr("Uzwojenie"), this);
		tempGrBox->setFont(QFont("Arial", 12, QFont::Bold));
		tempGrBox->setStyleSheet("QGroupBox{border:1px; border-style:outset; border-color: gray; margin:10px} "
									"QGroupBox::title{subcontrol-origin: margin; subcontrol-position:top left}");
		tempGrBox->setLayout(hBox);

		m_VectorTempWindingBox.push_back(tempGrBox);

		mapper->setMapping (m_VectorLabelButton[i].second, i);
		connect(m_VectorLabelButton[i].second, SIGNAL(clicked()), mapper, SLOT(map()));
	}

	connect(mapper, SIGNAL(mapped(int)), this, SLOT(addDateReconstruction(int)));
}
SMainLayout::SMainLayout(QWidget *parent, QMainWindow * parentWindow) : QSplitter(Qt::Horizontal, parent)
{
    //this->setupMenu(parentWindow);
    this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    QVBoxLayout * qvbxl = new QVBoxLayout;
    QGroupBox * qgp = new QGroupBox("");
    qgp->setStyleSheet("background-color: white;");
    qgp->setLayout(qvbxl);
    qvbxl->addWidget(new SProjectExplorer());

    addWidget(qgp);


    QSplitter * commentsAndTriggers = new QSplitter(Qt::Vertical);


    qvbxl = new QVBoxLayout;
    qgp = new QGroupBox("");
    qvbxl->setMargin(0);
    qgp->setStyleSheet("background-color: white;");
    qgp->setLayout(qvbxl);
    qvbxl->addWidget(new QTextEdit());
    commentsAndTriggers->addWidget(qgp);

    qvbxl = new QVBoxLayout;
    qgp = new QGroupBox("");
    qvbxl->setMargin(0);
    qgp->setStyleSheet("background-color: white;");
    qgp->setLayout(qvbxl);
    qvbxl->addWidget(new STriggerEditor());
    commentsAndTriggers->addWidget(qgp);

    addWidget(commentsAndTriggers);


    QList<int> list;
    list << 300 << (1920-300);
    this->setSizes(list);

    list = QList<int>();
    list << 300 << (1920-300);
    commentsAndTriggers->setSizes(list);
    /*
     * Old grid one
     */
    /*
    //Init
    parent->setWindowTitle(tr("hello world"));

    QVBoxLayout * qvbxl = new QVBoxLayout;
    QGroupBox * qgp = new QGroupBox("");
    qgp->setStyleSheet("background-color: white;");
    qgp->setFixedWidth(250);
    qgp->setLayout(qvbxl);
    setSpacing(2);
    setMargin(4);

    //Initialize the project explorer
    projectExplorer = new SProjectExplorer();
    projectExplorer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );

    //Initialize the trigger area

    //Initialize the notes seciton

    //Tie it together
    qvbxl->addWidget(projectExplorer);

    addWidget(qgp, 0, 0,2,1);
    addWidget( new FoldLine(), 0, 1 );
    addWidget( new QPushButton( "baz" ), 1, 1 );

    setRowStretch(0, 9); // 10% for top row
    setRowStretch(1, 1); // 80% for middle row
    setRowMinimumHeight(0, 20); // 20px for top row*/

/*
    QTimer * timer = new QTimer(this);
    QObject::connect(timer, SIGNAL(timeout()), this, SLOT(y()));
    timer->start(1000); //time specified in ms
    timer->setSingleShot(false);*/
}
 /*public*/ SetTrainIconRouteFrame::SetTrainIconRouteFrame(QString routeName, QWidget* parent)
 : OperationsFrame(tr("Train Icon"),parent)
 {
  //super(tr("MenuSetTrainIcon"));
  log = new Logger("SetTrainIconRouteFrame");
  value = QMessageBox::No; //JOptionPane.NO_OPTION;
  FORWARD = 1;
  BACK = -1;
  NONE = 0;

  routeManager = RouteManager::instance();

  // labels
  textX = new JLabel("   X  ");
  textY = new JLabel("   Y  ");

  routeLocationName = new JLabel();

  // text field
  // check boxes
  // major buttons
  previousButton = new QPushButton(tr("Previous"));
  nextButton = new QPushButton(tr("Next"));
  placeButton = new QPushButton(tr("Place Test Icon"));
  applyButton = new QPushButton(tr("Apply"));
  saveButton = new QPushButton(tr("Save"));

  // combo boxes
  // Spinners
  spinTrainIconX = new QSpinBox(); //(new SpinnerNumberModel(0, 0, 10000, 1));
  spinTrainIconX->setMinimum(0);
  spinTrainIconX->setMaximum(10000);
  spinTrainIconX->setValue(0);
  spinTrainIconX->setSingleStep(1);
  spinTrainIconY = new QSpinBox(); //(new SpinnerNumberModel(0, 0, 10000, 1));
  spinTrainIconY->setMinimum(0);
  spinTrainIconY->setMaximum(10000);
  spinTrainIconY->setValue(0);
  spinTrainIconY->setSingleStep(1);

  _routeIndex = 0;
  _tIon = NULL;

  // create route
  if (routeName == NULL) {
      return;
  }
  _route = RouteManager::instance()->getRouteByName(routeName);
  //_route.addPropertyChangeListener(this);
  connect(_route->pcs, SIGNAL(propertyChange(PropertyChangeEvent*)), this, SLOT(propertyChange(PropertyChangeEvent*)));

  // general GUI config
  //getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
  getContentPane()->setLayout(new QVBoxLayout);

  // set tool tips
  placeButton->setToolTip(tr("Places a set of train icons on panel") + " " + Setup::getPanelName());
  applyButton->setToolTip(tr("Update route with the new coordinates"));
  saveButton->setToolTip(tr("Saves the train icon coordinates for the selected location"));

  // Set up the panels
  QGroupBox* pRoute = new QGroupBox();
//  pRoute.setBorder(BorderFactory
//          .createTitledBorder(tr("Route") + " " + _route.getName()));
  pRoute->setStyleSheet(gbStyleSheet);
  pRoute->setTitle(tr("Route"));
  pRoute->setLayout(new GridBagLayout());
  addItem(pRoute, previousButton, 0, 0);
  addItem(pRoute, routeLocationName, 1, 0);
  addItem(pRoute, nextButton, 2, 0);

  QGroupBox* pSpin = new QGroupBox();
  pSpin->setLayout(new GridBagLayout());
  //pSpin.setBorder(BorderFactory.createTitledBorder(tr("TrainIcon")));
  pSpin->setStyleSheet(gbStyleSheet);
  pSpin->setTitle(tr("Train Icon"));
  addItem(pSpin, textX, 0, 0);
  addItem(pSpin, spinTrainIconX, 1, 0);
  addItem(pSpin, textY, 2, 0);
  addItem(pSpin, spinTrainIconY, 3, 0);

  QGroupBox* pControl = new QGroupBox();
  pControl->setLayout(new GridBagLayout());
  //pControl.setBorder(BorderFactory.createTitledBorder(""));
  pControl->setStyleSheet(gbStyleSheet);
  pControl->setTitle(tr("Route"));
  addItem(pControl, placeButton, 0, 0);
  addItem(pControl, applyButton, 1, 0);
  addItem(pControl, saveButton, 2, 0);

  getContentPane()->layout()->addWidget(pRoute);
  getContentPane()->layout()->addWidget(pSpin);
  getContentPane()->layout()->addWidget(pControl);

  // add help menu to window
  addHelpMenu("package.jmri.jmrit.operations.Operations_SetTrainIconCoordinates", true); // NOI18N

  // setup buttons
  addButtonAction(previousButton);
  addButtonAction(nextButton);
  addButtonAction(placeButton);
  addButtonAction(applyButton);
  addButtonAction(saveButton);

  // start off with save button disabled
  saveButton->setEnabled(false);

  updateRoute();

  // setup spinners
  addSpinnerChangeListerner(spinTrainIconX);
  addSpinnerChangeListerner(spinTrainIconY);

  initMinimumSize(QSize(Control::panelWidth400, Control::panelHeight400));

 }
Exemple #5
0
MainWindow::MainWindow(QWidget *parent){
    this->setStyleSheet("background:qlineargradient(x1:0 y1:0, x2:0 y2:1,stop:0  #3498db, stop:1 #2980b9); color:white; width:200px;" );
    this->setGeometry(500,250,0,0);
    QVBoxLayout*layout=new QVBoxLayout;
    QLabel* titolo=new QLabel("LinQedIn");
    titolo->setAlignment(Qt::AlignHCenter);
    titolo->setStyleSheet("font: 20pt \"FontAwesome\";" "font-weight:bold;" "background:transparent;" "margin-bottom:20px;" "margin-top:20px;" );

    QGroupBox *groupBoxUtente = new QGroupBox("Login Lato Client");
    groupBoxUtente->setStyleSheet("background:transparent;");
    groupBoxUtente->setAlignment(Qt::AlignHCenter);
    groupBoxUtente->setContentsMargins(5,0,5,0);
    QLabel* labelusernameU=new QLabel(tr("Username"));
    labelusernameU->setAlignment(Qt::AlignHCenter);
    labelusernameU->setStyleSheet("font: 12pt \"Times\";" "margin-top:20px;" "background:transparent;" );
    caselladitestoUserU=new QLineEdit();
    caselladitestoUserU->setStyleSheet("background:white;" "color:black;" );
    QLabel* labelPasswordU=new QLabel(tr("Password"));
    labelPasswordU->setAlignment(Qt::AlignHCenter);
    labelPasswordU->setStyleSheet("font: 12pt \"Times\";" "margin-top:0px;" "background:transparent;" );
    caselladitestoPwU=new QLineEdit();
    caselladitestoPwU->setStyleSheet("background:white;" "color:black;"  "margin-bottom:10px;");
    caselladitestoPwU->setEchoMode(QLineEdit::Password);
    QPushButton* accediU=new QPushButton("Accedi");
    accediU->setStyleSheet("background:#0082b6;");
    QVBoxLayout *vboxU = new QVBoxLayout;
    vboxU->addWidget(labelusernameU);
    vboxU->addWidget(caselladitestoUserU);
    vboxU->addWidget(labelPasswordU);
    vboxU->addWidget(caselladitestoPwU);
    vboxU->addWidget(accediU);
    groupBoxUtente->setLayout(vboxU);

    QGroupBox *groupBoxAdmin = new QGroupBox(tr("Login Lato Admin"));
    groupBoxAdmin->setStyleSheet("background:transparent;");
    QLabel* labelusernameA=new QLabel(tr("Username"));
    labelusernameA->setAlignment(Qt::AlignHCenter);
    labelusernameA->setStyleSheet("font: 12pt \"Times\";" "margin-top:20px;" "background:transparent;" );
    caselladitestoUserA=new QLineEdit();
    caselladitestoUserA->setStyleSheet("background:white;" "color:black;" );
    QLabel* labelPasswordA=new QLabel(tr("Password"));
    labelPasswordA->setAlignment(Qt::AlignHCenter);
    labelPasswordA->setStyleSheet("font: 12pt \"Times\";" "margin-top:0px;" "background:transparent;" );
    caselladitestoPwA=new QLineEdit();
    caselladitestoPwA->setStyleSheet("background:white;" "color:black;"  "margin-bottom:10px;");
    caselladitestoPwA->setEchoMode(QLineEdit::Password);
    QPushButton* accediA=new QPushButton(("Accedi"));
    accediA->setStyleSheet("background:#0082b6;");
    QVBoxLayout *vboxA = new QVBoxLayout;
          vboxA->addWidget(labelusernameA);
          vboxA->addWidget(caselladitestoUserA);
          vboxA->addWidget(labelPasswordA);
          vboxA->addWidget(caselladitestoPwA);
          vboxA->addWidget(accediA);
          groupBoxAdmin->setLayout(vboxA);

    QGridLayout *grid = new QGridLayout;

    grid->addWidget(groupBoxUtente, 0, 0);
    grid->addWidget(groupBoxAdmin, 0, 1);
    connect(accediU,SIGNAL(clicked()),this,SLOT(SlotAutenticationUser()));
    connect(accediA,SIGNAL(clicked()),this,SLOT(SlotAutenticationAdmin()));
    layout->addWidget(titolo);
    layout->addLayout(grid);
    layout -> setMargin(0);
    layout -> setContentsMargins (0,0,0,0);
    layout->setSizeConstraint(QLayout::SetFixedSize);
    setLayout(layout);
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void PipelineFilterWidget::layoutWidgets()
{
    // Make sure the m_Filter is Non NULL
    if (NULL == m_Filter.get())
    {
        return;
    }

    // If the filter is valid then instantiate all the FilterParameterWidgets
    // Create the Widget that will be placed into the Variables Scroll Area
    m_VariablesWidget = new QWidget(this);

    QString variablesName = QString::fromUtf8("variablesScrollWidget1_") + m_Filter->getNameOfClass();
    m_VariablesWidget->setObjectName(variablesName);
    m_VariablesWidget->setGeometry(QRect(0, 0, 250, 267));
    m_VariablesVerticalLayout = new QVBoxLayout(m_VariablesWidget);
    m_VariablesVerticalLayout->setSpacing(30);
    variablesName = QString::fromUtf8("verticalLayout1") + m_Filter->getNameOfClass();
    m_VariablesVerticalLayout->setObjectName(variablesName);

    QString groupBoxStyle;
    QTextStream ss(&groupBoxStyle);
    ss << "QGroupBox {";
    ss << "    font-weight: bold;";
    ss << "}";
    ss << "QGroupBox::title {";
    ss << "    subcontrol-origin: margin;";
    ss << "    subcontrol-position: top left;";
    ss << "    padding: 0 5px;";
    ss << "    font-weight: bold;";
    ss << "}";


    QGroupBox* parametersGroupBox = new QGroupBox("Parameters", this);
    QVBoxLayout* pLayout = new QVBoxLayout(parametersGroupBox);
    parametersGroupBox->setStyleSheet(groupBoxStyle);

    QGroupBox* requiredGroupBox = new QGroupBox("Required Objects", this);
    QVBoxLayout* rLayout = new QVBoxLayout(requiredGroupBox);
    requiredGroupBox->setStyleSheet(groupBoxStyle);

    QGroupBox* createdGroupBox = new QGroupBox("Created Objects", this);
    QVBoxLayout* cLayout = new QVBoxLayout(createdGroupBox);
    createdGroupBox->setStyleSheet(groupBoxStyle);

    QGroupBox* noCategoryGroupBox = new QGroupBox("Uncategorized", this);
    QVBoxLayout* nLayout = new QVBoxLayout(noCategoryGroupBox);
    noCategoryGroupBox->setStyleSheet(groupBoxStyle);

    // Set the Name of the filter into the FilterWidget
    filterName->setText(m_Filter->getHumanLabel() );

    // Get the FilterWidgetManagere instance so we can instantiate new FilterParameterWidgets
    FilterWidgetManager* fwm = FilterWidgetManager::Instance();
    // Get a list of all the filterParameters from the filter.
    QVector<FilterParameter::Pointer> filterParameters = m_Filter->getFilterParameters();
    // Create all the FilterParameterWidget objects that can be displayed where ever the developer needs

    int pCount = 0, rCount = 0, cCount = 0;
    for (QVector<FilterParameter::Pointer>::iterator iter = filterParameters.begin(); iter != filterParameters.end(); ++iter )
    {
        FilterParameter* parameter = (*iter).get();

        // Check to make sure that this is in fact a file system filter parameter
        if (NULL != dynamic_cast<InputFileFilterParameter*>(parameter) || NULL != dynamic_cast<InputPathFilterParameter*>(parameter) || NULL != dynamic_cast<DataContainerReaderFilterParameter*>(parameter))
        {
            validateFileSystemFilterParameter(parameter);
        }

        QWidget* filterParameterWidget = fwm->createWidget(parameter, m_Filter.get());
        m_PropertyToWidget.insert(parameter->getPropertyName(), filterParameterWidget); // Update our Map of Filter Parameter Properties to the Widget

        if (NULL == filterParameterWidget)
        {
            continue;
        }
        m_FilterParameterWidgets.push_back(filterParameterWidget);

        // Determine which group box to add the widget into
        if(parameter->getCategory() == FilterParameter::Parameter)
        {
            filterParameterWidget->setParent(m_VariablesWidget);
            pLayout->addWidget(filterParameterWidget);
            pCount++;
        }
        else if(parameter->getCategory() == FilterParameter::RequiredArray)
        {
            filterParameterWidget->setParent(m_VariablesWidget);
            rLayout->addWidget(filterParameterWidget);
            rCount++;
        }
        else if(parameter->getCategory() == FilterParameter::CreatedArray)
        {
            filterParameterWidget->setParent(m_VariablesWidget);
            cLayout->addWidget(filterParameterWidget);
            cCount++;
        }
        else
        {
            filterParameterWidget->setParent(m_VariablesWidget);
            nLayout->addWidget(filterParameterWidget);
        }

        // Connect up some signals and slots
        connect(filterParameterWidget, SIGNAL(parametersChanged() ),
                parent(), SLOT(preflightPipeline() ) );

        connect(filterParameterWidget, SIGNAL(parametersChanged() ),
                parent(), SLOT(handleFilterParameterChanged() ) );

        connect(filterParameterWidget, SIGNAL(errorSettingFilterParameter(const QString&)),
                this, SLOT(displayFilterParameterWidgetError(const QString&)));

    }

    // Now link any boolean widgets to any conditional Widgets that they might control.
    linkConditionalWidgets(filterParameters);

    // If there are widgets in the parameters group box, add it to the overall layout.  If not, remove the group box.
    if (pLayout->isEmpty() == false || pCount > 0)
    {
        m_VariablesVerticalLayout->addWidget(parametersGroupBox);
    }
    else
    {
        delete parametersGroupBox;
    }

    // If there are widgets in the required arrays group box, add it to the overall layout.  If not, remove the group box.
    if (rLayout->isEmpty() == false || rCount > 0)
    {
        m_VariablesVerticalLayout->addWidget(requiredGroupBox);
    }
    else
    {
        delete requiredGroupBox;
    }

    // If there are widgets in the created arrays group box, add it to the overall layout.  If not, remove the group box.
    if (cLayout->isEmpty() == false || cCount > 0)
    {
        m_VariablesVerticalLayout->addWidget(createdGroupBox);
    }
    else
    {
        delete createdGroupBox;
    }

    // If there are widgets in the uncategorized group box, add it to the overall layout.  If not, remove the group box.
    if (nLayout->isEmpty() == false)
    {
        m_VariablesVerticalLayout->addWidget(noCategoryGroupBox);
    }
    else
    {
        delete noCategoryGroupBox;
    }

    // Now layout the Current Structure widget
    m_CurrentStructureWidget = new DataContainerArrayWidget(m_Filter.get(), this);
    QString curStructName = QString::fromUtf8("advancedInputsScrollWidget_CurrStructWidget");
    m_CurrentStructureWidget->setObjectName(curStructName);
    m_CurrentStructureWidget->setGeometry(QRect(0, 0, 250, 267));
}
Exemple #7
0
void MainWindow::createMainMenuWidget() {
    // Sets up each menu button along with their styleSheet
    QPushButton *start = new QPushButton(tr("Start"));
    start->setFixedSize(172,48);
    start->setFont(QFont("MS Shell Dlg 2", 11, QFont::Bold));
    start->setStyleSheet("QPushButton{background-image:url(:/program/images/Default.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}"
                         "QPushButton:hover{background-image:url(:/program/images/Hover.png);}"
                         "QPushButton:pressed{background-image:url(:/program/images/Clicked.png);}");
    connect(start, SIGNAL(clicked()), this, SLOT(startButtonClicked()));

    QPushButton *howToPlay = new QPushButton(tr("How to Play"));
    howToPlay->setFixedSize(172,48);
    howToPlay->setFont(QFont("MS Shell Dlg 2", 11, QFont::Bold));
    howToPlay->setStyleSheet("QPushButton{background-image:url(:/program/images/About.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}"
                             "QPushButton:hover{background-image:url(:/program/images/About-Hover.png);}"
                             "QPushButton:pressed{background-image:url(:/program/images/About-Clicked.png);}"
                             "QPushButton:disabled{background-image:url(:/program/images/Quit.png);};");
    connect(howToPlay, SIGNAL(clicked()), this, SLOT(howToPlayButtonClicked()));

    QPushButton *about = new QPushButton(tr("About Guess Who"));
    about->setFixedSize(172,48);
    about->setFont(QFont("MS Shell Dlg 2", 11, QFont::Bold));
    about->setStyleSheet("QPushButton{background-image:url(:/program/images/About.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}"
                         "QPushButton:hover{background-image:url(:/program/images/About-Hover.png);}"
                         "QPushButton:pressed{background-image:url(:/program/images/About-Clicked.png);}");
    connect(about, SIGNAL(clicked()), this, SLOT(aboutButtonClicked()));

    QPushButton *quit = new QPushButton(tr("Quit"));
    quit->setFixedSize(172,48);
    quit->setFont(QFont("MS Shell Dlg 2", 11, QFont::Bold));
    quit->setStyleSheet("QPushButton{background-image:url(:/program/images/Quit.png); color: white; border-width: 3px; border-color: #181D1F; border-style: outset; border-radius: 7;}"
                        "QPushButton:hover{background-image:url(:/program/images/Quit-Hover.png);}"
                        "QPushButton:pressed{background-image:url(:/program/images/Quit-Clicked.png);}");
    connect(quit, SIGNAL(clicked()), qApp, SLOT(quit()));

    // Creates the layout for the buttons
    QVBoxLayout *buttonLayout = new QVBoxLayout;
    buttonLayout->addSpacing(20);
    buttonLayout->addWidget(start, 0, Qt::AlignHCenter);
    buttonLayout->addSpacing(15);
    buttonLayout->addWidget(howToPlay, 0, Qt::AlignHCenter);
    buttonLayout->addSpacing(15);
    buttonLayout->addWidget(about, 0, Qt::AlignHCenter);
    buttonLayout->addSpacing(15);
    buttonLayout->addWidget(quit, 0, Qt::AlignHCenter);
    buttonLayout->addSpacing(20);

    QGroupBox *choiceGroupBox = new QGroupBox(tr(""));
    choiceGroupBox->setStyleSheet("QGroupBox{color:white}");
    choiceGroupBox->setLayout(buttonLayout);
    choiceGroupBox->setFixedSize(260, 400);

    // Creates 2 labels that will hold images for the menu screen
    QLabel *leftLabel = new QLabel(tr(""));
    QPixmap leftImage(":/program/images/Left.png");
    leftLabel->setPixmap(leftImage);
    leftLabel->setFixedSize(480,570);

    QLabel *rightLabel = new QLabel(tr(""));
    QPixmap rightImage(":/program/images/Right.png");
    rightLabel->setPixmap(rightImage);
    rightLabel->setFixedSize(480,570);

    // Creates the bottom layout for the page
    QHBoxLayout *bottomLayout = new QHBoxLayout;
    bottomLayout->addWidget(leftLabel, 0, Qt::AlignHCenter);
    bottomLayout->addWidget(choiceGroupBox);
    bottomLayout->addWidget(rightLabel, 0, Qt::AlignHCenter);

    // Creates the main layout for the page
    QVBoxLayout *mainLayout = new QVBoxLayout;

    QPixmap titleImage(":/program/images/Title.png");
    QLabel *titleName = new QLabel(tr(""));
    titleName->setPixmap(titleImage);
    titleName->setFixedSize(980,300);

    mainLayout->addSpacing(100);
    mainLayout->addWidget(titleName, 0, Qt::AlignHCenter);
    mainLayout->addLayout(bottomLayout);

    mainMenuWidget = new QWidget;
    mainMenuWidget->setLayout(mainLayout);
}
Exemple #8
0
ProviderDialog::ProviderDialog(MainObject *mOb, QDialog *parent) :
    QDialog(parent)
{
    mainObject = mOb;
    //provider = prov;

    //setFixedWidth(300);
    setWindowIcon(QIcon(":/icons/provider"));
    setWindowTitle("Provider");


    QVBoxLayout *mainOuterLayout = new QVBoxLayout();
    this->setLayout(mainOuterLayout);
    mainOuterLayout->setContentsMargins(0,0,0,0);
    mainOuterLayout->setSpacing(0);

    //** Header Label
    headerLabel = new QLabel();
    headerLabel->setText("-- provider --");
    headerLabel->setStyleSheet("font-size: 20pt; background-color: white; color: green;");
    mainOuterLayout->addWidget(headerLabel);


    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainOuterLayout->addLayout(mainLayout);
    mainLayout->setContentsMargins(20,20,20,20);
    mainLayout->setSpacing(10);


    //QString styleGrp = QString("QGroupBox{  border:2px solid gray;border-radius:5px;  margin-top: 1ex;} QGroupBox::title{subcontrol-origin: margin;subcontrol-position:top left;padding:0px 3px;}");
    QString styleGrp = QString("QGroupBox{  border:1px solid gray; margin-top: 2ex;} QGroupBox::title{subcontrol-origin: margin;subcontrol-position:top left;padding:0px 3px;}");

    //***************************************************
    //** Browse Button Group
    QGroupBox *grpBrowse = new QGroupBox();
    grpBrowse->setTitle("Open in web browser..");
    grpBrowse->setStyleSheet(styleGrp);
    mainLayout->addWidget(grpBrowse);
    QHBoxLayout *grpBrowseLayout = new QHBoxLayout();
    grpBrowseLayout->setContentsMargins(10,10,10,10);
    grpBrowse->setLayout(grpBrowseLayout);

    //** Browser Buttons
    QButtonGroup *buttonGroupBrowse = new QButtonGroup(this);
    connect(buttonGroupBrowse, SIGNAL(buttonClicked(QAbstractButton*)),
            this, SLOT(on_browse_button(QAbstractButton*))
    );

    buttHomePage = new QPushButton();
    buttHomePage->setText("Home page");
    grpBrowseLayout->addWidget(buttHomePage);
    buttonGroupBrowse->addButton(buttHomePage);

    buttPrices = new QPushButton();
    buttPrices->setText("Prices");
    grpBrowseLayout->addWidget(buttPrices);
    buttonGroupBrowse->addButton(buttPrices);

    buttSignUp = new QPushButton();
    buttSignUp->setText("Sign Up");
    grpBrowseLayout->addWidget(buttSignUp);
    buttonGroupBrowse->addButton(buttSignUp);

    buttLogin = new QPushButton();
    buttLogin->setText("Login");
    grpBrowseLayout->addWidget(buttLogin);
    buttonGroupBrowse->addButton(buttLogin);


    mainLayout->addSpacing(20);

    //*************************************************************
    //** Credentials
    grpCredentials = new QGroupBox();
    grpCredentials->setTitle("Account Details");
    grpCredentials->setCheckable(true);
    grpCredentials->setStyleSheet(styleGrp);
    mainLayout->addWidget(grpCredentials);
    connect(grpCredentials, SIGNAL(clicked(bool)), this, SLOT(on_credentials_checkbox(bool)));

    QGridLayout *credLayout = new QGridLayout();
    credLayout->setContentsMargins(10,20,10,10);
    grpCredentials->setLayout(credLayout);
    int row =0;

    QLabel *lblUsername = new QLabel("Username");
    credLayout->addWidget( lblUsername, row, 0 );

    txtUsername = new QLineEdit();
    credLayout->addWidget(txtUsername, ++row, 0, 1, 1);


    QLabel *lblPassword = new QLabel("Password");
    credLayout->addWidget( lblPassword, ++row, 0, 1, 1 );
    txtPass = new QLineEdit();
    credLayout->addWidget(txtPass, ++row, 0, 1, 1);
    //credLayout->addSpacing(10);

    QLabel *lblEmail = new QLabel("Email");
    credLayout->addWidget( lblEmail, ++row, 0 );
    txtEmail = new QLineEdit();
    credLayout->addWidget(txtEmail, ++row, 0, 1, 2);

    credLayout->setColumnStretch(0,1);
    credLayout->setColumnStretch(1,1);

    mainLayout->addSpacing(20);


    //**************************************************
    //** Buttons
    QHBoxLayout *buttonBox = new QHBoxLayout();
    mainLayout->addLayout(buttonBox);
    buttonBox->addStretch(10);

    QPushButton *cancelButton = new QPushButton();
    cancelButton->setText("Cancel");
    cancelButton->setIcon(QIcon(":/icons/black"));
    buttonBox->addWidget(cancelButton);
    connect(cancelButton, SIGNAL(clicked()), this, SLOT(on_cancel()));

    QPushButton *saveButton = new QPushButton();
    saveButton->setText("Save");
    saveButton->setIcon(QIcon(":/icons/ok"));
    buttonBox->addWidget(saveButton);
    connect(saveButton, SIGNAL(clicked()), this, SLOT(on_save()));

    statusBar = new XStatusBar();
    mainOuterLayout->addWidget(statusBar);
    statusBar->showMessage("Loaded", 2000);


}
Exemple #9
0
SidePanel::SidePanel(QWidget *parent_) : 
    QWidget(parent_),
	m_paused(true),
    m_gridWidth(defaultGridSize[0]),
    m_gridHeight(defaultGridSize[1]),
    m_gridLength(defaultGridSize[2]),
    m_argsMap(0),
    m_varsMap(0),
    m_initialCondsMap(0),
	m_defaultCondsMap(0),
    m_saveDirectory(""),
    initDialog(0),
    paramsDialog(0)
{

    // Get parent
    MainWindow *mainWin = qobject_cast<MainWindow *>(parent_);
    if (!mainWin)
        log4cpp::log_console->errorStream() << "SidePanel does not have a parent !";

    this->setStyleSheet("QWidget {background-color: white;}");
    this->setAutoFillBackground(true);

    // GroupBox
    QGroupBox *modelGroupBox = new QGroupBox("Model options");
    QGroupBox *runGroupBox = new QGroupBox("Runtime options");
    QGroupBox *renderOptionsGroupBox = new QGroupBox("Rendering options");

    modelGroupBox->setStyleSheet(
										"QGroupBox {"
										"    border: 1px solid gray;"
										"    border-radius: 9px;"
										"    margin-top: 0.5em;"
										"}"
										""
										"QGroupBox::title {"
										"    subcontrol-origin: margin;"
										"    left: 20px;"
										"    padding: 0 3px 0 3px;"
										"}");
    runGroupBox->setStyleSheet(
										"QGroupBox {"
										"    border: 1px solid gray;"
										"    border-radius: 9px;"
										"    margin-top: 0.5em;"
										"}"
										""
										"QGroupBox::title {"
										"    subcontrol-origin: margin;"
										"    left: 20px;"
										"    padding: 0 3px 0 3px;"
										"}");
    renderOptionsGroupBox->setStyleSheet(
										"QGroupBox {"
										"    border: 1px solid gray;"
										"    border-radius: 9px;"
										"    margin-top: 0.5em;"
										"}"
										""
										"QGroupBox::title {"
										"    subcontrol-origin: margin;"
										"    left: 20px;"
										"    padding: 0 3px 0 3px;"
										"}");
    
    // Layouts
    QBoxLayout *globalLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
    QGridLayout *modelLayout = new QGridLayout(modelGroupBox);
    QGridLayout *runLayout = new QGridLayout(runGroupBox);
    QGridLayout *renderOptionsLayout = new QGridLayout(renderOptionsGroupBox);

    this->setLayout(globalLayout);
    modelGroupBox->setLayout(modelLayout);
    runGroupBox->setLayout(runLayout);
    renderOptionsGroupBox->setLayout(renderOptionsLayout);

    //----//

    // Labels for model
    QLabel *modelLabel = new QLabel("Selected model :");
    QLabel *iterLabel = new QLabel("Iterations :");
    
    // Dropdown list
    modelComboBox = new QComboBox;
    modelComboBox->addItems(SidePanel::modelsList);
    connect(modelComboBox, SIGNAL(currentIndexChanged(int)), mainWin, SLOT(changeModel(int)));
    connect(modelComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshParameters(int)));

    // Iterations spinBox
    iterSpinBox = new QSpinBox();
    iterSpinBox->setRange(1, 1000000);
    iterSpinBox->setSingleStep(defaultNumberOfSteps/10);
    iterSpinBox->setValue(defaultNumberOfSteps);
    connect(iterSpinBox, SIGNAL(valueChanged(int)), mainWin, SLOT(changeNbIter(int)));
    //connect(iterSpinBox, SIGNAL(valueChanged(int)), this, SLOT(changeNbIterSlider(int)));

    // Buttons for model parameters and model initialization with QDialog
    initButton = new QPushButton("Initialization");
    connect(initButton, SIGNAL(clicked()), this, SLOT(openInitDialog()));
    paramsButton = new QPushButton("Parameters");
    connect(paramsButton, SIGNAL(clicked()), this, SLOT(openParametersDialog()));
    
    //---

    // Buttons
    startButton = new QPushButton("Start");
    connect(startButton, SIGNAL(clicked()), this, SLOT(start_pause_resume()));
    connect(this, SIGNAL(startPushed()), mainWin, SLOT(startComputing()));
    connect(this, SIGNAL(pauseOrResumePushed(bool)), mainWin, SLOT(pauseComputing(bool)));
    stopButton = new QPushButton("Stop");
    stopButton->setEnabled(false);
    connect(stopButton, SIGNAL(clicked()), mainWin, SLOT(stopComputing()));
    connect(stopButton, SIGNAL(clicked()), this, SLOT(stop()));

    // Checkbox for saving option
    saveDirCheckBox = new QCheckBox("Save data");
    saveDirCheckBox->setChecked(false);

    // Button for QFileDialog
    saveDirButton = new QPushButton("Choose saving directory");
    connect(saveDirButton, SIGNAL(clicked()), this, SLOT(changeDirectory()));

    // Steps to skip Label
    QLabel *saveStepsLabel = new QLabel("Steps between saves :");

    // Steps to skip Spinbox
    saveStepsSpinBox = new QSpinBox();
    saveStepsSpinBox->setRange(1, 1000000);
    saveStepsSpinBox->setSingleStep(1);
    saveStepsSpinBox->setValue(defaultNbStepsToSave);
    connect(saveStepsSpinBox, SIGNAL(valueChanged(int)), mainWin, SLOT(changeNbStepsToSave(int)));

    //---

    // Labels and lists for variables to display
    QLabel *variablesRenderedLabel = new QLabel("Variables rendered :");
    variablesRenderedList = new QListWidget;
    variablesRenderedList->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
    variablesRenderedList->setMinimumSize(QSize(30,100)); //modify if needed (height = nItems * cst?)
    connect(variablesRenderedList, SIGNAL(itemChanged(QListWidgetItem *)), this, SLOT(updateRenderedVars(QListWidgetItem *)));

    // Rendering colormap label & dropdown list
    QLabel *colorLabel = new QLabel("Colormap :");
    QComboBox *colorComboBox = new QComboBox;
    std::map<std::string, std::pair<unsigned int, float*>> colormap = ColorMap::multiHueColorMaps();
    for (auto it = colormap.begin(); it != colormap.end(); ++it) {
        colorComboBox->addItem(QString(it->first.c_str()));
    }
    connect(colorComboBox, SIGNAL(currentIndexChanged(const QString &)), mainWin, SLOT(changeColormap(const QString &)));

    // Auto rendering checkbox
    QCheckBox *autoRenderCheckBox = new QCheckBox("Automatic rendering");
    autoRenderCheckBox->setChecked(true);
    connect(autoRenderCheckBox, SIGNAL(stateChanged(int)), mainWin, SLOT(changeAutoRendering(int)));
    connect(autoRenderCheckBox, SIGNAL(stateChanged(int)), this, SLOT(showSlider(int)));
    autoRenderCheckBox->setVisible(false);
    
    // Iteration selection slider
    gridSlider = new QSlider(Qt::Horizontal);
    gridSlider->setRange(1, 100); // to be updated when iterSpinBox changes value
    gridSlider->setPageStep(5);
    gridSlider->setSingleStep(1);
    gridSlider->setTracking(false);
    gridSlider->setValue(1);
    gridSlider->hide();
    connect(gridSlider, SIGNAL(valueChanged(int)), mainWin, SLOT(changeDisplayedGrid(int)));
    
    //----//

    // Add Widgets
    globalLayout->setSpacing(30);
    globalLayout->addWidget(modelGroupBox);
    globalLayout->addWidget(runGroupBox);
    globalLayout->addWidget(renderOptionsGroupBox);

    modelLayout->setSpacing(10);
    modelLayout->addWidget(modelLabel, 0, 0);
    modelLayout->addWidget(modelComboBox, 0, 1);
    modelLayout->addWidget(iterLabel, 1, 0);
    modelLayout->addWidget(iterSpinBox, 1, 1);
    modelLayout->addWidget(initButton, 2, 0);
    modelLayout->addWidget(paramsButton, 2, 1);

    runLayout->setSpacing(10);
    runLayout->addWidget(startButton, 0, 0, 1, 2);
    runLayout->addWidget(stopButton, 1, 0, 1, 2);
    runLayout->addWidget(saveDirCheckBox, 2, 0);
    runLayout->addWidget(saveDirButton, 2, 1);
    runLayout->addWidget(saveStepsLabel, 3, 0);
    runLayout->addWidget(saveStepsSpinBox, 3, 1);

    renderOptionsLayout->setSpacing(10);
    renderOptionsLayout->addWidget(variablesRenderedLabel, 0, 0);
    renderOptionsLayout->addWidget(variablesRenderedList, 0, 1);
    renderOptionsLayout->addWidget(colorLabel, 1, 0);
    renderOptionsLayout->addWidget(colorComboBox,1 , 1);
    renderOptionsLayout->addWidget(autoRenderCheckBox, 2, 0);
    renderOptionsLayout->addWidget(gridSlider, 2, 1);
    
    // Init m_argsMap and m_varsMap
    refreshParameters(modelComboBox->currentIndex());
}