示例#1
0
void ProductWidget::createMainLayout()
{
    // Create form layout.
    m_categoryEdit = new QComboBox;

    m_idLabel      = new QLabel("----------");
    m_idLabel->setStyleSheet("QLabel {font:bold;}");

    m_nameLineEdit = new QLineEdit;
    m_unitEdit     = new QLineEdit;
    m_noteLineEdit = new QLineEdit;

    m_categoryEdit->setDisabled(true);
    m_nameLineEdit->setDisabled(true);
    m_unitEdit->setDisabled(true);
    m_noteLineEdit->setDisabled(true);

    m_idLabel->setFixedWidth(200);
    m_noteLineEdit->setFixedWidth(512);

    QFormLayout * fLayout = new QFormLayout;
    fLayout->addRow(tr("Category") + ":", m_categoryEdit);
    fLayout->addRow(tr("Id") + ":", m_idLabel);
    fLayout->addRow(tr("Name") + ":", m_nameLineEdit);
    fLayout->addRow(tr("Unit") + ":", m_unitEdit);
    fLayout->addRow(tr("Note") + ":", m_noteLineEdit);
    fLayout->setAlignment(Qt::AlignLeft);

    QHBoxLayout * formLayout = new QHBoxLayout;
    formLayout->addLayout(fLayout);
    formLayout->addStretch(1);

    // Create driver item view.
    m_treeView = new QTreeView;
    m_treeView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_treeView->setSelectionMode(QAbstractItemView::SingleSelection);
    m_treeView->setAlternatingRowColors(true);
    m_treeView->setRootIsDecorated(false);

    QStringList headers;
    headers << tr("Category") << tr("Id") << tr("Name") << tr("Unit") << tr("Note");

    m_model = new QStandardItemModel(this);
    m_model->setHorizontalHeaderLabels(headers);
    m_treeView->setModel(m_model);

    QItemSelectionModel * selectionModel = m_treeView->selectionModel();
    connect(selectionModel, SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &))
            ,  this, SLOT(currentRecordChange(const QItemSelection &, const QItemSelection &)));

    // Create main layout.
    QVBoxLayout * mainLayout = new QVBoxLayout;
    mainLayout->addLayout(formLayout);
    mainLayout->addWidget(m_treeView, 1);

    QWidget * w = new QWidget;
    w->setLayout(mainLayout);

    this->setCentralWidget(w);
}
FormMetallisation::FormMetallisation(metallisation* metal, QWidget *parent) :
    FormElementBase(metal,parent)
{
    this->metal=metal;

    setWindowTitle("Créer métallisation");

    QVBoxLayout * layoutPrincipal = new QVBoxLayout();

    QGroupBox * groupGeo = new QGroupBox("Métallisation");

    QFormLayout * layout = new QFormLayout;

    lineEditConductivite = new QDoubleSpinBox();
    layout->addRow("Conductivité:",lineEditConductivite);

    layout->addRow(getWidgetElementBase());

    layout->setAlignment(Qt::AlignTop);

    groupGeo->setLayout(layout);

    layoutPrincipal->addWidget(groupGeo);

    setLayout(layoutPrincipal);

    init();

}
示例#3
0
void AppearanceSettings::initUi()
{
    m_themeCombo = new QComboBox;
    m_themeCombo->setModel(new QStringListModel(this));
    connect(m_themeCombo, SIGNAL(currentIndexChanged(int)), SLOT(themeChanged(int)));

    m_colorCombo = new QComboBox;
    m_colorCombo->setModel(new QStringListModel(this));
    connect(m_colorCombo, SIGNAL(currentIndexChanged(int)), SLOT(colorChanged(int)));

    m_backgroundCombo = new QComboBox;
    m_backgroundCombo->setModel(new QStringListModel(this));
    connect(m_backgroundCombo, SIGNAL(currentIndexChanged(int)), SLOT(backgroundChanged(int)));

    m_softKeyIconCheck = new QCheckBox(tr("Use icons for soft keys"));
    gConfig.beginGroup("ContextMenu");
    int labelType = (QSoftMenuBar::LabelType)gConfig.value("LabelType", QSoftMenuBar::TextLabel).toInt();
    gConfig.endGroup();
    m_softKeyIconCheck->setChecked(labelType == QSoftMenuBar::IconLabel);
    connect(m_softKeyIconCheck, SIGNAL(clicked(bool)), SLOT(softKeyOptionChanged()));

    QFormLayout *form = new QFormLayout;
    form->addRow(tr("Theme"), m_themeCombo);
    form->addRow(tr("Color"), m_colorCombo);
    form->addRow(tr("Background"), m_backgroundCombo);
    form->addRow(m_softKeyIconCheck);
    form->setAlignment(m_softKeyIconCheck, Qt::AlignCenter);

    m_previewTitle = new QLabel;
    m_previewSoftMenuBar = new QLabel;
    m_previewBackground = new QLabel;

    QGridLayout *previewGrid = new QGridLayout;
    previewGrid->setMargin(10);
    previewGrid->setAlignment(Qt::AlignHCenter | Qt::AlignTop);
    previewGrid->addWidget(m_previewTitle, 0, 0);
    previewGrid->addWidget(m_previewSoftMenuBar, 1, 0);
    previewGrid->addWidget(m_previewBackground, 0, 1, 2, 1);

    m_previewBox = new QGroupBox;
    m_previewBox->setLayout(previewGrid);
    form->addRow(m_previewBox);
    m_previewBox->hide();   // hide until a preview is shown

    QScrollArea *scroll = new QScrollArea;
    scroll->setFocusPolicy(Qt::NoFocus);
    scroll->setFrameStyle(QFrame::NoFrame);
    QWidget *w = new QWidget;
    w->setLayout(form);
    scroll->setWidget(w);
    scroll->setWidgetResizable(true);
    scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setContentsMargins(0, 0, 0, 0);
    mainLayout->addWidget(scroll);
    setLayout(mainLayout);
}
示例#4
0
NewFileDialog::NewFileDialog(QWidget *parent)
: QDialog(parent),
  _shaderCombo(new QComboBox),
  _folderLineEdit(new QLineEdit),
  _fileNameLineEdit(new QLineEdit),
  _newButton(new QPushButton(QIcon(":/document-new.png"), tr("&New"))),
  _cancelButton(new QPushButton(QIcon(":/dialog-cancel.png"), tr("&Cancel"))),
  _browseButton(new QPushButton(QIcon(":/document-open-folder.png"), tr("&Browse...")))
{
  QGroupBox* typeGroupBox = new QGroupBox(tr("Properties"));
  QGroupBox* locationGroupBox = new QGroupBox(tr("File Location"));

  QFormLayout* propertiesLayout = new QFormLayout;
  propertiesLayout->setAlignment(Qt::AlignLeft);
  _fileNameLineEdit->setPlaceholderText(tr("Shader Identifier..."));
  propertiesLayout->addRow(tr("Identifier:"), _fileNameLineEdit);
  _shaderCombo->insertItem(0, tr("Vertex Shader"), ShaderObject::VertexShader);
  _shaderCombo->insertItem(1, tr("Tesselation Evaluation Shader"), ShaderObject::TesselationControlShader);
  _shaderCombo->insertItem(2, tr("Tesselation Evaluation Shader"), ShaderObject::TesselationEvaluationShader);
  _shaderCombo->insertItem(3, tr("Geometry Shader"), ShaderObject::GeometryShader);
  _shaderCombo->insertItem(4, tr("Fragment Shader"), ShaderObject::FragmentShader);
  propertiesLayout->addRow(tr("Type:"), _shaderCombo);

  QHBoxLayout* locationLayout = new QHBoxLayout;
  locationLayout->addWidget(new QLabel(tr("Location:")));
  _folderLineEdit->setPlaceholderText(tr("Folder..."));
  _folderLineEdit->setMinimumWidth(300);
  locationLayout->addWidget(_folderLineEdit);
  locationLayout->addWidget(_browseButton);

  QBoxLayout* buttonsLayout = new QBoxLayout(QBoxLayout::LeftToRight);
  buttonsLayout->setAlignment(Qt::AlignRight);
  buttonsLayout->addWidget(_newButton);
  buttonsLayout->addWidget(_cancelButton);

  locationGroupBox->setLayout(locationLayout);
  typeGroupBox->setLayout(propertiesLayout);

  QVBoxLayout* mainLayout = new QVBoxLayout(this);
  mainLayout->addWidget(typeGroupBox);
  mainLayout->addWidget(locationGroupBox);
  mainLayout->addLayout(buttonsLayout);

  connect(_browseButton, SIGNAL(clicked()), this, SLOT(browseFolder()));
  connect(_newButton, SIGNAL(clicked()), this, SLOT(accept()));
  connect(_cancelButton, SIGNAL(clicked()), this, SLOT(reject()));

  _newButton->setDefault(true);
  setWindowTitle(tr("New Shader File"));
}
void TeamView::generateRobotViews(QGridLayout* teamGrid)
{
  std::vector<std::vector<Robot*>> robots = team->getPlayersPerNumber();
  size_t max = robots.size();
  for(size_t j = 0; j < 2; ++j)
    for(size_t i = 0; i < max; ++i)
    {
      RobotView* rv = new RobotView(teamSelector, robots[i][j], (unsigned short)(i + 1), (unsigned short) j);
      robotViews.push_back(rv);
      teamGrid->addWidget(rv, j > 0 ? 2 : 0, (int) i);
    }
  QFrame* hr = new QFrame(this);
  hr->setFrameStyle(QFrame::Sunken | QFrame::HLine);
  QFormLayout* subTitle = new QFormLayout();
  teamGrid->addLayout(subTitle, 1, 0, 1, (int) max, Qt::AlignVCenter);

  QLabel* substitutes = new QLabel("<b>Substitutes</b> (NAOqi will not start)");
  subTitle->addRow(substitutes, hr);
  subTitle->setAlignment(hr, Qt::AlignVCenter);
}
void TeamView::init()
{
  if(team)
  {
    QFormLayout* layout = new QFormLayout();
    QHBoxLayout* settingsGrid = new QHBoxLayout();
    settingsGrid->setSpacing(6);
    settingsGrid->setAlignment(Qt::AlignmentFlag::AlignLeft);

    pbSave = new QPushButton(QIcon(":icons/disk.png"), "");
    pbSave->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
    pbSave->setToolTip("Save Team Configuration");
    settingsGrid->addWidget(pbSave);
    connect(pbSave, SIGNAL(clicked()), teamSelector, SLOT(saveTeams()));

    cbColor = new QComboBox(this);
    cbColor->addItem("red");
    cbColor->addItem("blue");
    cbColor->addItem("yellow");
    cbColor->addItem("black");
    cbColor->addItem("white");
    cbColor->addItem("green");
    cbColor->addItem("orange");
    cbColor->addItem("purple");
    cbColor->addItem("brown");
    cbColor->addItem("gray");
    cbColor->setCurrentIndex(cbColor->findText(fromString(team->color)));
    settingsGrid->addWidget(new QLabel("<b>Color:</b>", cbColor));
    settingsGrid->addWidget(cbColor);
    connect(cbColor, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(colorChanged(const QString&)));

    sbNumber = new QSpinBox(this);
    sbNumber->setRange(1, 99);
    sbNumber->setButtonSymbols(QAbstractSpinBox::NoButtons);
    sbNumber->setMaximumWidth(18);
    sbNumber->setValue(team->number);
    settingsGrid->addWidget(new QLabel("<b>Number:</b>", sbNumber));
    settingsGrid->addWidget(sbNumber);
    connect(sbNumber, SIGNAL(valueChanged(int)), this, SLOT(numberChanged(int)));

    cbLocation = new QComboBox(this);
    std::vector<std::string> locations = Filesystem::getLocations();
    for(size_t i = 0; i < locations.size(); ++i)
      cbLocation->addItem(fromString(locations[i]));
    cbLocation->setCurrentIndex(cbLocation->findText(fromString(team->location)));
    settingsGrid->addWidget(new QLabel("<b>Location:</b>", lePort));
    settingsGrid->addWidget(cbLocation);
    connect(cbLocation, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(locationChanged(const QString&)));

    cbWlanConfig = new QComboBox(this);
    std::vector<std::string> configs = Filesystem::getWlanConfigs();
    for(size_t i = 0; i < configs.size(); ++i)
      cbWlanConfig->addItem(fromString(configs[i]));
    cbWlanConfig->setCurrentIndex(cbWlanConfig->findText(fromString(team->wlanConfig)));
    settingsGrid->addWidget(new QLabel("<b>Wlan:<b/>", cbWlanConfig));
    settingsGrid->addWidget(cbWlanConfig);
    connect(cbWlanConfig, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(wlanConfigChanged(const QString&)));

    cbBuildConfig = new QComboBox(this);
    cbBuildConfig->addItem("Develop");
    cbBuildConfig->addItem("Release");
    cbBuildConfig->addItem("Debug");
    cbBuildConfig->setCurrentIndex(cbBuildConfig->findText(fromString(team->buildConfig)));
    settingsGrid->addWidget(new QLabel("<b>Conf:</b>", cbBuildConfig));
    settingsGrid->addWidget(cbBuildConfig);
    connect(cbBuildConfig, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(buildConfigChanged(const QString&)));

    sVolume = new QSlider(this);
    sVolume->setMinimum(0);
    sVolume->setMaximum(100);
    sVolume->setTickInterval(1);
    sVolume->setValue(team->volume);
    settingsGrid->addWidget(new QLabel("<b>Vol:</b>", sVolume));
    settingsGrid->addWidget(sVolume);
    connect(sVolume, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(const int)));

    settingsGrid->addStretch();

    cbDeployDevice = new QComboBox(this);
    cbDeployDevice->addItem("auto");
    cbDeployDevice->addItem("lan");
    cbDeployDevice->addItem("wlan");
    cbDeployDevice->setCurrentIndex(cbDeployDevice->findText(fromString(team->deployDevice)));
    settingsGrid->addWidget(new QLabel("<b>Device:</b>", cbDeployDevice));
    settingsGrid->addWidget(cbDeployDevice);
    connect(cbDeployDevice, SIGNAL(currentIndexChanged(const QString&)), this, SLOT(deployDeviceChanged(const QString&)));

    sbMagic = new QSpinBox(this);
    sbMagic->setRange(-1, 255);
    sbMagic->setButtonSymbols(QAbstractSpinBox::NoButtons);
    sbMagic->setMaximumWidth(23);
    sbMagic->setValue(team->magicNumber);
    settingsGrid->addWidget(new QLabel("<b>Magic Number:</b>", sbMagic));
    settingsGrid->addWidget(sbMagic);
    connect(sbMagic, SIGNAL(valueChanged(int)), this, SLOT(magicNumberChanged(int)));

    layout->addRow(settingsGrid);

    QFrame* hr = new QFrame(this);
    hr->setFrameStyle(QFrame::Sunken | QFrame::HLine);
    QLabel* players = new QLabel("<b>Players</b>");
    layout->addRow(players, hr);
    layout->setAlignment(hr, Qt::AlignVCenter);

    QGridLayout* teamGrid = new QGridLayout();
    generateRobotViews(teamGrid);
    layout->addRow(teamGrid);

    setLayout(layout);
  }
}
MangaDownloadWidget::MangaDownloadWidget(QWidget* parent):
  QWidget(parent),
  _scansDirectory(Utils::getScansDirectory()),
  _mangaList(Utils::dirList(_scansDirectory)),
  _currentMangaDirectory(),
  _currentChapter(),
  _downloadQueue(),
  _chaptersQueue(),
  _downloadedCount(0),
  _totalCount(0) {


  /// Select manga line edit
  _selectLineEdit = new QLineEdit;
  _selectLineEdit->setFixedWidth(250);
  connect(_selectLineEdit, SIGNAL(textChanged(QString)), this, SLOT(checkMangaNameExists(QString)));
//  connect(_selectLineEdit, SIGNAL(editingFinished(void)), this, SLOT(updateChaptersOnPCView(void)));
//  connect(_selectLineEdit, SIGNAL(returnPressed(void)), this, SLOT(updateChaptersOnPCView(void)));

  QCompleter* completer = new QCompleter(_mangaList, this);
  completer->setCaseSensitivity(Qt::CaseInsensitive);
  completer->setCompletionMode(QCompleter::PopupCompletion);

  _selectLineEdit->setCompleter(completer);

  QFormLayout* chooseMangaLayout = new QFormLayout;
  chooseMangaLayout->addRow("Select your manga:", _selectLineEdit);


  /// Chapters on PC

  _chaptersOnPCModel = new QStringListModel;

  _chaptersOnPCView = new ChaptersOnPCView;
  _chaptersOnPCView->setModel(_chaptersOnPCModel);
  _chaptersOnPCView->setEditTriggers(QAbstractItemView::NoEditTriggers);

  // _chaptersOnPCView->setDragDropMode(QAbstractItemView::DropOnly);
  connect(_chaptersOnPCView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(goToRead(QModelIndex)));

  QVBoxLayout* chaptersOnPCLayout = new QVBoxLayout;
  chaptersOnPCLayout->addWidget(_chaptersOnPCView);

  QGroupBox* chaptersOnPCGroupBox = new QGroupBox("Chapters on your computer");
  chaptersOnPCGroupBox->setLayout(chaptersOnPCLayout);


  /// Chapters on web

  _chaptersOnWebModel = new QStandardItemModel;

  _chaptersOnWebView = new ChaptersOnWebView(this);
  _chaptersOnWebView->setSelectionMode(QAbstractItemView::ExtendedSelection);
  _chaptersOnWebView->setModel(_chaptersOnWebModel);
  _chaptersOnWebView->setEditTriggers(QAbstractItemView::NoEditTriggers);

  QVBoxLayout* chaptersOnWebLayout = new QVBoxLayout;
  chaptersOnWebLayout->addWidget(_chaptersOnWebView);

  QGroupBox* chaptersOnWebGroupBox = new QGroupBox("New chapters online");
  chaptersOnWebGroupBox->setLayout(chaptersOnWebLayout);


  /// Central buttons

  _updateButton = new QPushButton;
  _updateButton->setIcon(QIcon(Utils::getIconsPath()+"/reload.png"));
  _updateButton->setFixedWidth(37);
  connect(_updateButton, SIGNAL(clicked(void)), this, SLOT(updateChaptersList(void)));

  _downloadButton = new QPushButton;
  _downloadButton->setIcon(QIcon(Utils::getIconsPath()+"/leftArrow.gif"));
  _downloadButton->setFixedWidth(37);
  connect(_downloadButton, SIGNAL(clicked(void)), this, SLOT(downloadChapters(void)));

  _selectAllButton = new QPushButton;
  _selectAllButton->setIcon(QIcon(Utils::getIconsPath()+"/selectAll.gif"));
  _selectAllButton->setFixedWidth(37);
  connect(_selectAllButton, SIGNAL(clicked(void)), _chaptersOnWebView, SLOT(selectAll(void)));

  QVBoxLayout* buttonsWebLayout = new QVBoxLayout;
  buttonsWebLayout->addWidget(_updateButton);
  buttonsWebLayout->addWidget(_downloadButton);
  buttonsWebLayout->addWidget(_selectAllButton);
  buttonsWebLayout->setAlignment(Qt::AlignVCenter);


  /// Chapters on PC, central buttons and chapters on web layout

  QHBoxLayout* viewsLayout = new QHBoxLayout;
  viewsLayout->addWidget(chaptersOnPCGroupBox);
  viewsLayout->addLayout(buttonsWebLayout);
  viewsLayout->addWidget(chaptersOnWebGroupBox);


  /// Message output

  _messageView = new MessageListView;
  _messageItemDelegate = new MessageItemDelegate;
  _messageModel = new MessageListModel;
  _messageView->setItemDelegate(_messageItemDelegate);
  _messageView->setModel(_messageModel);


  /// Bottom buttons

  _clearTextEditButton = new QPushButton;
  _clearTextEditButton->setIcon(QIcon(Utils::getIconsPath()+"/clean.png"));
  _clearTextEditButton->setFixedWidth(37);
  connect(_clearTextEditButton, SIGNAL(clicked(void)), _messageModel, SLOT(clearMessages(void)));

  _stopButton = new QPushButton;
  _stopButton->setIcon(QIcon(Utils::getIconsPath()+"/stop.png"));
  _stopButton->setFixedWidth(37);
  _stopButton->setEnabled(false);
  connect(_stopButton, SIGNAL(clicked(void)), this, SLOT(stopDownload(void)));


  /// Progress bars

  _chaptersProgressBar = new QProgressBar;
  _chaptersProgressBar->setVisible(false);
  _chaptersProgressBar->setFixedSize(300, 20);

  _chaptersDownloadedLabel = new QLabel;

  _pagesProgressBar = new QProgressBar;
  _pagesProgressBar->setVisible(false);
  _pagesProgressBar->setFixedSize(300, 20);

  _pagesDownloadedLabel = new QLabel;


  /// Bottom buttons and progress bar layout

  QFormLayout* chaptersProgressLayout = new QFormLayout;
  chaptersProgressLayout->addRow(_chaptersProgressBar, _chaptersDownloadedLabel);
  chaptersProgressLayout->setAlignment(Qt::AlignLeft);

  QFormLayout* pagesProgressLayout = new QFormLayout;
  pagesProgressLayout->addRow(_pagesProgressBar, _pagesDownloadedLabel);
  pagesProgressLayout->setAlignment(Qt::AlignLeft);

  QVBoxLayout* progressLayout = new QVBoxLayout;
  progressLayout->addLayout(chaptersProgressLayout);
  progressLayout->addLayout(pagesProgressLayout);

  QHBoxLayout* messageButtonLayout = new QHBoxLayout;
  messageButtonLayout->addWidget(_clearTextEditButton);
  messageButtonLayout->addWidget(_stopButton);
  messageButtonLayout->addLayout(progressLayout);
  messageButtonLayout->setAlignment(Qt::AlignLeft);

  QVBoxLayout* messageLayout = new QVBoxLayout;
  messageLayout->addLayout(messageButtonLayout);
  messageLayout->addWidget(_messageView);
  messageLayout->setAlignment(Qt::AlignLeft);

  QGroupBox* messageGroupBox = new QGroupBox("Output");
  messageGroupBox->setLayout(messageLayout);

  QLabel* titleLabel = new QLabel("Manga Download");
  titleLabel->setFont(QFont("", 18, 99));


  /// Main layout

  QVBoxLayout* mainLayout = new QVBoxLayout;
  mainLayout->addWidget(titleLabel);
  mainLayout->addLayout(chooseMangaLayout);
  mainLayout->addLayout(viewsLayout);
  mainLayout->addWidget(messageGroupBox);

  setLayout(mainLayout);


  /// Get chapters on web list process

  _getChaptersListProcess = new QProcess(this);
  connect(_getChaptersListProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(chaptersListUpdated(int,QProcess::ExitStatus)));
  connect(_getChaptersListProcess, SIGNAL(started(void)), this, SLOT(chaptersListUpdateStarted(void)));
  connect(_getChaptersListProcess, SIGNAL(readyReadStandardOutput(void)), this, SLOT(getChaptersListUpdated(void)));


  /// Download chapters process

  _downloadChapterProcess = new QProcess(this);
  connect(_downloadChapterProcess, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(downloadFinished(int,QProcess::ExitStatus)));
  connect(_downloadChapterProcess, SIGNAL(started(void)), this, SLOT(nextDownloadHasStarted(void)));
  connect(_downloadChapterProcess, SIGNAL(readyReadStandardOutput(void)), this, SLOT(getDownloadInfo(void)));


  /// Style

  QString progressBarStyle(
  "QProgressBar {"
  "    border: 1px solid lightgrey;"
  "    border-radius: 5px;"
  "    text-align: center;"
  "    font-weight: bold;"
  "}"
  "QProgressBar::chunk {"
  "    background-color: #449D44;"
  "    width: 10px;"
//  "    margin: 0.5px;"
  "}"
  );
  setStyleSheet(styleSheet()+progressBarStyle);


}
void SpriteGraphicsViewOption::_initWidgets ()
{
    _showSceneBorder = new QCheckBox(tr("Show scene border"));
    _backColor = new ColorButton;
    _zoom = new QComboBox;
    _showGrid = new QGroupBox(tr("Show grid"));
    _snap = new QCheckBox(tr("Snap to grid"));
    _gridColor = new ColorButton;
    _gridOpacity = new QSpinBox;
    _gridWidth = new QSpinBox;
    _gridHeight = new QSpinBox;
    _displaySelectionShadow = new QCheckBox(tr("Display selection shadow"));
    _selectionColor = new ColorButton;

    _zoom->addItem("800%", 8.0);
    _zoom->addItem("400%", 4.0);
    _zoom->addItem("200%", 2.0);
    _zoom->addItem("100%", 1.0);
    _zoom->addItem("50%", 0.5);
    _zoom->addItem("25%", 0.25);
    _showGrid->setStyleSheet("QGroupBox::title{font-bold:false}");
    _showGrid->setFlat(true);
    _showGrid->setCheckable(true);
    _gridOpacity->setMaximum(100);
    _gridOpacity->setSuffix("%");
    _gridWidth->setMinimum(1);
    _gridWidth->setSingleStep(8);
    _gridHeight->setMinimum(1);
    _gridHeight->setSingleStep(8);

    QFormLayout *styleLayout = new QFormLayout;
    styleLayout->addRow(tr("Color:"), _gridColor);
    styleLayout->addRow(tr("Opacity:"), _gridOpacity);
    styleLayout->setAlignment(_gridColor, Qt::AlignCenter);
    styleLayout->setLabelAlignment(Qt::AlignRight);
    _showGrid->setLayout(styleLayout);

    QGroupBox *gridGroup = new QGroupBox(tr("Grid"));
    QGridLayout *gridLayout = new QGridLayout;
    gridLayout->addWidget(_snap, 0, 0, 1, 2, Qt::AlignCenter);
    gridLayout->addWidget(new QLabel(tr("Width:")), 1, 0, 1, 1, Qt::AlignRight);
    gridLayout->addWidget(_gridWidth, 1, 1);
    gridLayout->addWidget(
        new QLabel(tr("Height:")), 2, 0, 1, 1, Qt::AlignRight
    );
    gridLayout->addWidget(_gridHeight, 2, 1);
    gridLayout->addWidget(_showGrid, 0, 3, 3, 1);
    gridLayout->setColumnMinimumWidth(2, 15);
    gridGroup->setLayout(gridLayout);

    QGridLayout *layout = new QGridLayout;
    layout->addWidget(_showSceneBorder, 0, 0, 1, 2, Qt::AlignCenter);
    layout->addWidget(
        new QLabel(tr("Background color:")), 1, 0, 1, 1, Qt::AlignRight
    );
    layout->addWidget(_backColor, 1, 1, 1, 1, Qt::AlignCenter);
    layout->addWidget(
        new QLabel(tr("Zoom:")), 2, 0, 1, 1, Qt::AlignRight
    );
    layout->addWidget(_zoom, 2, 1);
    layout->addWidget(
        new QLabel(tr("Selection color:")), 0, 3, 1, 1, Qt::AlignRight
    );
    layout->addWidget(_selectionColor, 0, 4);
    layout->addWidget(_displaySelectionShadow, 1, 3, 1, 2, Qt::AlignCenter);
    layout->addWidget(gridGroup, 3, 0, 1, 5, Qt::AlignCenter);
    layout->setColumnMinimumWidth(2, 15);
    setLayout(layout);
}