Пример #1
0
void tst_QFormLayout::spacing()
{
    //TODO: confirm spacing behavior
    QWidget *w = new QWidget;
    CustomLayoutStyle *style = new CustomLayoutStyle;
    style->hspacing = 5;
    style->vspacing = 10;
    w->setStyle(style);
    QFormLayout *fl = new QFormLayout(w);
    QCOMPARE(style->hspacing, fl->horizontalSpacing());
    QCOMPARE(style->vspacing, fl->verticalSpacing());

    //QCOMPARE(fl->spacing(), -1);
    fl->setVerticalSpacing(5);
    QCOMPARE(5, fl->horizontalSpacing());
    QCOMPARE(5, fl->verticalSpacing());
    //QCOMPARE(fl->spacing(), 5);
    fl->setVerticalSpacing(-1);
    QCOMPARE(style->hspacing, fl->horizontalSpacing());
    QCOMPARE(style->vspacing, fl->verticalSpacing());

    style->hspacing = 5;
    style->vspacing = 5;
    //QCOMPARE(fl->spacing(), 5);

    fl->setHorizontalSpacing(20);
    //QCOMPARE(fl->spacing(), -1);
    style->vspacing = 20;
    QCOMPARE(fl->horizontalSpacing(), 20);
    QCOMPARE(fl->verticalSpacing(), 20);
    //QCOMPARE(fl->spacing(), 20);
    fl->setHorizontalSpacing(-1);
    //QCOMPARE(fl->spacing(), -1);
    style->hspacing = 20;
    //QCOMPARE(fl->spacing(), 20);



    // Do not assert if spacings are negative (QTBUG-34731)
    style->vspacing = -1;
    style->hspacing = -1;
    QLabel *label = new QLabel(tr("Asserts"));
    QCheckBox *checkBox = new QCheckBox(tr("Yes"));
    fl->setWidget(0, QFormLayout::LabelRole, label);
    fl->setWidget(1, QFormLayout::FieldRole, checkBox);
    w->resize(200, 100);
    w->show();
    QVERIFY(QTest::qWaitForWindowExposed(w));

    delete w;
    delete style;
}
MyMaterialEditor::MyMaterialEditor(QWidget *parent) :
    QWidget(parent)
{
    // the signal mapper will map the colour buttons to a slot to select colour
    QSignalMapper *mapper = new QSignalMapper(this);
    connect(mapper, SIGNAL(mapped(int)), this, SLOT(selectColor(int)));

    for (int i = 0; i < 4; ++i) {
        QPushButton *button = new QPushButton();
        button->setFlat(true);
        button->setMaximumWidth(64);
        connect(button, SIGNAL(clicked()), mapper, SLOT(map()));
        mapper->setMapping(button, i);
        m_colorButtons[i] = button;
    }

    m_shininessSpinner = new QDoubleSpinBox();
    m_shininessSpinner->setRange(0, 128);
    m_shininessSpinner->setMaximumWidth(64);
    connect(m_shininessSpinner, SIGNAL(valueChanged(double)),
            this, SLOT(setShininess(double)));

    // create a form layout to contain all the color editing buttons
    QFormLayout *layout = new QFormLayout(this);    
    layout->setVerticalSpacing(2);
    QLabel *title = new QLabel("Material Properties");
    title->setAlignment(Qt::AlignCenter);
    layout->addRow(title);
    layout->addRow("Ambient:", m_colorButtons[0]);
    layout->addRow("Diffuse:", m_colorButtons[1]);
    layout->addRow("Emission:", m_colorButtons[3]);
    layout->addRow("Specular:", m_colorButtons[2]);
    layout->addRow("Shininess:", m_shininessSpinner);
}
Пример #3
0
dmz::V8Value
dmz::JsModuleUiV8QtBasic::_form_layout_vertical_spacing (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QFormLayout *form = self->v8_to_qobject<QFormLayout> (Args.This ());
      if (form) {

         if (Args.Length () == 0) {

            result = v8::Number::New (form->verticalSpacing ());
         }
         else if (Args.Length () == 1) {

            form->setVerticalSpacing (v8_to_int32 (Args[0]));
         }
      }
   }

   return scope.Close (result);
}
Пример #4
0
DictEditorWidget::DictEditorWidget(QWidget *parent)
    : QWidget(parent)
{

    mView = new QTableView;
    mModel = new DictEditorModel;
    mKeyEdit = new QComboBox;
    mValueEdit = new QLineEdit;
    mAddButton = new QToolButton;
    mRemButton = new QToolButton;
    mTypeLabel = new QLabel("type");
    mValueLabel = new QLabel("value");

    mAddButton->setIcon(QtAwesome::instance()->icon("plus"));
    mRemButton->setIcon(QtAwesome::instance()->icon("minus"));



    mView->setModel(mModel);
    mView->verticalHeader()->hide();
    mView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    mView->setSelectionBehavior(QAbstractItemView::SelectRows);




    QFormLayout * formLayout = new QFormLayout;
    formLayout->addRow(mTypeLabel,mKeyEdit);
    formLayout->addRow(mValueLabel,mValueEdit);
    formLayout->setVerticalSpacing(5);
    formLayout->setFormAlignment(Qt::AlignCenter);

    QVBoxLayout * vLayout = new QVBoxLayout;

    vLayout->addItem(formLayout);
    vLayout->addWidget(mView);


    QHBoxLayout * buttonLayout = new QHBoxLayout;
    buttonLayout->addWidget(mAddButton);
    buttonLayout->addWidget(mRemButton);
    buttonLayout->addStretch();

    vLayout->addLayout(buttonLayout);

    setLayout(vLayout);

    mKeyEdit->setEditable(true);


    connect(mAddButton,SIGNAL(clicked()),this,SLOT(addClicked()));
    connect(mRemButton,SIGNAL(clicked()),this,SLOT(removeClicked()));

}
Пример #5
0
QWidget* AutoImportWindow::setupInputFolderContainer() {
    GroupContainer* container = new GroupContainer();
    container->setTitle("Import Folder");

    QFormLayout* layout = new QFormLayout;
    layout->setHorizontalSpacing(10);
    layout->setVerticalSpacing(0);
    layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
    layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    layout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    layout->setLabelAlignment(Qt::AlignLeft);

    BrowserWidget* filesDirBrowser_ = new BrowserWidget(BrowserWidget::BrowseType::DIRECTORY);
    ParametersConfiguration* conf  = projectData.projectParameterData();
    QString importImagesPath = conf->getValue("import_dir");
    filesDirBrowser_->setPath(importImagesPath);
    setupWatcherPaths();
    connect(filesDirBrowser_, &BrowserWidget::pathChanged, [ = ] (const QString & value){
        conf->set("import_dir", value);
        setupWatcherPaths();
        analyzeImport();
    });
    layout->addRow(filesDirBrowser_);

    QLabel* introLabel = new QLabel(introText());
    introLabel->setWordWrap(true);
    QPalette pal = introLabel->palette();
    pal.setColor(QPalette::WindowText, Qt::darkGray);
    introLabel->setPalette(pal);
    layout->addRow(introLabel);

    QCheckBox* restartCheck = new QCheckBox("Import new images in the import folder on start");
    restartCheck->setChecked(ProjectPreferences().importRestartCheck());
    connect(restartCheck, &QCheckBox::toggled, [ = ] (bool check){
        ProjectPreferences().setImportRestartCheck(check);
    });
    layout->addRow(restartCheck);

    
    layout->addRow(continuous);
    
    deleteCheck = new QCheckBox("DELETE the original images in import folder after importing them");
    deleteCheck->setChecked(ProjectPreferences().importDeleteCheck());
    deleteLabel_->setVisible(deleteCheck->isChecked());
    connect(deleteCheck, &QCheckBox::toggled, [ = ] (bool check){
        ProjectPreferences().setImportDeleteCheck(check);
        deleteLabel_->setVisible(check);
    });
    layout->addRow(deleteCheck);
    
    container->setContainerLayout(layout);

    return container;
}
void QmitkMultiLabelSegmentationPreferencePage::CreateQtControl(QWidget* parent)
{
  m_Initializing = true;
  berry::IPreferencesService* prefService
    = berry::Platform::GetPreferencesService();

  m_SegmentationPreferencesNode = prefService->GetSystemPreferences()->Node("/org.mitk.views.multilabelsegmentation");

  m_MainControl = new QWidget(parent);

  QVBoxLayout* displayOptionsLayout = new QVBoxLayout;
  m_RadioOutline = new QRadioButton( "Draw as outline", m_MainControl);
  displayOptionsLayout->addWidget( m_RadioOutline );
  m_RadioOverlay = new QRadioButton( "Draw as transparent overlay", m_MainControl);
  displayOptionsLayout->addWidget( m_RadioOverlay );

  QFormLayout *formLayout = new QFormLayout;
  formLayout->setHorizontalSpacing(8);
  formLayout->setVerticalSpacing(24);
  formLayout->addRow( "2D display", displayOptionsLayout );

  m_VolumeRenderingCheckBox = new QCheckBox( "Show as volume rendering", m_MainControl );
  formLayout->addRow( "3D display", m_VolumeRenderingCheckBox );
  connect( m_VolumeRenderingCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnVolumeRenderingCheckboxChecked(int)) );

  QFormLayout* surfaceLayout = new QFormLayout;
  surfaceLayout->setSpacing(8);

  m_SmoothingSpinBox = new QDoubleSpinBox(m_MainControl);
  m_SmoothingSpinBox->setMinimum(0.0);
  m_SmoothingSpinBox->setSingleStep(0.5);
  m_SmoothingSpinBox->setValue(0.1);
  m_SmoothingSpinBox->setToolTip("The Smoothing value is used as Sigma for a gaussian blur.");
  surfaceLayout->addRow("Smoothing value (mm)", m_SmoothingSpinBox);

  m_DecimationSpinBox = new QDoubleSpinBox(m_MainControl);
  m_DecimationSpinBox->setMinimum(0.0);
  m_DecimationSpinBox->setMaximum(0.99);
  m_DecimationSpinBox->setSingleStep(0.1);
  m_DecimationSpinBox->setValue(0.5);
  m_DecimationSpinBox->setToolTip("Valid range is [0, 1). High values increase decimation, especially when very close to 1. A value of 0 disables decimation.");
  surfaceLayout->addRow("Decimation rate", m_DecimationSpinBox);

  m_SelectionModeCheckBox = new QCheckBox("Enable auto-selection mode", m_MainControl);
  m_SelectionModeCheckBox->setToolTip("If checked the segmentation plugin ensures that only one segmentation and the according greyvalue image are visible at one time.");
  formLayout->addRow("Data node selection mode",m_SelectionModeCheckBox);

  formLayout->addRow("Smoothed surface creation", surfaceLayout);

  m_MainControl->setLayout(formLayout);
  this->Update();
  m_Initializing = false;
}
Пример #7
0
void tst_QFormLayout::spacing()
{
    //TODO: confirm spacing behavior
    QWidget *w = new QWidget;
    CustomLayoutStyle *style = new CustomLayoutStyle;
    style->hspacing = 5;
    style->vspacing = 10;
    w->setStyle(style);
    QFormLayout *fl = new QFormLayout(w);
    QCOMPARE(style->hspacing, fl->horizontalSpacing());
    QCOMPARE(style->vspacing, fl->verticalSpacing());

    //QCOMPARE(fl->spacing(), -1);
    fl->setVerticalSpacing(5);
    QCOMPARE(5, fl->horizontalSpacing());
    QCOMPARE(5, fl->verticalSpacing());
    //QCOMPARE(fl->spacing(), 5);
    fl->setVerticalSpacing(-1);
    QCOMPARE(style->hspacing, fl->horizontalSpacing());
    QCOMPARE(style->vspacing, fl->verticalSpacing());

    style->hspacing = 5;
    style->vspacing = 5;
    //QCOMPARE(fl->spacing(), 5);


    fl->setHorizontalSpacing(20);
    //QCOMPARE(fl->spacing(), -1);
    style->vspacing = 20;
    QCOMPARE(fl->horizontalSpacing(), 20);
    QCOMPARE(fl->verticalSpacing(), 20);
    //QCOMPARE(fl->spacing(), 20);
    fl->setHorizontalSpacing(-1);
    //QCOMPARE(fl->spacing(), -1);
    style->hspacing = 20;
    //QCOMPARE(fl->spacing(), 20);

    delete w;
    delete style;
}
void AddFacilityForm::_setupLayout()
{
    _xAxisBox           = new QLineEdit();
    _yAxisBox           = new QLineEdit();
    _facilityNameBox    = new QLineEdit();
    _areas		= new QComboBox();

    _errorMessage	= new QLabel();
    _errorMessage->setStyleSheet("QLabel { color : red; }");

    _submitButton       = new QPushButton("Submit");
    _cancelButton       = new QPushButton("Cancel");

    _submitButton->setFixedWidth(125);
    _cancelButton->setFixedWidth(125);

    QStringList areas;
    for (int i = 0; i < Convenience::NUM_AREAS; ++i)
    {
	areas << Convenience::areaIDtoQString(i);
    }
    _areas->addItems(areas);

    connect(_submitButton, SIGNAL(clicked()), SLOT(_submitClicked()));
    connect(_cancelButton, SIGNAL(clicked()), SLOT(_cancelClicked()));

    QFormLayout* q = new QFormLayout();
    q->setContentsMargins(15, 10, 15, 10);
    q->setVerticalSpacing(15);
    q->addRow("Name", _facilityNameBox);
    q->addRow("Area", _areas);
    q->addRow("X-Axis", _xAxisBox);
    q->addRow("Y-Axis", _yAxisBox);
    q->addRow(_errorMessage);
    q->addRow("", _submitButton);
    q->addRow("", _cancelButton);
    setLayout(q);
}
PropertyMultiValueWidget::PropertyMultiValueWidget(PartProperty* prop, QWidget* parent, QObject* keyEventFilter)
		: QWidget(parent), cat(prop->getPartCategory()), prop(prop), state(Enabled), flags(0)
{
	PartProperty::Type type = prop->getType();
	flags_t flags = prop->getFlags();


	QVBoxLayout* topLayout = new QVBoxLayout(this);
	setLayout(topLayout);

	QSplitter* splitter = new QSplitter(Qt::Horizontal, this);
	topLayout->addWidget(splitter);

	QWidget* listContWidget = new QWidget(splitter);
	splitter->addWidget(listContWidget);

	QVBoxLayout* listContLayout = new QVBoxLayout(listContWidget);
	listContWidget->setLayout(listContLayout);

	listWidget = new QListWidget(listContWidget);
	listWidget->installEventFilter(keyEventFilter);
	connect(listWidget, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
			this, SLOT(currentItemChanged(QListWidgetItem*, QListWidgetItem*)));
	listContLayout->addWidget(listWidget);


	QWidget* buttonWidget = new QWidget(listContWidget);
	listContLayout->addWidget(buttonWidget);

	QHBoxLayout* buttonLayout = new QHBoxLayout(buttonWidget);
	buttonWidget->setLayout(buttonLayout);

	buttonLayout->addStretch(1);

	listAddButton = new QPushButton("", buttonWidget);
	listAddButton->setIcon(QIcon::fromTheme("list-add", QIcon(":/icons/list-add.png")));
	connect(listAddButton, SIGNAL(clicked()), this, SLOT(addRequested()));
	buttonLayout->addWidget(listAddButton);

	listRemoveButton = new QPushButton("", buttonWidget);
	listRemoveButton->setIcon(QIcon::fromTheme("list-remove", QIcon(":/icons/list-remove.png")));
	connect(listRemoveButton, SIGNAL(clicked()), this, SLOT(removeRequested()));
	buttonLayout->addWidget(listRemoveButton);

	buttonLayout->addStretch(1);


	QWidget* detailWidget = new QWidget(splitter);
	splitter->addWidget(detailWidget);

	QVBoxLayout* detailLayout = new QVBoxLayout(detailWidget);
	detailWidget->setLayout(detailLayout);

	QWidget* detailFormWidget = new QWidget(detailWidget);
	detailLayout->addWidget(detailFormWidget);

	QFormLayout* detailFormLayout = new QFormLayout(detailFormWidget);
	detailFormLayout->setSizeConstraint(QFormLayout::SetMinimumSize);
	detailFormLayout->setHorizontalSpacing(20);
	detailFormLayout->setVerticalSpacing(10);
	detailFormWidget->setLayout(detailFormLayout);

	if (type != PartProperty::PartLink) {
		if (type == PartProperty::Boolean) {
			boolBox = new QCheckBox(prop->getUserReadableName(), detailFormWidget);
			boolBox->installEventFilter(keyEventFilter);
			connect(boolBox, SIGNAL(toggled(bool)), this, SLOT(boolFieldToggled(bool)));
			detailFormLayout->addRow(boolBox);
		} else if (type == PartProperty::File) {
Пример #10
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowIcon(QIcon(":/new/prefix1/images/VirtualPool.png"));
    testLabel = new QLabel();
    testLabel2 = new QLabel();
    testLabel3 = new QLabel();
    button_new = createToolButton(QIcon(":/new/prefix1/images/new.png"), tr("新建"));
    button_start = createToolButton(QIcon(":/new/prefix1/images/right.png"), tr("启动"));
    button_delete = createToolButton(QIcon(":/new/prefix1/images/delete.png"), tr("删除"));
    button_login = createToolButton(QIcon(":/new/prefix1/images/login.png"), tr("远程登录"));
    button_test = createToolButton(QIcon(":/new/prefix1/images/network.png"), tr("网络体检"));

    QGroupBox *vmInfo = new QGroupBox(tr("配置信息"));
    QGroupBox *vmList = new QGroupBox(tr("虚拟机池"));
    processBar = new CRoundProcessBar(this);

    nameEdit = new QLineEdit();
    ostypeEdit = new QLineEdit();
    cpuEdit = new QLineEdit();
    memoryEdit = new QLineEdit();
    vramEdit = new QLineEdit();
    bootEdit = new QLineEdit();
    diskTypeEdit = new QLineEdit();
    diskSpaceEdit = new QLineEdit();
    networkEdit = new QLineEdit();
    ipEdit = new QLineEdit();
    netmaskEdit = new QLineEdit();
    testEdit = new QLineEdit();

    memorySpinBox = new QSpinBox();
    memorySlider = new QSlider(Qt::Horizontal);
    memorySlider->setTickPosition(QSlider::TicksBelow);
    memorySlider->setTickInterval(100);

    /* 以下为layout部分 */

    QHBoxLayout *headLayout = new QHBoxLayout;
    QVBoxLayout *resultLayout = new QVBoxLayout;

    headLayout->addWidget(button_new);
    headLayout->addWidget(button_start);
    headLayout->addWidget(button_delete);
    headLayout->addWidget(button_login);
    headLayout->addWidget(button_test);
    headLayout->addWidget(processBar);
    headLayout->addLayout(resultLayout);

    resultLayout->addWidget(testLabel);
    resultLayout->addWidget(testLabel2);
    resultLayout->addWidget(testLabel3);
    resultLayout->setSpacing(0);

    headLayout->setAlignment(Qt::AlignLeft);

    QHBoxLayout* memoryLayout = new QHBoxLayout;
    QLabel* memoryLabel = new QLabel(tr("内存"));
    memoryLabel->setMinimumWidth(78);
    memoryLayout->addWidget(memoryLabel);
    memoryLayout->addWidget(memorySpinBox);
    memoryLayout->addWidget(memorySlider);

    QFormLayout *infoLayout = new QFormLayout;
    vmInfo->setLayout(infoLayout);
    infoLayout->addRow(tr("名称"), nameEdit);
    infoLayout->addRow(tr("操作系统"), ostypeEdit);
    infoLayout->addRow(tr("CPU核数"), cpuEdit);
    infoLayout->addRow(memoryLayout);
    infoLayout->addRow(tr("虚拟磁盘格式"), diskTypeEdit);
    infoLayout->addRow(tr("磁盘剩余容量"), diskSpaceEdit);
    infoLayout->addRow(tr("网络连接方式"), networkEdit);
    infoLayout->addRow(tr("IP地址"), ipEdit);
    infoLayout->addRow(tr("子网掩码"), netmaskEdit);
    infoLayout->addRow(tr("显存"), vramEdit);
    infoLayout->addRow(tr("启动顺序"), bootEdit);
    processBar->setScanValue("0");


    infoLayout->setVerticalSpacing(15);

    QVBoxLayout *vms = new QVBoxLayout;
    vms->addWidget(listWidget);
    vmList->setLayout(vms);
    vmList->setMaximumWidth(200);
    QHBoxLayout *bodyLayout = new QHBoxLayout;
    bodyLayout->addWidget(vmList);
    bodyLayout->addWidget(vmInfo);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addLayout(headLayout);
    mainLayout->addLayout(bodyLayout);

    QWidget *mainWidget = new QWidget;
    mainWidget->setLayout(mainLayout);
    setCentralWidget(mainWidget);

//    if(listWidget->count() > 0)
//        on_item_clicked(listWidget->item(0));
    /* UI部分 */
    this->setStyleSheet("QLineEdit{background: rgb(240,240,240);selection-background-color: darkgrey; padding:0px; margin:0px;}");
}
Пример #11
0
AttachCoreDialog::AttachCoreDialog(QWidget *parent)
    : QDialog(parent), d(new AttachCoreDialogPrivate)
{
    setWindowTitle(tr("Load Core File"));
    setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);

    d->kitChooser = new DebuggerKitChooser(DebuggerKitChooser::RemoteDebugging, this);
    d->kitChooser->populate();

    d->selectRemoteCoreButton = new QPushButton(tr("Browse..."), this);
    d->remoteCoreFileName = new QLineEdit(this);

    d->forceLocalCheckBox = new QCheckBox(this);
    d->forceLocalLabel = new QLabel(this);
    d->forceLocalLabel->setText(tr("Use local core file:"));
    d->forceLocalLabel->setBuddy(d->forceLocalCheckBox);

    d->localCoreFileName = new PathChooser(this);
    d->localCoreFileName->setExpectedKind(PathChooser::File);
    d->localCoreFileName->setPromptDialogTitle(tr("Select Core File"));

    d->localExecFileName = new PathChooser(this);
    d->localExecFileName->setExpectedKind(PathChooser::File);
    d->localExecFileName->setPromptDialogTitle(tr("Select Executable"));

    d->overrideStartScriptFileName = new PathChooser(this);
    d->overrideStartScriptFileName->setExpectedKind(PathChooser::File);
    d->overrideStartScriptFileName->setPromptDialogTitle(tr("Select Startup Script"));

    d->buttonBox = new QDialogButtonBox(this);
    d->buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
    d->buttonBox->button(QDialogButtonBox::Ok)->setDefault(true);
    d->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);

    QHBoxLayout *coreLayout = new QHBoxLayout;
    coreLayout->addWidget(d->localCoreFileName);
    coreLayout->addWidget(d->remoteCoreFileName);
    coreLayout->addWidget(d->selectRemoteCoreButton);

    QFormLayout *formLayout = new QFormLayout;
    formLayout->setContentsMargins(0, 0, 0, 0);
    formLayout->setHorizontalSpacing(6);
    formLayout->setVerticalSpacing(6);
    formLayout->addRow(tr("Kit:"), d->kitChooser);
    formLayout->addRow(tr("&Executable:"), d->localExecFileName);
    formLayout->addRow(d->forceLocalLabel, d->forceLocalCheckBox);
    formLayout->addRow(tr("Core file:"), coreLayout);
    formLayout->addRow(tr("Override &start script:"), d->overrideStartScriptFileName);

    QFrame *line = new QFrame(this);
    line->setFrameShape(QFrame::HLine);
    line->setFrameShadow(QFrame::Sunken);

    formLayout->addRow(d->buttonBox);

    QVBoxLayout *vboxLayout = new QVBoxLayout(this);
    vboxLayout->addLayout(formLayout);
    vboxLayout->addStretch();
    vboxLayout->addWidget(line);
    vboxLayout->addWidget(d->buttonBox);
}
Пример #12
0
QWidget* ProcessingManager::setupQueueContainer() {
    queueModel_ = new ProcessingModel(this);
    connect(&projectData, &ProjectData::toBeAddedToProcessingQueue, queueModel_, &ProcessingModel::addProcesses);
    
    QFormLayout* layout = new QFormLayout;
    layout->setHorizontalSpacing(10);
    layout->setVerticalSpacing(2);
    layout->setRowWrapPolicy(QFormLayout::DontWrapRows);
    layout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
    layout->setFormAlignment(Qt::AlignHCenter | Qt::AlignTop);
    layout->setLabelAlignment(Qt::AlignLeft);

    int numberOfThreads = QThread::idealThreadCount();
    if(numberOfThreads < 1) numberOfThreads = 1;
    
    processesBox_ = new QSpinBox;
    processesBox_->setFrame(false);
    processesBox_->setMinimum(1);
    processesBox_->setMaximum(numberOfThreads);
    processesBox_->setValue(ProjectPreferences().processJobs());
    connect(processesBox_, static_cast<void(QSpinBox::*)(int)>(&QSpinBox::valueChanged), [=](int value){
        ProjectPreferences().setProcessJobs(value);
    });
    layout->addRow("Number of jobs to run in parallel", processesBox_);
    
    QLabel* introLabel = new QLabel("The maximum number of threads on your system is: " + QString::number(numberOfThreads));
    introLabel->setWordWrap(true);
    QPalette pal = introLabel->palette();
    pal.setColor(QPalette::WindowText, Qt::darkGray);
    introLabel->setPalette(pal);
    layout->addRow(introLabel);
    
    GroupContainer* jobcontainer = new GroupContainer;
    jobcontainer->setTitle("Concurrency Selection");
    jobcontainer->setContainerLayout(layout);
    
    QToolButton* addSelectedButton = getButton("add_queue", "Add Images", "Add selected images from the project library to the processing queue");
    connect(addSelectedButton, &GraphicalButton::clicked, [=]() {
        projectData.addSelectedToQueue();
    });
    
    QToolButton* clearSelectedButton = getButton("remove_highlighted", "Clear Selected", "Remove highlighted images from the processing queue");
    connect(clearSelectedButton, &GraphicalButton::clicked, [=]() {
        while(!queueView_->selectionModel()->selectedIndexes().isEmpty()) {
            QModelIndex i = queueView_->selectionModel()->selectedIndexes().first();
            if(!i.parent().isValid()) {
                queueModel_->removeRow(i.row());
            }
        }
        
        setQueueCount(queueModel_->rowCount());
    });
    
    QToolButton* clearAllButton = getButton("remove_all", "Clear All", "Remove all images from queue");
    connect(clearAllButton, &GraphicalButton::clicked, queueModel_, &ProcessingModel::clearAll);
    
    QToolButton* prioritizeButton = getButton("prioritize_highlighted", "Prioritize", "Prioritize the processing of highlighted images");
    connect(prioritizeButton, &GraphicalButton::clicked, [=]() {
        for(QModelIndex i : queueView_->selectionModel()->selectedRows(0)) {
            if(!i.parent().isValid()) {
                queueModel_->insertRow(0, queueModel_->takeRow(i.row()));
            }
        }
    });
    
    QHBoxLayout* buttonLayout = new QHBoxLayout();
    buttonLayout->addStretch(0);
    buttonLayout->addWidget(addSelectedButton, 0);
    buttonLayout->addStretch(1);
    buttonLayout->addWidget(prioritizeButton, 0);
    buttonLayout->addWidget(clearAllButton, 0);
    buttonLayout->addWidget(clearSelectedButton, 0);
    
    
    queueView_ = new QTreeView(this);
    queueView_->setAttribute(Qt::WA_MacShowFocusRect, 0);
    queueView_->setModel(queueModel_);
    queueView_->setSelectionMode(QAbstractItemView::ExtendedSelection);
    queueView_->setSortingEnabled(true);
    queueView_->setAllColumnsShowFocus(true);
    queueView_->setAlternatingRowColors(true);
    queueView_->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
    queueView_->setHeaderHidden(true);
    
    BlockContainer* queueContainer = new BlockContainer("Images in queue", queueView_);
    
    QVBoxLayout *queueLayout = new QVBoxLayout;
    queueLayout->setMargin(10);
    queueLayout->setSpacing(10);
    queueLayout->addLayout(buttonLayout, 0);
    queueLayout->addWidget(queueContainer, 1);

    GroupContainer* container = new GroupContainer;
    container->setTitle("Processing Queue");
    container->setContainerLayout(queueLayout);
    
    
    QVBoxLayout* mainLayout = new QVBoxLayout();
    mainLayout->setMargin(0);
    mainLayout->setSpacing(10);
    mainLayout->addStretch(0);
    mainLayout->addWidget(jobcontainer, 0);
    mainLayout->addWidget(container, 1);
    
    QWidget* mainContainer = new QWidget;
    mainContainer->setLayout(mainLayout);
    mainContainer->setMaximumWidth(500);
    
    return mainContainer;
}
Пример #13
0
/**
 *
 * @param theme
 * @param parent
 */
SystemOptions::SystemOptions(const QString & theme,QWidget * parent) : OptionsWidget(theme,parent) {
  m_section = "System";
  m_allowNavMode = false;
  QVBoxLayout * vlayout = new QVBoxLayout;
  setObjectName("systemoptions");


  m_contentsLinked = new QCheckBox;
  m_lexicon = new QLineEdit;
  QPushButton * lexiconbutton = new QPushButton(tr("..."));
  QHBoxLayout * lexiconlayout = new QHBoxLayout;
  connect(lexiconbutton,SIGNAL(clicked()),this,SLOT(onSetDatabase()));
  lexiconlayout->addWidget(m_lexicon);
  lexiconlayout->addSpacing(10);
  lexiconlayout->addWidget(lexiconbutton);
  lexiconlayout->addStretch();
  //  this->setControlSize(m_lexicon,VLARGE_EDIT);
  m_interval = new QLineEdit;
  m_interval->setValidator(new QIntValidator);
  this->setControlSize(m_interval,SMALL_EDIT);
  m_docked = new QCheckBox;
  m_importCheck = new QCheckBox;
  m_importShow = new QCheckBox;


  //  this->setControlSize(m_focusTab,LARGE_EDIT);
  m_minimalInterface = new QCheckBox;
  m_restoreBookmarks = new QCheckBox;
  m_restoreTabs = new QCheckBox;
  //  m_saveSettings = new QCheckBox;
  m_saveTabs = new QCheckBox;
  m_rootNavigation = new QCheckBox;
  // Root mod
  //  m_runDate = new QDateTimeEdit;
  //  this->setControlSize(m_runDate,VLARGE_EDIT);

  // Save boo
  m_showInterfaceWarning = new QCheckBox;

  m_qtStyle = new QComboBox;
  m_qtStyle->addItems(QStyleFactory::keys());

  m_css = new QLineEdit;
  QHBoxLayout * csslayout = new QHBoxLayout;
  QPushButton * cssbutton = new QPushButton(tr("..."));
  csslayout->addWidget(m_css);
  csslayout->addSpacing(10);
  csslayout->addWidget(cssbutton);
  csslayout->addStretch();
  connect(cssbutton,SIGNAL(clicked()),this,SLOT(onSetCss()));


  m_theme = new QComboBox;

  m_title = new QLineEdit;

  m_toolbarText = new QCheckBox;
  m_useNotes = new QCheckBox;

  m_notesDb = new QLineEdit;
  m_optionsWarning  = new QCheckBox;
QHBoxLayout * noteslayout = new QHBoxLayout;
  QPushButton * notesbutton = new QPushButton(tr("..."));
  noteslayout->addWidget(m_notesDb);
  noteslayout->addSpacing(10);
  noteslayout->addWidget(notesbutton);
  noteslayout->addStretch();
  connect(notesbutton,SIGNAL(clicked()),this,SLOT(onSetNotesDatabase()));

  m_historyDb = new QLineEdit;
  QHBoxLayout * historylayout = new QHBoxLayout;
  QPushButton * historybutton = new QPushButton(tr("..."));
  historylayout->addWidget(m_historyDb);
  historylayout->addSpacing(10);
  historylayout->addWidget(historybutton);
  historylayout->addStretch();
  connect(historybutton,SIGNAL(clicked()),this,SLOT(onSetHistoryDatabase()));

  m_keyboard = new QComboBox;

  m_splashScreen = new QCheckBox;
  m_splashDuration = new QLineEdit;
  m_splashDuration->setValidator(new QIntValidator);
  this->setControlSize(m_splashDuration,SMALL_EDIT);

  m_allowDuplicates = new QCheckBox;
  /// there are no other radiobuttons, so just make this the parent
  QHBoxLayout * tablayout = new QHBoxLayout;
  m_insertNewTab = new QRadioButton(tr("Insert"),this);
  m_appendNewTab = new QRadioButton(tr("Append"),this);
  tablayout->addWidget(m_insertNewTab);
  tablayout->addSpacing(40);
  tablayout->addWidget(m_appendNewTab);
  tablayout->addStretch();

  QGroupBox * dbgroup = new QGroupBox(tr("Databases"));
  QFormLayout * dblayout = new QFormLayout;
  dblayout->addRow(tr("Lexicon"),lexiconlayout);
  dblayout->addRow(tr("Notes"),noteslayout);
  dblayout->addRow(tr("History"),historylayout);
  dblayout->setVerticalSpacing(VERTICAL_SPACING);
  dbgroup->setLayout(dblayout);


  QGroupBox * othergroup = new QGroupBox(tr("Options"));
  QFormLayout * optionlayout = new QFormLayout;



  optionlayout->addRow(tr("Title"),m_title);
  optionlayout->addRow(tr("Application stylesheet"),csslayout);
  optionlayout->addRow(tr("Theme"),m_theme);
  optionlayout->addRow(tr("Qt style"),m_qtStyle);
  optionlayout->addRow(tr("Docked"),m_docked);
  optionlayout->addRow(tr("New tab behaviour"),tablayout);
  optionlayout->addRow(tr("Contents linked"),m_contentsLinked);
  optionlayout->addRow(tr("Restore bookmarks"),m_restoreBookmarks);
  optionlayout->addRow(tr("Restore tabs"),m_restoreTabs);
  //  optionlayout->addRow(tr("Save settings"),m_saveSettings);
  //  optionlayout->addRow(tr("Run date"),m_runDate);
  optionlayout->addRow(tr("Minimal interface"),m_minimalInterface);
  optionlayout->addRow(tr("Show interface warning"),m_showInterfaceWarning);
  optionlayout->addRow(tr("Show preferences close warning"),m_optionsWarning);
  optionlayout->addRow(tr("Message duration (secs)"),m_interval);
  optionlayout->addRow(tr("Toolbar text"),m_toolbarText);
  if (m_allowNavMode) {
    optionlayout->addRow(tr("Nav by root"),m_rootNavigation);
  }
  else {
    m_rootNavigation->setVisible(false);
  }
  optionlayout->addRow(tr("Allow duplicates"),m_allowDuplicates);
  //  optionlayout->addRow(tr("Use notes"),m_useNotes);

  optionlayout->addRow(tr("Keyboard"),m_keyboard);

  QHBoxLayout * splashlayout = new QHBoxLayout;
  splashlayout->addWidget(m_splashScreen);
  splashlayout->addSpacing(10);
  splashlayout->addWidget(new QLabel(tr("Duration (secs)")));
  splashlayout->addWidget(m_splashDuration);
  splashlayout->addSpacing(10);
  QPushButton * splashbutton = new QPushButton(tr("Show location"));
  splashlayout->addWidget(splashbutton);
  connect(splashbutton,SIGNAL(clicked()),this,SLOT(onShowSplash()));
  splashlayout->addStretch();

  optionlayout->addRow(tr("Show splash screen"),splashlayout);
  optionlayout->addRow(tr("Import links ignore db mismatch"),m_importCheck);
  optionlayout->addRow(tr("Import links show warning"),m_importShow);
  optionlayout->setVerticalSpacing(VERTICAL_SPACING);
  othergroup->setLayout(optionlayout);


  m_onlineUrl = new QLineEdit;
  m_onlineCurrentPage = new QLineEdit;
  m_offlineLocation = new QLineEdit;
  QHBoxLayout * locationlayout = new QHBoxLayout;
  QPushButton * locationbutton = new QPushButton(tr("..."));
  locationlayout->addWidget(m_offlineLocation);
  locationlayout->addSpacing(10);
  locationlayout->addWidget(locationbutton);
  locationlayout->addStretch();

  connect(locationbutton,SIGNAL(clicked()),this,SLOT(onOfflineLocation()));
  m_offlineCurrentPage = new QLineEdit;
  m_localDocs = new QCheckBox;
  QGroupBox * docgroup = new QGroupBox(tr("Documentation"));
  QFormLayout * doclayout = new QFormLayout;
  doclayout->addRow(tr("Online URL"),m_onlineUrl);
  doclayout->addRow(tr("Online current page"),m_onlineCurrentPage);
  doclayout->addRow(tr("Offline location"),locationlayout);
  doclayout->addRow(tr("Offline current page"),m_offlineCurrentPage);
  doclayout->addRow(tr("Local documentation"),m_localDocs);
  doclayout->setVerticalSpacing(VERTICAL_SPACING);
  docgroup->setLayout(doclayout);


  vlayout->addWidget(dbgroup);
  vlayout->addWidget(othergroup);
  vlayout->addWidget(docgroup);

  vlayout->addStretch();
  setLayout(vlayout);
  addButtons();
  readSettings();
  setupConnections();
  this->setLineEditSize(VLARGE_EDIT);
  this->setComboSize(VLARGE_EDIT);


}
Пример #14
0
/**
 *
 * @param theme
 * @param parent
 */
IconOptions::IconOptions(const QString & theme,QWidget * parent) : OptionsWidget(theme,parent) {
  setObjectName("iconoptions");
  m_section = "Icons";


  QVBoxLayout * vlayout = new QVBoxLayout;

  QFormLayout * layout = new QFormLayout;


  m_directory = new QLineEdit;
  QPushButton * directorybtn = new QPushButton(tr("Select directory"));
  QHBoxLayout * directorylayout = new QHBoxLayout;
  connect(directorybtn,SIGNAL(clicked()),this,SLOT(onSetDirectory()));
  directorybtn->setProperty("SID",SID_ICON_DIRECTORY);
  m_directory->setObjectName(SID_ICON_DIRECTORY);
  directorylayout->addWidget(m_directory);
  directorylayout->addWidget(directorybtn);

  layout->addRow(tr("Image directory"),directorylayout);


  QHBoxLayout * hlayout = new QHBoxLayout;
  QFormLayout * leftlayout = new QFormLayout;

  m_about = new QLineEdit;
  leftlayout->addRow(tr("About"),addLine(m_about,SID_ICON_ABOUT));

  m_back = new QLineEdit;
  leftlayout->addRow(tr("Back"),addLine(m_back,SID_ICON_BACK));

  m_background = new QLineEdit;
  leftlayout->addRow(tr("Background tab"),addLine(m_background,SID_ICON_NEW_BACKGROUND_TAB)); // new

  m_bookmarks = new QLineEdit;
  leftlayout->addRow(tr("Bookmarks"),addLine(m_bookmarks,SID_ICON_BOOKMARKS));
  m_clear = new QLineEdit;
  leftlayout->addRow(tr("Clear"),addLine(m_clear,SID_ICON_CLEAR));

  m_collapse = new QLineEdit;
  leftlayout->addRow(tr("Collapse"),addLine(m_collapse,SID_ICON_COLLAPSE)); // new

  m_docs = new QLineEdit;
  leftlayout->addRow(tr("Docs"),addLine(m_docs,SID_ICON_DOCS));
  m_exit = new QLineEdit;
  leftlayout->addRow(tr("Exit"),addLine(m_exit,SID_ICON_EXIT));

  m_expand = new QLineEdit;
  leftlayout->addRow(tr("Expand"),addLine(m_expand,SID_ICON_EXPAND)); //new


  m_first = new QLineEdit;
  leftlayout->addRow(tr("First"),addLine(m_first,SID_ICON_FIRST));
  m_history = new QLineEdit;
  leftlayout->addRow(tr("History"),addLine(m_history,SID_ICON_HISTORY));
  m_insertLink = new QLineEdit;
  leftlayout->addRow(tr("Insert Link"),addLine(m_insertLink,SID_ICON_INSERT_LINK));
  m_keymaps = new QLineEdit;
  leftlayout->addRow(tr("Keymaps"),addLine(m_keymaps,SID_ICON_KEYMAPS));
  m_keymapsDisabled = new QLineEdit;
  leftlayout->addRow(tr("Keymaps disabled"),addLine(m_keymapsDisabled,SID_ICON_KEYMAPS_DISABLED));
  m_last = new QLineEdit;
  leftlayout->addRow(tr("Last"),addLine(m_last,SID_ICON_LAST));
  m_link = new QLineEdit;
  leftlayout->addRow(tr("Link"),addLine(m_link,SID_ICON_LINK));

  m_list = new QLineEdit;
  leftlayout->addRow(tr("List"),addLine(m_list,SID_ICON_FLATTEN)); // new

  m_load = new QLineEdit;
  leftlayout->addRow(tr("Load"),addLine(m_load,SID_ICON_LOAD));  // new

  QFormLayout * rightlayout = new QFormLayout;
  m_localSearch = new QLineEdit;
  rightlayout->addRow(tr("Local search"),addLine(m_localSearch,SID_ICON_LOCAL_SEARCH));
  m_localSearchNext = new QLineEdit;
  rightlayout->addRow(tr("Local search next"),addLine(m_localSearchNext,SID_ICON_LOCAL_SEARCH_NEXT));



  m_logs = new QLineEdit;
  rightlayout->addRow(tr("Logs"),addLine(m_logs,SID_ICON_LOGS));
  m_narrow = new QLineEdit;
  rightlayout->addRow(tr("Narrow"),addLine(m_narrow,SID_ICON_NARROW));

  m_newTab = new QLineEdit;
  rightlayout->addRow(tr("New tab"),addLine(m_newTab,SID_ICON_NEW_TAB)); //

  m_next = new QLineEdit;
  rightlayout->addRow(tr("Next"),addLine(m_next,SID_ICON_NEXT));
  m_notes = new QLineEdit;
  rightlayout->addRow(tr("Notes"),addLine(m_notes,SID_ICON_NOTES));
  m_preferences = new QLineEdit;
  rightlayout->addRow(tr("Preferences"),addLine(m_preferences,SID_ICON_PREFERENCES));
  m_print = new QLineEdit;
  rightlayout->addRow(tr("Print"),addLine(m_print,SID_ICON_PRINT));
  m_search = new QLineEdit;
  rightlayout->addRow(tr("Search"),addLine(m_search,SID_ICON_SEARCH));
  m_syncLeft = new QLineEdit;
  rightlayout->addRow(tr("Sync left"),addLine(m_syncLeft,SID_ICON_SYNC_LEFT));
  m_syncRight = new QLineEdit;
  rightlayout->addRow(tr("Sync right"),addLine(m_syncRight,SID_ICON_SYNC_RIGHT));
  m_unlink = new QLineEdit;
  rightlayout->addRow(tr("Unlink"),addLine(m_unlink,SID_ICON_UNLINK));
  m_widen = new QLineEdit;
  rightlayout->addRow(tr("Widen"),addLine(m_widen,SID_ICON_WIDEN));
  m_zoom = new QLineEdit;
  rightlayout->addRow(tr("Zoom"),addLine(m_zoom,SID_ICON_ZOOM));
  m_zoomIn = new QLineEdit;
  rightlayout->addRow(tr("Zoom in"),addLine(m_zoomIn,SID_ICON_ZOOM_IN));
  m_zoomOut = new QLineEdit;
  rightlayout->addRow(tr("Zoom out"),addLine(m_zoomOut,SID_ICON_ZOOM_OUT));

  leftlayout->setVerticalSpacing(5);
  rightlayout->setVerticalSpacing(5);
  hlayout->addLayout(leftlayout);
  hlayout->addSpacing(30);
  hlayout->addLayout(rightlayout);

  vlayout->addLayout(layout);
  vlayout->addLayout(hlayout);
  vlayout->addStretch();
  setLayout(vlayout);
  addButtons();
  readSettings();
  setupConnections();

}
Пример #15
0
void StatusWindow::createLayout()
{
    QVBoxLayout *mainLayout = new QVBoxLayout(this);

    QFormLayout *formLayout = new QFormLayout();
    mainLayout->addLayout(formLayout);
    formLayout->setMargin(0);
    formLayout->setVerticalSpacing(0);

    // status combo box

    StatusSelect = new QComboBox(this);
    formLayout->addRow(new QLabel(tr("Status") + ':'), StatusSelect);

    // spacing

    formLayout->addItem(new QSpacerItem(0, 4));

    // description combo box

    QHBoxLayout *descriptionSelectLayout = new QHBoxLayout();
    descriptionSelectLayout->setMargin(0);
    descriptionSelectLayout->setSpacing(0);

    DescriptionSelect = new QComboBox(this);
    DescriptionSelect->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
    DescriptionSelect->setToolTip(tr("Select Previously Used Description"));
    descriptionSelectLayout->addWidget(DescriptionSelect);

    ClearDescriptionsHistoryButton = new QPushButton(m_iconsManager->iconByPath(KaduIcon("edit-clear")), "", this);
    ClearDescriptionsHistoryButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    ClearDescriptionsHistoryButton->setToolTip(tr("Clear Descriptions History"));
    descriptionSelectLayout->addWidget(ClearDescriptionsHistoryButton);

    formLayout->addRow(new QLabel(tr("Description") + ':'), descriptionSelectLayout);

    // description edit field

    QWidget *descriptionCounterLayoutWidget = new QWidget(this);
    QVBoxLayout *descriptionCounterLayout = new QVBoxLayout(descriptionCounterLayoutWidget);
    descriptionCounterLayout->setMargin(0);
    descriptionCounterLayout->setSpacing(5);

    descriptionCounterLayout->addStretch();

    DescriptionCounter = new QLabel(this);
    DescriptionCounter->setAlignment(formLayout->labelAlignment());
    descriptionCounterLayout->addWidget(DescriptionCounter);

    descriptionCounterLayout->addSpacing(2);   // 2 px bottom margin

    QWidget *descriptionEditLayoutWidget = new QWidget(this);
    QHBoxLayout *descriptionEditLayout = new QHBoxLayout(descriptionEditLayoutWidget);
    descriptionEditLayout->setMargin(0);
    descriptionEditLayout->setSpacing(0);

    DescriptionEdit = new KaduTextEdit(this);
    DescriptionEdit->installEventFilter(this);
    DescriptionEdit->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    DescriptionEdit->setTabChangesFocus(true);
    descriptionEditLayout->addWidget(DescriptionEdit);

    QVBoxLayout *descriptionEraseLayout = new QVBoxLayout();
    descriptionEraseLayout->setMargin(0);
    descriptionEraseLayout->setSpacing(0);
    descriptionEraseLayout->addStretch();
    EraseButton = new QPushButton(m_iconsManager->iconByPath(KaduIcon("edit-clear-locationbar-rtl")), "", this);
    EraseButton->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
    EraseButton->setToolTip(tr("Erase Description"));
    descriptionEraseLayout->addWidget(EraseButton);
    descriptionEditLayout->addLayout(descriptionEraseLayout);

    formLayout->addRow(descriptionCounterLayoutWidget, descriptionEditLayoutWidget);

    mainLayout->addSpacing(16);

    // dialog buttons

    QDialogButtonBox *buttonsBox = new QDialogButtonBox(Qt::Horizontal, this);

    SetStatusButton = new QPushButton(qApp->style()->standardIcon(QStyle::SP_DialogOkButton), tr("&Set status"), this);
    SetStatusButton->setDefault(true);
    buttonsBox->addButton(SetStatusButton, QDialogButtonBox::AcceptRole);

    CancelButton = new QPushButton(tr("&Cancel"), this);
    CancelButton->setIcon(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton));
    buttonsBox->addButton(CancelButton, QDialogButtonBox::RejectRole);

    mainLayout->addWidget(buttonsBox);
}