Пример #1
0
RuleWidget::RuleWidget(QWidget *parent) :
    QWidget(parent)
{
    auto layout = new QVBoxLayout(this);
    auto firstline = new QHBoxLayout();
    auto secondline = new QHBoxLayout();
    layout->addLayout(firstline);
    layout->addLayout(secondline);
    firstline->addWidget(new QLabel(ifStr(), this));
    column = new QComboBox(this);
    auto columnList = Statements::columnList();
    for(auto columnName : columnList)
        column->addItem(columnName);
    firstline->addWidget(column);
    type = new QComboBox(this);
    for(auto typestr : Rules::typeList())
        type->addItem(typestr);

    firstline->addWidget(type);
    value = new QLineEdit(this);
    firstline->addWidget(value);
    firstline->addWidget(new QLabel(",", this));
    secondline->addWidget(new QLabel(thenStr(), this));
    setCategories(secondline);
    connect(column, SIGNAL(currentIndexChanged(int)), this, SLOT(columnChanged(int)));
    connect(type, SIGNAL(currentIndexChanged(int)), this, SLOT(typeChanged(int)));
    connect(value, SIGNAL(textChanged(QString)), this, SLOT(valueChanged(QString)));
    type->setCurrentIndex(0);
    typeChanged(0);
}
Пример #2
0
void ObjectExplorer::createLayout()
{
  QLabel * groupLabel = new QLabel("Search groups:", this);
  groupLabel->setBuddy(mGroupEdit);

  QLabel * objectLabel = new QLabel("Search classes:", this);
  objectLabel->setBuddy(mObjectEdit);

  auto groupEditLayout = new QHBoxLayout();
  groupEditLayout->addWidget(groupLabel);
  groupEditLayout->addWidget(mGroupEdit);

  auto objectEditLayout = new QHBoxLayout();
  objectEditLayout->addWidget(objectLabel);
  objectEditLayout->addWidget(mObjectEdit);

  auto groupLayout = new QVBoxLayout();
  groupLayout->addLayout(groupEditLayout);
  groupLayout->addWidget(mGroupList);
  QGroupBox * groupBox = new QGroupBox(tr("Groups"));
  groupBox->setLayout(groupLayout);

  auto objectLayout = new QVBoxLayout();
  objectLayout->addLayout(objectEditLayout);
  objectLayout->addWidget(mObjectList);
  QGroupBox * objectBox = new QGroupBox(tr("Classes"));
  objectBox->setLayout(objectLayout);

  auto hLayout = new QHBoxLayout();
  hLayout->addWidget(groupBox);
  hLayout->addWidget(objectBox);

  setLayout(hLayout);
}
Пример #3
0
void OSDialog::createLayout()
{
  m_upperLayout = new QVBoxLayout();

  auto lowerLayout = new QHBoxLayout();

  lowerLayout->addStretch();

  m_backButton = new QPushButton("Back",this);
  connect(m_backButton, &QPushButton::clicked, this, &OSDialog::on_backButton);
  connect(m_backButton, &QPushButton::clicked, this, &OSDialog::backButtonClicked);
  lowerLayout->addWidget(m_backButton);
  m_backButton->hide();

  m_okButton = new QPushButton("OK",this);
  m_okButton->setDefault(true);
  connect(m_okButton, &QPushButton::clicked, this, &OSDialog::on_okButton);
  connect(m_okButton, &QPushButton::clicked, this, &OSDialog::okButtonClicked);
  lowerLayout->addWidget(m_okButton);

  m_cancelButton = new QPushButton("Cancel",this);
  connect(m_cancelButton, &QPushButton::clicked, this, &OSDialog::on_cancelButton);
  connect(m_cancelButton, &QPushButton::clicked, this, &OSDialog::cancelButtonClicked);
  lowerLayout->addWidget(m_cancelButton);

  auto mainLayout = new QVBoxLayout();
  mainLayout->setContentsMargins(m_layoutContentsMargins);
  mainLayout->addLayout(m_upperLayout);
  mainLayout->addLayout(lowerLayout);

  setLayout(mainLayout);
}
Пример #4
0
CheatDialog::CheatDialog(QString const &savefile, QWidget *parent)
: QDialog(parent)
, view_(new QListView(this))
, editButton_(new QPushButton(tr("Edit..."), this))
, rmButton_(new QPushButton(tr("Remove"), this))
, savefile_(savefile)
{
	setWindowTitle("Cheats");

	QVBoxLayout *const mainLayout = new QVBoxLayout(this);
	QVBoxLayout *const viewLayout = addLayout(mainLayout, new QVBoxLayout);
	viewLayout->addWidget(view_);
	resetViewModel(items_);

	QPushButton *const addButton = addWidget(viewLayout, new QPushButton(tr("Add...")));
	connect(addButton,  SIGNAL(clicked()), this, SLOT(addCheat()));
	editButton_->setParent(0); // tab order reparent
	viewLayout->addWidget(editButton_);
	connect(editButton_, SIGNAL(clicked()), this, SLOT(editCheat()));
	rmButton_->setParent(0); // tab order reparent
	viewLayout->addWidget(rmButton_);
	connect(rmButton_, SIGNAL(clicked()), this, SLOT(removeCheat()));

	QBoxLayout *const hLayout = addLayout(mainLayout, new QHBoxLayout,
	                                      Qt::AlignBottom | Qt::AlignRight);
	QPushButton *const okButton = addWidget(hLayout, new QPushButton(tr("OK")));
	QPushButton *const cancelButton = addWidget(hLayout, new QPushButton(tr("Cancel")));
	okButton->setDefault(true);
	connect(okButton, SIGNAL(clicked()), this, SLOT(accept()));
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
Пример #5
0
sample_editor::sample_editor()
    : current_sample(0)
{
    auto vert_section = new QVBoxLayout(this);
    auto top_section = new QHBoxLayout();
    auto bottom_section = new QHBoxLayout();

    top_section->addWidget(&this->current_sample);
    top_section->addWidget(&this->zoom);
    top_section->addWidget(&this->name);
    top_section->addWidget(&this->filename);

    bottom_section->addWidget(&this->default_volume);
    bottom_section->addWidget(&this->global_volume);
    bottom_section->addWidget(&this->default_pan);
    bottom_section->addWidget(&this->c5freq);
    bottom_section->addWidget(&this->transpose);
    bottom_section->addWidget(&this->loop);
    bottom_section->addWidget(&this->susloop);
    bottom_section->addWidget(&this->vibratobox);

    vert_section->addLayout(top_section);
    vert_section->addLayout(bottom_section);

}
Пример #6
0
  SubSection(const QString & title, const QString & description, QLabel * imageLabel) : QWidget() 
  {
    auto mainHLayout = new QHBoxLayout();
    setLayout(mainHLayout);

    mainHLayout->addWidget(imageLabel);

    auto mainVLayout = new QVBoxLayout();
    mainHLayout->addLayout(mainVLayout);
    auto titleLabel = new QLabel(title);
    titleLabel->setStyleSheet("QLabel { font-size: 14px; font: bold; color: #242D31; }");
    titleLabel->setWordWrap(true);
    mainVLayout->addWidget(titleLabel);

    auto descriptionHLayout = new QHBoxLayout();
    mainVLayout->addLayout(descriptionHLayout);
    descriptionHLayout->addSpacing(35);

    auto descriptionLabel = new QLabel(description);
    descriptionLabel->setFixedWidth(700);
    descriptionLabel->setStyleSheet("QLabel { font-size: 14px; color: black; }");
    descriptionLabel->setWordWrap(true);
    descriptionHLayout->addWidget(descriptionLabel);

    mainHLayout->setAlignment(Qt::AlignLeft);
  }
Пример #7
0
ChangeAliasDialog::ChangeAliasDialog(const QString& oldAlias, const QString& filename, QWidget* parent):QDialog(parent)
{
  m_newAlias = "";

  int boxWidth = fontMetrics().width(filename) + 20;
  QPalette p(palette());
  p.setColor(QPalette::Base, Qt::lightGray);    

  QLabel *fileLabel = new QLabel(tr("&EnergyPlus file:"));
  auto fileName = new QLineEdit(filename);
  fileLabel->setBuddy(fileName);
  fileName->setReadOnly(true);
  fileName->setPalette(p);
  fileName->setMinimumWidth(boxWidth);

  QLabel *oldAliasLabel = new QLabel(tr("&Old alias:"));
  auto oldAliasName = new QLineEdit(oldAlias);
  oldAliasLabel->setBuddy(oldAliasName);
  oldAliasName->setReadOnly(true);
  oldAliasName->setPalette(p);
  oldAliasName->setMinimumWidth(boxWidth);

  QLabel *newAliasLabel = new QLabel(tr("&New alias:"));
  m_newAliasName = new QLineEdit;
  newAliasLabel->setBuddy(m_newAliasName);
  m_newAliasName->setMinimumWidth(boxWidth);

  m_updateButton = new QPushButton(tr("Update"));
  m_updateButton->setDefault(true);
  m_updateButton->setEnabled(false);

  QPushButton *cancelButton = new QPushButton(tr("Cancel"));

  connect(m_updateButton, &QPushButton::clicked, this, &ChangeAliasDialog::updateClicked);
  connect(cancelButton, &QPushButton::clicked, this, &ChangeAliasDialog::close);
  connect(m_newAliasName, &QLineEdit::textChanged, this, &ChangeAliasDialog::enableUpdateButton);
// layout
  auto gridLayout = new QGridLayout;
  gridLayout->addWidget(fileLabel, 0, 0);
  gridLayout->addWidget(fileName, 0, 1);
  gridLayout->addWidget(oldAliasLabel, 1, 0);
  gridLayout->addWidget(oldAliasName, 1, 1);
  gridLayout->addWidget(newAliasLabel, 2, 0);
  gridLayout->addWidget(m_newAliasName, 2, 1);

  auto buttonLayout = new QHBoxLayout;
  buttonLayout->addStretch();
  buttonLayout->addWidget(m_updateButton);
  buttonLayout->addWidget(cancelButton);

  auto mainLayout = new QVBoxLayout;
  mainLayout->addLayout(gridLayout);
  mainLayout->addLayout(buttonLayout);

  setLayout(mainLayout);

  setWindowTitle(tr("Change alias"));
  setFixedHeight(sizeHint().height());
}
Пример #8
0
    CommandMappingsPrivate(CommandMappings *parent)
        : q(parent)
    {
        groupBox = new QGroupBox(parent);
        groupBox->setTitle(CommandMappings::tr("Command Mappings"));

        filterEdit = new FancyLineEdit(groupBox);
        filterEdit->setFiltering(true);

        commandList = new QTreeWidget(groupBox);
        commandList->setRootIsDecorated(false);
        commandList->setUniformRowHeights(true);
        commandList->setSortingEnabled(true);
        commandList->setColumnCount(3);

        QTreeWidgetItem *item = commandList->headerItem();
        item->setText(2, CommandMappings::tr("Target"));
        item->setText(1, CommandMappings::tr("Label"));
        item->setText(0, CommandMappings::tr("Command"));

        defaultButton = new QPushButton(CommandMappings::tr("Reset All"), groupBox);
        defaultButton->setToolTip(CommandMappings::tr("Reset all to default."));

        importButton = new QPushButton(CommandMappings::tr("Import..."), groupBox);
        exportButton = new QPushButton(CommandMappings::tr("Export..."), groupBox);

        auto hboxLayout1 = new QHBoxLayout();
        hboxLayout1->addWidget(defaultButton);
        hboxLayout1->addStretch();
        hboxLayout1->addWidget(importButton);
        hboxLayout1->addWidget(exportButton);

        auto hboxLayout = new QHBoxLayout();
        hboxLayout->addWidget(filterEdit);

        auto vboxLayout1 = new QVBoxLayout(groupBox);
        vboxLayout1->addLayout(hboxLayout);
        vboxLayout1->addWidget(commandList);
        vboxLayout1->addLayout(hboxLayout1);

        auto vboxLayout = new QVBoxLayout(parent);
        vboxLayout->addWidget(groupBox);

        q->connect(exportButton, &QPushButton::clicked,
                   q, &CommandMappings::exportAction);
        q->connect(importButton, &QPushButton::clicked,
                   q, &CommandMappings::importAction);
        q->connect(defaultButton, &QPushButton::clicked,
                   q, &CommandMappings::defaultAction);

        commandList->sortByColumn(0, Qt::AscendingOrder);

        q->connect(filterEdit, &FancyLineEdit::textChanged,
                   q, &CommandMappings::filterChanged);
        q->connect(commandList, &QTreeWidget::currentItemChanged,
                   q, &CommandMappings::currentCommandChanged);

        new HeaderViewStretcher(commandList->header(), 1);
    }
Пример #9
0
void ResourceDock::setupHTools() {
	auto htools = new QFrame(this);
	auto vlayout = new QVBoxLayout(htools);
	vlayout->setMargin(2);
	vlayout->setSpacing(0);

	auto hlayoutTitle = new QHBoxLayout();
	auto title = new QLabel(htools);
	title->setText("Resource Explorer ");
	title->setStyleSheet("color: lightGray;");
	hlayoutTitle->addWidget(title);

	auto sepBrush = QBrush(Qt::gray, Qt::BrushStyle::Dense6Pattern);
	QPalette sepPalette;
	sepPalette.setBrush(QPalette::Background, sepBrush);

	auto seprator = new QLabel(htools);
	seprator->setAutoFillBackground(true);
	seprator->setPalette(sepPalette);
	seprator->setMaximumHeight(10);
	hlayoutTitle->addWidget(seprator, 1, Qt::AlignBottom);

	auto btnClose = new QToolButton(htools);
	btnClose->setText("X");
	btnClose->setStyleSheet("color: lightGray\n");
	btnClose->setAutoRaise(true);
	btnClose->setMaximumWidth(16);
	btnClose->setMaximumHeight(16);
	hlayoutTitle->addWidget(btnClose);
	connect(btnClose, &QToolButton::clicked, this, &QDockWidget::hide);

	vlayout->addLayout(hlayoutTitle);
	vlayout->addSpacing(2);

	auto hlayoutTools = new QHBoxLayout();
	hlayoutTools->setMargin(0);
	hlayoutTools->setSpacing(0);

	auto btnCollAll = new QToolButton(htools);
	btnCollAll->setIcon(QIcon(":/icons/col"));
	btnCollAll->setToolTip("Collapse All");
	btnCollAll->setToolButtonStyle(Qt::ToolButtonIconOnly);
	connect(btnCollAll, &QToolButton::clicked, resTree, &QTreeWidget::collapseAll);
	hlayoutTools->addWidget(btnCollAll);
	hlayoutTools->addSpacing(5);

	auto ledit = new QLineEdit(htools);
	ledit->setPlaceholderText("Search");
	ledit->addAction(QIcon(":/icons/search"), QLineEdit::ActionPosition::TrailingPosition);
	ledit->setStyleSheet("background-color: gray;");
	connect(ledit, &QLineEdit::textChanged, this, &ResourceDock::searchAct);
	hlayoutTools->addWidget(ledit, 1);
	vlayout->addLayout(hlayoutTools);

	htools->setLayout(vlayout);

	setTitleBarWidget(htools);
}
Пример #10
0
	Dialog2::Dialog2(QWidget *parent=0, QString name=0,Canvas* c=0)
		:MyDialog(parent,name,2)
{
    canvas=c;
    view=canvas->getClusterView();
    index1=0;
    list1=new vector<int>;
    currentAtom1=view->getAtom(0);
    index2=1;
    list2=new vector<int>;
    currentAtom2=view->getAtom(1);

    QLabel *label1,*label2,*label3;
    label1=new QLabel(this,"label1");
    label1->setText(QString("Atom:"));
    label1->setFont(QFont("times",12,QFont::Bold));

    label2=new QLabel(this,"label2");
    label2->setText(QString("To Atom:"));
    label2->setFont(QFont("times",12,QFont::Bold));

    label3=new QLabel(this,"label");
    label3->setText(QString("Bond Length:"));
    label3->setFont(QFont("times",12,QFont::Bold));

    length=new QLineEdit(this);

    atomSelect1=new QComboBox(FALSE,this);
    setupComboBox(atomSelect1,1);
    atomSelect2=new QComboBox(FALSE,this);
    setupComboBox(atomSelect2,2);
    
    QGridLayout* grid1=new QGridLayout(0,1,7);
    grid1->setMargin(10);
//    grid1->setColStretch(5,3);

    QGridLayout* grid2=new QGridLayout(0,1,5);
//    grid2->setColStretch(4,3);
    grid2->setMargin(10);
    grid2->setSpacing(5);

    grid1->addWidget(label1,0,1);
    grid1->addWidget(atomSelect1,0,2);

    grid1->addWidget(label2,0,4);
    grid1->addWidget(atomSelect2,0,5);
    
    grid2->addWidget(label3,0,2);
    grid2->addWidget(length,0,4);

    addLayout(grid1,0,0);
    addLayout(grid2,1,0);
}
void SyncMeasuresDialogCentralWidget::createLayout()
{

  QPushButton * upperPushButton = new QPushButton("Check All");
  connect(upperPushButton, &QPushButton::clicked, this, &SyncMeasuresDialogCentralWidget::upperPushButtonClicked);

  auto upperLayout = new QHBoxLayout();
  upperLayout->addStretch();
  upperLayout->addWidget(upperPushButton);

  m_collapsibleComponentList = new CollapsibleComponentList();

  connect(m_collapsibleComponentList, &CollapsibleComponentList::componentClicked, this, &SyncMeasuresDialogCentralWidget::componentClicked);

  connect(m_collapsibleComponentList, &CollapsibleComponentList::getComponentsByPage, this, &SyncMeasuresDialogCentralWidget::getComponentsByPage);

  connect(m_collapsibleComponentList, &CollapsibleComponentList::getComponentsByPage, this, &SyncMeasuresDialogCentralWidget::on_getComponentsByPage);

  //*******************************************************************

  m_componentList = new ComponentList();

  CollapsibleComponentHeader * collapsibleComponentHeader = nullptr;
  collapsibleComponentHeader = new CollapsibleComponentHeader("Updates",100,5);

  CollapsibleComponent * collapsibleComponent = nullptr;
  collapsibleComponent = new CollapsibleComponent(collapsibleComponentHeader,m_componentList);

  m_collapsibleComponentList->addCollapsibleComponent(collapsibleComponent);

  //*******************************************************************

  progressBar = new QProgressBar(this);
  progressBar->setOrientation(Qt::Horizontal);
  progressBar->setVisible(false);
  progressBar->setTextVisible(false);

  lowerPushButton = new QPushButton("Update");
  connect(lowerPushButton, &QPushButton::clicked, this, &SyncMeasuresDialogCentralWidget::lowerPushButtonClicked);

  auto lowerLayout = new QHBoxLayout();
  lowerLayout->addWidget(progressBar);
  lowerLayout->addStretch();
  lowerLayout->addWidget(lowerPushButton);

  auto mainLayout = new QVBoxLayout();
  mainLayout->addLayout(upperLayout);

  mainLayout->addWidget(m_collapsibleComponentList,0,Qt::AlignTop);
  mainLayout->addLayout(lowerLayout);
  setLayout(mainLayout);
}
Пример #12
0
DatasetPropertyWidget::DatasetPropertyWidget(QWidget *parent) : QDialog(parent) {
    localGroup = new QGroupBox("Local Dataset");

    datasetfileDialog = new QPushButton("Select Dataset Path");
    datasetfileDialog->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    this->path = new QComboBox();
    this->path->setInsertPolicy(QComboBox::NoInsert);
    this->path->setSizeAdjustPolicy(QComboBox::AdjustToContents);
    this->path->setEditable(true);
    supercubeEdgeSpin = new QSpinBox;
    int maxM = TEXTURE_EDGE_LEN / state->cubeEdgeLength;
    if (maxM % 2 == 0) {
        maxM -= 1;//set maxM to the next odd value
    }
    supercubeEdgeSpin->setRange(3, maxM);
    supercubeEdgeSpin->setSingleStep(2);
    supercubeEdgeSpin->setValue(state->M);
    supercubeEdgeSpin->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    supercubeSizeLabel = new QLabel();
    supercubeEdgeSpinValueChanged(state->M);//init label
    cancelButton = new QPushButton("Cancel");
    processButton = new QPushButton("Use");

    auto hLayout = new QHBoxLayout;
    hLayout->addWidget(path);
    hLayout->addWidget(datasetfileDialog);
    auto hLayout2 = new QHBoxLayout;
    hLayout2->addWidget(supercubeEdgeSpin);
    supercubeEdgeSpin->setAlignment(Qt::AlignLeft);
    hLayout2->addWidget(supercubeSizeLabel);
    auto hLayout3 = new QHBoxLayout;
    hLayout3->addWidget(processButton);
    hLayout3->addWidget(cancelButton);

    auto localLayout = new QVBoxLayout();
    localLayout->addLayout(hLayout);
    localLayout->addLayout(hLayout2);
    localLayout->addLayout(hLayout3);
    localGroup->setLayout(localLayout);

    auto mainLayout = new QVBoxLayout();
    mainLayout->addWidget(localGroup);
    setLayout(mainLayout);

    QObject::connect(datasetfileDialog, &QPushButton::clicked, this, &DatasetPropertyWidget::datasetfileDialogClicked);
    QObject::connect(supercubeEdgeSpin, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &DatasetPropertyWidget::supercubeEdgeSpinValueChanged);
    QObject::connect(cancelButton, &QPushButton::clicked, this, &DatasetPropertyWidget::cancelButtonClicked);
    QObject::connect(processButton, &QPushButton::clicked, this, &DatasetPropertyWidget::processButtonClicked);

    this->setWindowFlags(this->windowFlags() & (~Qt::WindowContextHelpButtonHint));
}
Пример #13
0
Window::Window(QWidget *parent) :
    QWidget(parent), _working(false)
{
    _label = new QLabel("Номера страниц через пробелы", this);
    _text = new QLineEdit(this);
    _button = new QPushButton("Начать", this);
    _edit = new QTextEdit(this);
    _from = new QDateEdit(QDate::currentDate(), this);
    _to = new QDateEdit(QDate::currentDate(), this);

    _from->setDisplayFormat("MM.yyyy");
    _to->setDisplayFormat("MM.yyyy");


    auto line = new QHBoxLayout();
    line->addWidget(_label);
    line->addWidget(_text);

    auto grid = new QGridLayout();
    grid->addLayout(line, 0, 0, 1, 4);

    grid->addWidget(new QLabel("Начало", this), 1, 0, 1, 1);
    grid->addWidget(_from, 1, 1, 1, 1);
    grid->addWidget(new QLabel("Конец", this), 1, 2, 1, 1);
    grid->addWidget(_to, 1, 3, 1, 1);

    grid->addWidget(_button, 2, 3, 1, 1);
    grid->addWidget(_edit, 3, 0, 1, 4);

    this->setLayout(grid);

    connect(_button, SIGNAL(clicked()), this, SLOT(startParsing()));
}
Пример #14
0
MessageListEditor::MessageListEditor(
        const iscore::MessageList& m,
        DeviceExplorerModel* model,
        QWidget* parent):
    m_model{model},
    m_messages{m}
{
    auto lay = new QGridLayout;

    m_messageListLayout = new QGridLayout;
    lay->addLayout(m_messageListLayout, 0, 0);
    updateLayout();

    auto addButton = new QPushButton(tr("Add message"));
    lay->addWidget(addButton);
    connect(addButton, &QPushButton::clicked,
            this, &MessageListEditor::addMessage);

    auto buttons = new QDialogButtonBox(QDialogButtonBox::StandardButton::Ok |
                                        QDialogButtonBox::StandardButton::Cancel);
    connect(buttons, &QDialogButtonBox::accepted, this, &QDialog::accept);
    connect(buttons, &QDialogButtonBox::rejected, this, &QDialog::reject);

    lay->addWidget(buttons);

    this->setLayout(lay);
}
Пример #15
0
static void setupVSTControl(
      const VSTControlInlet& inlet,
      QWidget* inlet_widget,
      const score::DocumentContext& ctx,
      Inspector::Layout& vlay,
      QWidget* parent)
{
  // TODO refactor with PortWidgetSetup::setupControl
  auto widg = new QWidget;
  auto advBtn = new QToolButton{widg};
  advBtn->setText("●");

  auto lab = new TextLabel{inlet.customData(), widg};
  auto hl = new score::MarginLess<QHBoxLayout>{widg};
  hl->addWidget(advBtn);
  hl->addWidget(lab);

  auto sw = new QWidget{parent};
  sw->setContentsMargins(0, 0, 0, 0);
  auto hl2 = new score::MarginLess<QHBoxLayout>{sw};
  hl2->addSpacing(30);
  auto lay = new Inspector::Layout{};
  Process::PortWidgetSetup::setupInLayout(inlet, ctx, *lay, sw);
  hl2->addLayout(lay);

  QObject::connect(advBtn, &QToolButton::clicked, sw, [=] {
    sw->setVisible(!sw->isVisible());
  });
  sw->setVisible(false);

  vlay.addRow(widg, inlet_widget);
  vlay.addRow(sw);
}
Пример #16
0
NodeEditorWidget::NodeEditorWidget(QWidget* parent, Qt::WindowFlags f)
    : QWidget(parent, f)
{
    auto v_layout = new QVBoxLayout;
    auto validator = new QDoubleValidator(-1e6, 1e6, 10, this);

    m_header_label = new QLabel("Node:");
    v_layout->addWidget(m_header_label);

    m_form_layout = new QFormLayout;
    m_x_editor = new QLineEdit;
    m_x_editor->setValidator(validator);
    connect(m_x_editor, SIGNAL(returnPressed()), this, SLOT(something_edited()));
    m_form_layout->addRow("X-coordinate:", m_x_editor);
    m_y_editor = new QLineEdit;
    m_y_editor->setValidator(validator);
    connect(m_y_editor, SIGNAL(returnPressed()), this, SLOT(something_edited()));
    m_form_layout->addRow("Y-coordinate:", m_y_editor);
    m_w_editor = new QLineEdit;
    m_w_editor->setValidator(validator);
    connect(m_w_editor, SIGNAL(returnPressed()), this, SLOT(something_edited()));
    m_form_layout->addRow("Weight:",       m_w_editor);

    v_layout->addLayout(m_form_layout);
    setLayout(v_layout);
    
    clear();
}
Пример #17
0
SAQwtPlotCurveItemSetWidget::SAQwtPlotCurveItemSetWidget(QwtPlotCurve *plotItem, QWidget *par)
    :SAQwtPlotItemSetWidget(plotItem,par)
    ,m_showAll(false)
    ,m_symbolSetMenu(nullptr)
    ,m_symbolSetWidget(nullptr)
{
    m_curveItem = plotItem;
    m_isSPlineCheckBox = nullptr;
    //set pen -> setPen
    m_PenStyle = new SAPenSetWidget();
    addWidget(m_PenStyle);
    //
    QHBoxLayout* hlayoutSymbolComboBox = new QHBoxLayout;
    m_labelSymbolSet = new QLabel;
    m_symbolComboBox = new SAQwtSymbolComboBox();
    m_symbolSetButton = new QPushButton;
    m_symbolSetButton->setMinimumWidth(15);
    m_symbolSetButton->setMaximumWidth(15);
    m_symbolSetButton->setText(">");
    hlayoutSymbolComboBox->addWidget(m_labelSymbolSet);
    hlayoutSymbolComboBox->addWidget(m_symbolComboBox);
    hlayoutSymbolComboBox->addWidget(m_symbolSetButton);
    addLayout(hlayoutSymbolComboBox);
    //update value
    upDateData();
    //connect
    connect(m_PenStyle,&SAPenSetWidget::penChanged
            ,this,&SAQwtPlotCurveItemSetWidget::onPenChenged);
    connect(m_symbolComboBox,&SAQwtSymbolComboBox::symbolSelectChanged
            ,this,&SAQwtPlotCurveItemSetWidget::onSymbolComboBoxChanged);
    connect(m_symbolSetButton,&QPushButton::clicked
            ,this,&SAQwtPlotCurveItemSetWidget::onSymbolSetButtonClicked);
    retranslateUi();
}
SayCheesePhotoManager::SelectConnectionTypeScreenView::SelectConnectionTypeScreenView(Bundle *bundle, MainWindow *mainWindow)
    : SayCheeseScreen(bundle, mainWindow)
{
    auto mainLayout = new QVBoxLayout();
    auto buttonsLayout = new QHBoxLayout();

    auto titleLabel = new QLabel(tr("Select Connection Type"), this);
    titleLabel->setObjectName("SelectConnectionTypeTitleLabel");

    this->usbButton = new QThemedImageButton(":/resources/androidusb.png", this);
    this->usbButton->setObjectName("SelectConnectionTypeUsbButton");
    this->usbButton->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    this->usbButton->setFocusPolicy(Qt::NoFocus);

    this->wifiButton = new QThemedImageButton(":/resources/androidwifi.png", this);
    this->wifiButton->setObjectName("SelectConnectionTypeWifiButton");
    this->wifiButton->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
    this->wifiButton->setFocusPolicy(Qt::NoFocus);

    this->backButton = new QThemedImageButton(":resources/back.png", this);
    this->backButton->setObjectName("SelectConnectionTypeBackButton");
    this->backButton->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);

    buttonsLayout->addWidget(this->usbButton);
    buttonsLayout->addWidget(this->wifiButton);

    mainLayout->addWidget(titleLabel);
    mainLayout->addSpacing(25);
    mainLayout->addLayout(buttonsLayout);
    mainLayout->addWidget(this->backButton);

    this->setLayout(mainLayout);
}
Пример #19
0
GetCheatInput::GetCheatInput(QString const &desc, QString const &code, QWidget *parent)
: QDialog(parent)
, descEdit_(new QLineEdit(desc, this))
, codeEdit_(new QLineEdit(code, this))
, okButton_(new QPushButton(tr("OK"), this))
{
	QVBoxLayout *const l = new QVBoxLayout(this);
	l->addWidget(new QLabel(tr("Description:")));
	l->addWidget(descEdit_);
	l->addWidget(new QLabel(tr("GG/GS Code:")));
	l->addWidget(codeEdit_);

	QString const cheatre("((01[0-9a-fA-F]{6,6})|([0-9a-fA-F]{3,3}-[0-9a-fA-F]{3,3}(-[0-9a-fA-F]{3,3})?))");
	codeEdit_->setValidator(new QRegExpValidator(QRegExp(cheatre + "(;" + cheatre + ")*"),
	                                             codeEdit_));
	codeEdit_->setToolTip(tr("Game Genie: hhh-hhh-hhh;...\nGame Shark: 01hhhhhh;..."));
	codeEdit_->setWhatsThis(codeEdit_->toolTip());

	QHBoxLayout *const hl = addLayout(l, new QHBoxLayout,
	                                  Qt::AlignBottom | Qt::AlignRight);
	hl->addWidget(okButton_);
	QPushButton *const cancelButton = addWidget(hl, new QPushButton(tr("Cancel")));
	okButton_->setEnabled(codeEdit_->hasAcceptableInput());
	connect(codeEdit_, SIGNAL(textChanged(QString const &)),
	        this, SLOT(codeTextEdited()));
	connect(okButton_, SIGNAL(clicked()), this, SLOT(accept()));
	connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
Пример #20
0
void KPrPageLayoutDocker::setView( KPrView* view )
{
    Q_ASSERT( view );
    m_view = view;
    connect( m_view->proxyObject, SIGNAL( activePageChanged() ),
             this, SLOT( slotActivePageChanged() ) );

    // remove the layouts from the last view
    m_layoutsView->clear();

    KPrPageLayouts *layouts = view->kopaDocument()->resourceManager()->resource(KPresenter::PageLayouts).value<KPrPageLayouts*>();

    Q_ASSERT( layouts );

    const QList<KPrPageLayout *> layoutMap = layouts->layouts();

    // TODO add empty layout

    foreach( KPrPageLayout * layout, layoutMap ) {
        if ( layout->type() == KPrPageLayout::Page ) {
            addLayout( layout );
        }
    }

    slotActivePageChanged();

    connect( m_layoutsView, SIGNAL( itemPressed( QListWidgetItem * ) ),
             this, SLOT( slotItemPressed( QListWidgetItem * ) ) );
    connect( m_layoutsView, SIGNAL( currentItemChanged( QListWidgetItem *, QListWidgetItem * ) ),
             this, SLOT( slotCurrentItemChanged( QListWidgetItem *, QListWidgetItem * ) ) );
}
Пример #21
0
void KPrPageLayoutDocker::slotActivePageChanged()
{
    Q_ASSERT( m_view );

    KPrPage * page = dynamic_cast<KPrPage*>( m_view->activePage() );
    if ( page ) {
        KPrPageLayout * layout = page->layout();
        QListWidgetItem * item = m_layout2item.value( layout, 0 );
        if ( item == 0 && layout != 0 && layout->type() == KPrPageLayout::Page ) {
            item = addLayout( layout );
        }

        if ( item ) {
            m_layoutsView->blockSignals( true );
            item->setSelected( true );
            m_layoutsView->blockSignals( false );
            m_layoutsView->scrollToItem( item );
        }
        else {
            QList<QListWidgetItem*> items = m_layoutsView->selectedItems();
            foreach ( QListWidgetItem * i, items ) {
                m_layoutsView->blockSignals( true );
                i->setSelected( false );
                m_layoutsView->blockSignals( false );
            }
        }
    }
Пример #22
0
UrlDialog::UrlDialog(QWidget *parent, const QString &key)
: QDialog(parent), d(new Data) {
    d->p = this;

    d->storage.setObject(this, "UrlDialog-"_a % key);
    d->storage.add("open_url_list", &d->urls);
    d->storage.add("open_url_enc", &d->encoding);
    d->storage.restore();

    d->c = new QCompleter(d->urls, this);
    d->url = new QComboBox(this);
    d->url->setEditable(true);
    d->url->addItems(d->urls);
    d->url->setCompleter(d->c);
    d->url->setMaximumWidth(500);
    d->enc = new EncodingComboBox(this);
    d->enc->setEncoding(d->encoding);
    d->bbox = BBox::make(this);
    d->playlist = new QCheckBox(tr("Handle as playlist"), this);
    auto form = new QFormLayout;
    form->addRow(tr("URL"), d->url);
    form->addRow(tr("Encoding"), d->enc);

    auto hbox = new QHBoxLayout;
    hbox->addWidget(d->playlist);
    hbox->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
    hbox->addWidget(d->bbox);

    auto vbox = new QVBoxLayout(this);
    vbox->addLayout(form);
    vbox->addLayout(hbox);

    _SetWindowTitle(this, tr("Open URL"));
    setMaximumWidth(700);
}
Пример #23
0
ClockWidget::ClockWidget()
{
  // Create objects
  m_snooze_button = new QPushButton("Snooze");
  m_snooze_button->setEnabled(false);
	m_snooze_text    = new QLabel;
	auto days_layout = new QHBoxLayout;

  const char* days[] = {"M", "T", "W", "T", "F", "S", "S"};
  for( size_t i = 0; i < number_days; ++i )
  {
		auto day_layout  = new QVBoxLayout;
		auto repeat_day  = new QCheckBox;
		auto label       = new JLabel(days[i]);

		m_widget_days[i] = repeat_day;
		day_layout->addWidget(label, 0, Qt::AlignCenter);
		day_layout->addWidget(repeat_day, 0, Qt::AlignCenter);
		days_layout->addLayout(day_layout);

		connect(label, SIGNAL(clicked()), repeat_day, SLOT(click()));
  }

	m_buttons_layout->addWidget(m_snooze_button);

	m_main_layout->insertLayout(2, days_layout);
  m_main_layout->addWidget(m_snooze_text);

  // Set maximum values
  m_widget_hours_input->setMaximum(24);
  m_widget_mins_input->setMaximum(60);
  m_widget_secs_input->setMaximum(60);

  // Get last used values
	const QString& hour_str = utils::Properties::get( utils::Property::ClockHour );
	const QString& min_str  = utils::Properties::get( utils::Property::ClockMin );
	const QString& sec_str  = utils::Properties::get( utils::Property::ClockSec );

  // Set last used values
  if( !hour_str.isEmpty() )
		m_widget_hours_input->setValue( hour_str.toInt() );
  if( !min_str.isEmpty() )
		m_widget_mins_input->setValue( min_str.toInt() );
  if( !sec_str.isEmpty() )
		m_widget_secs_input->setValue( sec_str.toInt() );
  for( size_t i = 0; i < number_days; ++i )
  {
		if( utils::Properties::get( day_property[i] ).toInt() )
			m_widget_days[i]->setChecked(true);
  }

  m_snooze_timer.setSingleShot(true);

  connect(&m_snooze_timer, SIGNAL(timeout()), this, SLOT(updateSnooze()));
  connect(m_snooze_button, SIGNAL(pressed()), this, SLOT(snooze()));

  // Restart alarm if application has been shutdown while alarm was running
  restart();
}
Пример #24
0
NewMapDialog::NewMapDialog(QWidget* parent) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint)
{
	this->setWhatsThis(Util::makeWhatThis("new_map.html"));
	setWindowTitle(tr("Create new map"));
	
	auto form_layout = new QFormLayout();
	
	form_layout->addRow(new QLabel(tr("Choose the scale and symbol set for the new map.")));
	
	form_layout->addItem(Util::SpacerItem::create(this));
	
	scale_combo = new QComboBox();
	scale_combo->setEditable(true);
	scale_combo->setValidator(new QIntValidator(1, 9999999, scale_combo));
	form_layout->addRow(tr("Scale:  1 : "), scale_combo); /// \todo Fix form layout dependency
	
	auto layout = new QVBoxLayout();
	layout->addLayout(form_layout);
	
	layout->addWidget(new QLabel(tr("Symbol sets:")));
	
	symbol_set_list = new QListWidget();
	layout->addWidget(symbol_set_list, 1);
	
	symbol_set_matching = new QCheckBox(tr("Only show symbol sets matching the selected scale"));
	layout->addWidget(symbol_set_matching);
	
	layout->addItem(Util::SpacerItem::create(this));
	
	auto button_box = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
	create_button = button_box->button(QDialogButtonBox::Ok);
	create_button->setIcon(QIcon(QString::fromLatin1(":/images/arrow-right.png")));
	create_button->setText(tr("Create"));
	layout->addWidget(button_box);
	
	setLayout(layout);
	
	loadSymbolSetMap();
	for (auto& item : symbol_set_map)
	{
		if (item.first.toInt() != 0)
			scale_combo->addItem(item.first);
	}
	
	QSettings settings;
	settings.beginGroup(QString::fromLatin1("NewMapDialog"));
	const auto default_scale = settings.value(QString::fromLatin1("DefaultScale"), QVariant(10000)).toString();
	const auto matching = settings.value(QString::fromLatin1("OnlyMatchingSymbolSets"), QVariant(true)).toBool();
	settings.endGroup();
	
	scale_combo->setEditText(default_scale);
	symbol_set_matching->setChecked(matching);
	connect(scale_combo, &QComboBox::editTextChanged, this, &NewMapDialog::updateSymbolSetList);
	connect(symbol_set_list, &QListWidget::itemDoubleClicked, this, &NewMapDialog::symbolSetDoubleClicked);
	connect(symbol_set_matching, &QCheckBox::stateChanged, this, &NewMapDialog::updateSymbolSetList);
	connect(button_box, &QDialogButtonBox::rejected, this, &QDialog::reject);
	connect(button_box, &QDialogButtonBox::accepted, this, &NewMapDialog::createClicked);
	updateSymbolSetList();
}
Пример #25
0
// VideoControls
	VideoControls::VideoControls(QWidget* parent)
	 : QVBoxLayout(parent), timeLabel("--:--"), frameRateLabel("Frame rate : "), playButton("Play"), stopButton("Stop"), loadVideoButton("Load video..."), optionsButton("Options"), infoLine("(No video)"), timeSlider(Qt::Horizontal), nextFrameButton(">"),
	   minFilter(GL_NEAREST), magFilter(GL_NEAREST), sWrapping(GL_CLAMP), tWrapping(GL_CLAMP), maxMipmapLevel(0), numFrameBuffered(1), playing(false), stream(NULL)
	{
		frameRateLabel.setAlignment(Qt::AlignRight);
		frameRateLabel.setFixedSize(90, 20);
		nextFrameButton.setFixedSize(20, 20);
		timeLabel.setAlignment(Qt::AlignCenter);
		timeLabel.setFixedSize(80, 20);
		frameRateSpinBox.setRange(1, 1000);
		infoLine.setReadOnly(true);
		timeSlider.setRange(0,0);

		layout1.addWidget(&timeLabel);
		layout1.addWidget(&timeSlider);
		layout1.addWidget(&nextFrameButton);

		layout2.addWidget(&playButton);
		layout2.addWidget(&stopButton);
		layout2.addWidget(&infoLine);

		layout3.addWidget(&loadVideoButton);
		layout3.addWidget(&optionsButton);
		layout3.addWidget(&frameRateLabel);
		layout3.addWidget(&frameRateSpinBox);

		addLayout(&layout1);
		addLayout(&layout2);
		addLayout(&layout3);

		updateLoadToolTip();
		updateInfoTool();

		timer.setInterval(1000);

		QObject::connect(&loadVideoButton,	SIGNAL(released(void)), 	this, SLOT(loadVideoFile(void)));
		QObject::connect(&optionsButton,	SIGNAL(released(void)), 	this, SLOT(changeOptions(void)));
		QObject::connect(&playButton,		SIGNAL(released(void)),		this, SLOT(togglePlayPause(void)));
		QObject::connect(&stopButton,		SIGNAL(released(void)),		this, SLOT(stop(void)));
		QObject::connect(&timer, 		SIGNAL(timeout(void)),		this, SLOT(timerTick(void)));
		QObject::connect(&timeSlider,		SIGNAL(sliderMoved(int)),	this, SLOT(seek(void)));
		QObject::connect(&frameRateSpinBox,	SIGNAL(valueChanged(int)),	this, SLOT(changeFrameRate(void)));
		QObject::connect(&nextFrameButton,	SIGNAL(released(void)),		this, SLOT(oneFrameForward(void)));

		frameRateSpinBox.setValue(30);
	}
Пример #26
0
OverwriteDialog::OverwriteDialog()
	: Dialog(TApp::instance()->getMainWindow(), true)
{
	setModal(true);
	setWindowTitle(tr("Warning!"));

	QButtonGroup *buttonGroup = new QButtonGroup(this);
	buttonGroup->setExclusive(true);
	bool ret = connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(onButtonClicked(int)));

	beginVLayout();

	m_label = new QLabel(this);
	addWidget(m_label);

	m_keep = new QRadioButton(tr("Keep existing file"), this);
	buttonGroup->addButton(m_keep);
	addWidget(m_keep);

	m_overwrite = new QRadioButton(tr("Overwrite the existing file with the new one"), this);
	buttonGroup->addButton(m_overwrite);
	addWidget(m_overwrite);

	m_rename = new QRadioButton(tr("Rename the new file adding the suffix"), this);
	buttonGroup->addButton(m_rename);

	m_suffix = new LineEdit("_1", this);
	m_suffix->setFixedWidth(25);
	m_suffix->setEnabled(false);

	QHBoxLayout *boxLayout = new QHBoxLayout();
	boxLayout->setMargin(0);
	boxLayout->setSpacing(0);
	boxLayout->addWidget(m_rename);
	boxLayout->addWidget(m_suffix);
	boxLayout->setAlignment(m_rename, Qt::AlignLeft);
	boxLayout->setAlignment(m_suffix, Qt::AlignLeft);
	addLayout(boxLayout);

	endVLayout();

	m_okBtn = new QPushButton(QString(tr("Apply")), this);
	ret = ret && connect(m_okBtn, SIGNAL(clicked()), this, SLOT(accept()));
	addButtonBarWidget(m_okBtn);

	m_okToAllBtn = new QPushButton(QString(tr("Apply to All")), this);
	ret = ret && connect(m_okToAllBtn, SIGNAL(clicked()), this, SLOT(applyToAll()));
	addButtonBarWidget(m_okToAllBtn);

	m_cancelBtn = new QPushButton(QString(tr("Cancel")), this);
	ret = ret && connect(m_cancelBtn, SIGNAL(clicked()), this, SLOT(cancel()));
	addButtonBarWidget(m_cancelBtn);

	assert(ret);

	reset();
	m_keep->setChecked(true);
}
Пример #27
0
	QWidget* createWidgets(BasePropertyWidget* parent)
	{
		m_parent = parent;
		m_property = parent->property();
		m_propertyValue = m_property->value<value_type>();
		if (!m_propertyValue)
			return nullptr;
		m_value = m_propertyValue->value();

		// Get widget creator
		std::string widget;
		auto meta = m_propertyValue->metaContainer().get<meta::Widget>();
		if (meta)
			widget = meta->type();

		auto id = std::type_index(typeid(base_type));
		m_widgetCreator = PropertyWidgetFactory::instance().creator(id, widget);

		auto container = new QWidget(parent);
		auto layout = new QVBoxLayout(container);
		layout->setContentsMargins(0, 0, 0, 0);

		auto topLayout = new QHBoxLayout;
		m_toggleButton = new QPushButton(QPushButton::tr("show"));
		m_toggleButton->setCheckable(true);
		QObject::connect(m_toggleButton, &QPushButton::toggled, [this](bool toggled){ toggleView(toggled); });
		topLayout->addWidget(m_toggleButton);

		if (!list_traits::fixed(m_value))
		{
			m_spinBox = new QSpinBox;
			m_spinBox->setMaximum(INT_MAX);
			m_spinBox->setValue(list_traits::size(m_value));
			topLayout->addWidget(m_spinBox, 1);

			auto resizeButton = new QPushButton(QPushButton::tr("resize"));
			QObject::connect(resizeButton, &QPushButton::clicked, [this]() { 
				for (auto w : m_propertyWidgets) 
					w->updatePropertyValue(); 
				resize(m_spinBox->value()); 
			});
			QObject::connect(resizeButton, &QPushButton::clicked, parent, &BasePropertyWidget::setWidgetDirty);
			topLayout->addWidget(resizeButton);
		}
		else
			topLayout->addStretch();
		
		m_scrollArea = new QScrollArea();

		layout->addLayout(topLayout);
		layout->addWidget(m_scrollArea, 1);

		m_scrollArea->hide();
		m_scrollArea->setWidgetResizable(true);

		return container;
	}
Пример #28
0
//#################################################################################################
//###################         TsupportStandalone       ############################################
//#################################################################################################
TsupportStandalone::TsupportStandalone(QWidget* parent) :
  QDialog(parent)
{
#if defined (Q_OS_ANDROID)
  showMaximized();
#else
  setWindowTitle("Support Nootka");
  auto leftLab = new QLabel(this);
  leftLab->setPixmap(QPixmap(Tpath::img("wizard-left")));
#endif
  QString dontWorry = QApplication::translate("TsupportNootka",
            "Don't worry. This window appears only once per Nootka release.<br>You can find it always in 'About Nootka' dialog");
  auto supportArea = new TsupportNootka(this);
  supportArea->setFrameShape(QFrame::QFrame::StyledPanel);
//   auto neverLab = new TroundedLabel(dontWorry, this);
//     neverLab->setAlignment(Qt::AlignCenter);
//     neverLab->setBackroundColor(palette().base().color());
//     neverLab->setStyleSheet("color: palette(highlightedText)");
//     neverLab->setContentsMargins(5, 5, 5, 5);
  auto thanksButton = new QPushButton(QIcon(Tpath::img("support")), QLatin1String("  Thanks!"), this);
#if defined (Q_OS_ANDROID)
    thanksButton->setIconSize(QSize(Tmtr::fingerPixels(), Tmtr::fingerPixels()));
#else
    thanksButton->setIconSize(QSize(64, 64));
#endif
// Layout
  auto lay = new QHBoxLayout;
#if defined (Q_OS_ANDROID)
    lay->setContentsMargins(0, 0, 0, 0);
#else
    lay->addWidget(leftLab);
    lay->setSizeConstraint(QLayout::SetFixedSize);
#endif
  auto supportLay = new QVBoxLayout();
    supportLay->addWidget(supportArea);
    auto bottomLay = new QHBoxLayout;
//       bottomLay->addWidget(neverLab);
      bottomLay->addWidget(thanksButton, 0, Qt::AlignCenter);
    supportLay->addLayout(bottomLay);
  lay->addLayout(supportLay);
  setLayout(lay);

  connect(thanksButton, SIGNAL(clicked(bool)), this, SLOT(accept()));
}
Пример #29
0
                        OVerLayout :: OVerLayout (Qt::AlignmentFlag hor_align, int spacing_w )
                     : QVBoxLayout (),
  top(NULL),
  bottom(NULL)
{

  setSpacing(spacing_w);
  setMargin(0);
    
  top  = new QVBoxLayout();
  top->setAlignment(hor_align | Qt::AlignTop);
  addLayout(top);
  
  bottom = new QVBoxLayout();
  bottom->setAlignment(hor_align | Qt::AlignBottom);
  addLayout(bottom);


}
Пример #30
0
SelectCRSDialog::SelectCRSDialog(
        const Georeferencing& georef,
        QWidget* parent,
        GeorefAlternatives alternatives,
        const QString& description )
 : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint)
 , georef(georef)
{
	setWindowModality(Qt::WindowModal);
	setWindowTitle(tr("Select coordinate reference system"));
	
	crs_selector = new CRSSelector(georef, nullptr);
	if (georef.isLocal())
		crs_selector->clear();
	
	if (alternatives.testFlag(TakeFromMap) && !georef.isLocal())
	{
		crs_selector->addCustomItem(tr("Same as map"), SpecialCRS::SameAsMap);
		crs_selector->setCurrentIndex(0); // TakeFromMap
	}
	
	if (alternatives.testFlag(Local) || georef.isLocal())
	{
		crs_selector->addCustomItem(tr("Local"), SpecialCRS::Local);
		crs_selector->setCurrentIndex(0); // TakeFromMap or Local, both is fine.
	}
	
	if (alternatives.testFlag(Geographic) && !georef.isLocal())
		crs_selector->addCustomItem(tr("Geographic coordinates (WGS84)"), SpecialCRS::Geographic);
	
	status_label = new QLabel();
	button_box = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
	
	auto form_layout = new QFormLayout();
	if (!description.isEmpty())
	{
		form_layout->addRow(new QLabel(description));
		form_layout->addItem(Util::SpacerItem::create(this));
	}
	form_layout->addRow(QCoreApplication::translate("GeoreferencingDialog", "&Coordinate reference system:"), crs_selector);
	form_layout->addRow(tr("Status:"), status_label);
	form_layout->addItem(Util::SpacerItem::create(this));
	crs_selector->setDialogLayout(form_layout);
	
	auto layout = new QVBoxLayout();
	layout->addLayout(form_layout, 1);
	layout->addWidget(button_box, 0);
	setLayout(layout);
	
	connect(crs_selector, &CRSSelector::crsChanged, this, &SelectCRSDialog::updateWidgets);
	connect(button_box, &QDialogButtonBox::accepted, this, &SelectCRSDialog::accept);
	connect(button_box, &QDialogButtonBox::rejected, this, &SelectCRSDialog::reject);
	
	updateWidgets();
}