void PropertiesManager::createAliasProperties(AliasTextItem *ati)
{
    //move up down
    root->actionMove_Up->setEnabled(true);
    root->actionMove_Down->setEnabled(true);
    root->actionDeleteItems->setEnabled(true);

    QLabel *label = new QLabel("<b>Edit Alias</b>");
    addRow(label);

    QLineEdit *name = new QLineEdit();
    name->installEventFilter(&eventFilterObject);
    name->setText(ati->getName());
    name->setValidator(validator);
    connect(name, SIGNAL(textChanged(QString)), ati, SLOT(setName(QString)));
    addRow(tr("&Name:"), name);

    QLineEdit *maths = new QLineEdit();
    maths->installEventFilter(&eventFilterObject);
    maths->setText(ati->getMaths()->equation);
    connect(maths, SIGNAL(textChanged(QString)), ati, SLOT(setMaths(QString)));
    addRow(tr("&Maths:"), maths);
    addWidget(new QLabel(tr("<i>in physiological units</i>")));

    QStringList errs;
    ati->getMaths()->validateMathInLine(root->al, &errs);

    // sort out errors
    QSettings settings;
    int num_errs = settings.beginReadArray("warnings");
    settings.endArray();

    if (num_errs != 0) {

        // show errors by changing lineedit colour
        QPalette p = maths->palette();
        p.setColor( QPalette::Normal, QPalette::Base, QColor(255, 200, 200) );
        maths->setPalette(p);

        // clear errors
        settings.remove("warnings");

    }
    if (num_errs == 0) {

        // show no errors by changing lineedit colour
        QPalette p = maths->palette();
        p.setColor( QPalette::Normal, QPalette::Base, QColor(255, 255, 255) );
        maths->setPalette(p);

        // clear errors
        settings.remove("warnings");
    }
}
Example #2
0
void TestLoad::spaceElement_data()
{
    QTest::addColumn<QString>("input");
    QTest::addColumn<int>("output");
    QTest::addColumn<int>("outputRecursive");

    // Space element does not have content
    addRow( "<mspace/>", 0 );
    addRow( "<mspace width=\0.5em\"/>", 0 );
    addRow( "<mspace linebreak=\"newline\"/>", 0 );
}
Example #3
0
void TestLoad::fencedElement_data()
{
    QTest::addColumn<QString>("input");
    QTest::addColumn<int>("output");
    QTest::addColumn<int>("outputRecursive");

    // This is an inferred mrow element
    addRow( "<mfenced></mfenced>", 0 );
    addRow( "<mfenced><mi>x</mi></mfenced>", 1 );
    addRow( "<mfenced><mi>x</mi><mn>2</mn></mfenced>", 2 ); // Inferred mrow
}
void BookmarkManagerTest::loadFile_data()
{
    QTest::addColumn<QString>( "relativePath" );
    QTest::addColumn<bool>( "expected" );

    addRow() << QString() << false;
    addRow() << QString( "lsdkrfuweqofn.kml" ) << false; // non-existing file

// FIXME This will create an empty KML file called "LICENSE.txt" under MarbleDirs::localPath().
//    addRow() << QString( "LICENSE.txt" ) << true; // file exists in MarbleDirs::systemPath()
}
Example #5
0
void TestLoad::actionElement_data()
{
    QTest::addColumn<QString>("input");
    QTest::addColumn<int>("output");
    QTest::addColumn<int>("outputRecursive");

    // Basic content
    addRow( "<maction actiontype=\"toggle\" selection=\"positive-integer\"><mrow></mrow><mrow></mrow></maction>", 0 ); // 
    addRow( "<maction actiontype=\"statusline\"><mrow></mrow><mrow></mrow></maction>", 0 );
    addRow( "<maction actiontype=\"tooltip\"><mrow></mrow><mrow></mrow></maction>", 0 );
    addRow( "<maction actiontype=\"highlight\" my:color=\"red\" my:background=\"yellow\"><mrow></mrow></maction>", 0 );
}
void FacebookAddAccountWidget::createGui(bool showButtons)
{
    auto mainLayout = make_owned<QVBoxLayout>(this);

    auto formWidget = make_owned<QWidget>(this);
    mainLayout->addWidget(formWidget);

    auto layout = make_owned<QFormLayout>(formWidget);

    m_username = make_owned<QLineEdit>(this);
    connect(m_username, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
    layout->addRow(tr("Username") + ':', m_username);

    m_password = make_owned<QLineEdit>(this);
    connect(m_password, SIGNAL(textEdited(QString)), this, SLOT(dataChanged()));
    m_password->setEchoMode(QLineEdit::Password);
    layout->addRow(tr("Password") + ':', m_password);

    m_rememberPassword = make_owned<QCheckBox>(tr("Remember Password"), this);
    layout->addRow(0, m_rememberPassword);

    m_identity = m_pluginInjectedFactory->makeInjected<IdentitiesComboBox>(this);
    connect(m_identity, SIGNAL(currentIndexChanged(int)), this, SLOT(dataChanged()));
    layout->addRow(tr("Account Identity") + ':', m_identity);

    auto infoLabel = make_owned<QLabel>(
        tr("<font size='-1'><i>Select or enter the identity that will be associated with this account.</i></font>"),
        this);
    infoLabel->setWordWrap(true);
    infoLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    infoLabel->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));
    layout->addRow(0, infoLabel);

    mainLayout->addStretch(100);

    auto buttons = make_owned<QDialogButtonBox>(Qt::Horizontal, this);
    mainLayout->addWidget(buttons);

    m_addAccountButton =
        make_owned<QPushButton>(qApp->style()->standardIcon(QStyle::SP_DialogApplyButton), tr("Add Account"), this);
    auto cancelButton =
        make_owned<QPushButton>(qApp->style()->standardIcon(QStyle::SP_DialogCancelButton), tr("Cancel"), this);

    buttons->addButton(m_addAccountButton, QDialogButtonBox::AcceptRole);
    buttons->addButton(cancelButton, QDialogButtonBox::DestructiveRole);

    connect(m_addAccountButton, SIGNAL(clicked(bool)), this, SLOT(apply()));
    connect(cancelButton, SIGNAL(clicked(bool)), this, SLOT(cancel()));

    if (!showButtons)
        buttons->hide();
}
Example #7
0
void TestLoad::supElement_data()
{
    QTest::addColumn<QString>("input");
    QTest::addColumn<int>("output");
    QTest::addColumn<int>("outputRecursive");

    // Basic content
    addRow( "<msup><mrow></mrow><mrow></mrow></msup>", 2 );
    addRow( "<msup><mi>x</mi><mi>y</mi></msup>", 2, 4 );
    addRow( "<msup><mrow><mi>x</mi></mrow><mi>y</mi></msup>", 2, 4 );
    addRow( "<msup><mi>x</mi><mrow><mi>y</mi></mrow></msup>", 2, 4 );
    addRow( "<msup><mrow><mi>x</mi></mrow><mrow><mi>y</mi></mrow></msup>", 2, 4 );

    // More complex content
    addRow( "<msup>"
            " <mrow>"
            "  <mo> ( </mo>"
            "  <mrow>"
            "   <mi> x </mi>"
            "   <mo> + </mo>"
            "   <mi> y </mi>"
            "  </mrow>"
            "  <mo> ) </mo>"
            " </mrow>"
            " <mn> 2 </mn>"  // An mrow is added here
            "</msup>", 2, 9 );

    // Be sure attributes don't break anything
    addRow( "<msup superscriptshift=\"1.5ex\"><mi>x</mi><mi>y</mi></msup>", 2, 4 );
    addRow( "<msup superscriptshift=\"1.5\"><mi>x</mi><mi>y</mi></msup>", 2, 4 );
}
Example #8
0
void LogCtxMenu::setConfigValuesToUI (LogConfig const & cfg)
{
	clearUI();

	QStandardItem * csh_root = static_cast<QStandardItemModel *>(m_ui->listViewColumnShow->model())->invisibleRootItem();
	QStandardItem * cs_root = static_cast<QStandardItemModel *>(m_ui->listViewColumnSetup->model())->invisibleRootItem();
	QStandardItem * csz_root = static_cast<QStandardItemModel *>(m_ui->listViewColumnSizes->model())->invisibleRootItem();
	QStandardItem * cal_root = static_cast<QStandardItemModel *>(m_ui->listViewColumnAlign->model())->invisibleRootItem();
	QStandardItem * cel_root = static_cast<QStandardItemModel *>(m_ui->listViewColumnElide->model())->invisibleRootItem();
	for (int i = 0, ie = cfg.m_columns_setup.size(); i < ie; ++i)
	{
		int const li = m_log_widget.horizontalHeader()->logicalIndex(i);
		Q_ASSERT(li > -1);
	
		bool const hidden = cfg.m_columns_sizes[li] == 0;
		//bool const hidden = m_log_widget.horizontalHeader()->isSectionHidden(li);
		csh_root->appendRow(addRow(QString(""), !hidden));
		cs_root->appendRow(addUncheckableRow(tr("%1").arg(cfg.m_columns_setup.at(li))));
		csz_root->appendRow(addUncheckableRow(tr("%1").arg(cfg.m_columns_sizes.at(li))));
		cal_root->appendRow(addUncheckableRow(tr("%1").arg(cfg.m_columns_align.at(li))));
		cel_root->appendRow(addUncheckableRow(tr("%1").arg(cfg.m_columns_elide.at(li))));
	}

  //@FIXME TODO: for f***s sake...
	//size_t const n = tlv::get_tag_count() - 1; // -1 is for the tag Bool
	size_t const n = tlv::tag_bool;

	size_t add_tag_count = 0;
	size_t * const add_tag_indices = static_cast<size_t * const>(alloca(sizeof(size_t) * n));
	for (size_t i = tlv::tag_ctime; i < n; ++i)
	{
		char const * name = tlv::get_tag_name(i);
		if (name)
		{
			if (findChildByText(cs_root, QString::fromLatin1(name)))
				continue;

			QList<QStandardItem *> row_items = addRow(QString::fromLatin1(name), false);
			cs_root->appendRow(row_items);
			add_tag_indices[add_tag_count++] = i;

			TagDesc const & td = m_log_widget.m_tagconfig.findOrCreateTag(i);
			bool const hidden = true;
			csh_root->appendRow(addRow(QString(""), !hidden));
			csz_root->appendRow(addUncheckableRow(tr("%1").arg(td.m_size)));
			cal_root->appendRow(addUncheckableRow(td.m_align_str));
			cel_root->appendRow(addUncheckableRow(td.m_elide_str));
		}
	}
}
void PropertiesManager::createRegimeProperties(RegimeGraphicsItem *i)
{
    QLabel *label = new QLabel("<b>Edit Regime</b>");
    addRow(label);
    QLineEdit *edit_name = new QLineEdit();
    edit_name->installEventFilter(&eventFilterObject);
    edit_name->setText(i->getRegimeName());
    edit_name->setValidator(validator);
    connect(edit_name, SIGNAL(textEdited(QString)), i, SLOT(setRegimeName(QString)));
    addRow(tr("&Name:"),edit_name);

    root->addItemsToolbar->addAction(root->actionAddTimeDerivative);
    root->actionDeleteItems->setEnabled(true);
}
Example #10
0
File: Table.cpp Project: Cruel/TGUI
int main()
{
    sf::RenderWindow window({800,600}, "Table widget example");
    window.setFramerateLimit(60);

    tgui::Gui gui(window);

    auto table = std::make_shared<tgui::Table>();
    table->setSize({780, 580});
    table->setPosition({10,10});
    table->setHeaderColumns({"First Name", "Last Name", ""});
    table->setBackgroundColor({203,201,207});
    table->setFixedColumnWidth(0, 400);
    table->setStripesRowsColor({246,246,246}, {233,233,233});
    gui.add(table);

    auto button = std::make_shared<tgui::Button>();
    button->setText("Connect");
    button->setSize({100,30});
    button->connect("pressed", [](){ std::cout << "Button pressed" << std::endl; });

    auto tableRow = std::make_shared<tgui::TableRow>();
    tableRow->addItem("Eve");
    tableRow->addItem("Jackson");
    tableRow->add(button, true);

    table->add(tableRow);
    table->addRow({"John", "Doe", "80"});
    table->addRow({"Adam", "Johnson", "67"});
    table->addRow({"Jill", "Smith", "50"});

    while (window.isOpen())
    {
        sf::Event event;
        while(window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            gui.handleEvent(event);
        }

        window.clear();
        gui.draw();
        window.display();
    }

    return 0;
}
void PropertiesManager::createOnConditionProperties(OnConditionGraphicsItem *oci)
{
    QLabel *label = new QLabel("<b>Edit On Condition</b>");
    addRow(label);

    QLineEdit *maths = new QLineEdit();
    maths->installEventFilter(&eventFilterObject);
    maths->setText(oci->getTriggerMaths()->equation);
    connect(maths, SIGNAL(textChanged(QString)), oci, SLOT(setTriggerMaths(QString)));
    addRow(tr("&Maths:"), maths);
    addWidget(new QLabel(tr("<i>in physiological units</i>")));

    QStringList errs;
    oci->getTriggerMaths()->validateMathInLine(root->al.data(), &errs);

    // sort out errors
    QSettings settings;
    int num_errs = settings.beginReadArray("warnings");
    settings.endArray();

    if (num_errs != 0) {

        // show errors by changing lineedit colour
        QPalette p = maths->palette();
        p.setColor( QPalette::Normal, QPalette::Base, QColor(255, 200, 200) );
        maths->setPalette(p);

        // clear errors
        settings.remove("warnings");

    }
    if (num_errs == 0) {

        // show no errors by changing lineedit colour
        QPalette p = maths->palette();
        p.setColor( QPalette::Normal, QPalette::Base, QColor(255, 255, 255) );
        maths->setPalette(p);

        // clear errors
        settings.remove("warnings");
    }

    //edit Synapse regime??

    root->addItemsToolbar->addAction(root->actionAddStateAssignment);
    root->addItemsToolbar->addAction(root->actionAddEventOut);
    root->addItemsToolbar->addAction(root->actionAddImpulseOut);
    root->actionDeleteItems->setEnabled(true);
}
Example #12
0
void ChatTab::addNewRow(std::string &line)
{
    if (mScrollArea->getVerticalScrollAmount() >=
        mScrollArea->getVerticalMaxScroll())
    {
        addRow(line);
        mScrollArea->setVerticalScrollAmount(
            mScrollArea->getVerticalMaxScroll());
    }
    else
    {
        addRow(line);
    }
    mScrollArea->logic();
}
Example #13
0
void CustomWizardFieldPage::addField(const CustomWizardField &field)\
{
    //  Register field, indicate mandatory by '*' (only when registering)
    QString fieldName = field.name;
    if (field.mandatory)
        fieldName += QLatin1Char('*');
    bool spansRow = false;
    // Check known classes: QComboBox
    const QString className = field.controlAttributes.value(QLatin1String("class"));
    QWidget *fieldWidget = 0;
    if (className == QLatin1String("QComboBox")) {
        fieldWidget = registerComboBox(fieldName, field);
    } else if (className == QLatin1String("QTextEdit")) {
        fieldWidget = registerTextEdit(fieldName, field);
    } else if (className == QLatin1String("Utils::PathChooser")) {
        fieldWidget = registerPathChooser(fieldName, field);
    } else if (className == QLatin1String("QCheckBox")) {
        fieldWidget = registerCheckBox(fieldName, field.description, field);
        spansRow = true; // Do not create a label for the checkbox.
    } else {
        fieldWidget = registerLineEdit(fieldName, field);
    }
    if (spansRow)
        m_formLayout->addRow(fieldWidget);
    else
        addRow(field.description, fieldWidget);
}
Example #14
0
int main(int c, char **v)
{
	QApplication 	app(c,v);
	
	QDialog dialog(NULL);

	Samples::ListView *listView  = new Samples::ListView(&dialog);


	QPushButton *addBtn = new QPushButton("add    row", &dialog);
	QPushButton *remBtn = new QPushButton("remove row", &dialog);

	dialog.setLayout(new QHBoxLayout());
  dialog.layout()->addWidget(listView);
	dialog.layout()->addWidget(addBtn);
	dialog.layout()->addWidget(remBtn);


	dialog.connect(addBtn,SIGNAL(pressed()),listView,SLOT(addRow()));
	dialog.connect(remBtn,SIGNAL(pressed()),listView,SLOT(removeRow()));

	dialog.show();

	return app.exec();

}
Example #15
0
CsvFile& CsvFile::addCell(const std::string& str)
{
    if (rows.empty())
        addRow();
    rows.back().push_back(str);
    return *this;
}
Example #16
0
QWidget* StopSpam::options() {
        if (!enabled) {
                return 0;
        }
	options_ = new QWidget();
	ui_.setupUi(options_);
	connect(options_, SIGNAL(destroyed()), SLOT(onOptionsClose()));

	ui_.tv_rules->setModel(model_);
	ui_.tv_rules->init();

	connect(ui_.cb_send_block_all_mes, SIGNAL(stateChanged(int)), SLOT(changeWidgetsState()));
	connect(ui_.cb_enable_muc, SIGNAL(stateChanged(int)), SLOT(changeWidgetsState()));
	connect(ui_.cb_block_privates, SIGNAL(stateChanged(int)), SLOT(changeWidgetsState()));

	connect(ui_.pb_add, SIGNAL(released()), SLOT(addRow()));
	connect(ui_.pb_del, SIGNAL(released()), SLOT(removeRow()));

	connect(ui_.pb_reset, SIGNAL(released()), SLOT(resetCounter()));
	connect(ui_.pb_view, SIGNAL(released()), SLOT(view()));

	restoreOptions();
        changeWidgetsState();

	return options_;
}
Example #17
0
UISidePanel::UISidePanel() : current_node_(NULL)
{
  QVBoxLayout* layout = new QVBoxLayout;

  table_ = new QTableWidget;//(this);
  table_->setColumnCount(2);
  layout->addWidget(table_);

  QPushButton* newRow = new QPushButton("Add row");
  connect(newRow, SIGNAL(clicked()), this, SLOT(addRow()));
  layout->addWidget(newRow);


  object_label_ = new UITextBoxWithLabel(UITextBoxWithLabel::Horizontal);
  layout->addWidget(object_label_);

  script_label_ = new UITextBoxWithLabel(UITextBoxWithLabel::Vertical);
  layout->addWidget(script_label_);


  QPushButton* button = new QPushButton("Save");
  connect(button, SIGNAL(clicked()), this, SLOT(save()));
  layout->addWidget(button);

  setLayout(layout);
  hide();
}
QmitkFileReaderWriterOptionsWidget::QmitkFileReaderWriterOptionsWidget(const Options& options, QWidget* parent)
  : QWidget(parent)
{
  Options filteredOptions = options;
  std::map<std::string, std::string> optionToDefaultValue;
  for(const auto & option : options)
  {
    const std::string& name = option.first;
    if (name.size() > 4 && name.substr(name.size() - 4) == "enum")
    {
      filteredOptions.erase(name);

      std::string nameWithoutEnum = name.substr(0, name.size() - 5);
      us::Any value = filteredOptions[nameWithoutEnum];
      if (!value.Empty())
      {
        optionToDefaultValue[nameWithoutEnum] = value.ToString();
      }
      filteredOptions[nameWithoutEnum] = option.second;
    }
  }

  auto  formLayout = new QFormLayout();
  for(Options::const_iterator iter = filteredOptions.begin(), iterEnd = filteredOptions.end();
      iter != iterEnd; ++iter)
  {
    formLayout->addRow(GetAnyWidgetLabel(iter->first),
                       GetAnyWidget(iter->first, iter->second, optionToDefaultValue[iter->first]));
  }

  this->setLayout(formLayout);
}
Example #19
0
    void Text::insertRow(const std::string& row, unsigned int position)
    {
        unsigned int totalRows = mRows.size();
        
        if(position >= totalRows)
        {
            if(position == totalRows)
            {
                addRow(row);
                return;
            }
            else
            {
                throw FCN_EXCEPTION("Position out of bounds!");
            }
        }
        
        unsigned int i;
        for(i = 0; i < row.size(); i++)
        {
            if(row[i] == '\n')
                throw FCN_EXCEPTION("Line feed not allowed in the row to be inserted!");
        }

        mRows.insert(mRows.begin() + position, row);
    }
/**
 * @brief
 *
 * @param _templatePosition
 */
void SalomeOptimizationDialog::fillTable(int _templatePosition)
{
    _isLoadingTable = true;
    if ((_selectedTemplate.isEmpty()) || (_templatePosition == -1) )
        return;

    int _templateNo = getPosMenu();
    if (_templateNo == -1)
        return;
    SalomeTemplateData _templateData;
    int _sizePredefinedTemplates = _templateManager.getTemplateNameList().size();

    if ( (_templatePosition <= _sizePredefinedTemplates ) && (_templateNo < _templateManager.getTemplates().size()) )
        _templateData = _templateManager.getTemplates().at(_templateNo);
    if ( (_templatePosition > _sizePredefinedTemplates ) && (_templateNo < _templateManager.getUserTemplates().size()) )
        _templateData = _templateManager.getUserTemplates().at(_templateNo);

    QList<SalomeVariableData> _variableList = _templateData.getVariableList();

    for (int i = 0; i < _variableList.size();i++)
        addRow(_variableList.at(i));

    ui->variablesListTable->resizeColumnsToContents();
    ui->variablesListTable->show();
    _isLoadingTable = false;

}
Example #21
0
void HModifyProd::on_pushButton_clicked()
{
    if (action==0)
    {

    if(updateRow())
        {
          getComponetsLot();
          QMessageBox::information(this,QApplication::applicationName(),"Riga modificata",QMessageBox::Ok);

        }
        else
        {
            QMessageBox::warning(this,QApplication::applicationName(),"MODERRORACCIO!!!\n" + db.lastError().text()  ,QMessageBox::Ok);
        }
    }
    else if (action==1)
    {
        if(addRow())
            {
              getComponetsLot();

            QMessageBox::information(this,QApplication::applicationName(),"Riga aggiunta",QMessageBox::Ok);

            }
            else
            {
                QMessageBox::warning(this,QApplication::applicationName(),"MODERRORINO!!!\n" + db.lastError().text()  ,QMessageBox::Ok);
            }
         action=0;
    }
    ui->pushButton_4->setEnabled(true);
    ui->pushButton_5->setEnabled(false);

}
Example #22
0
DlgPresence::DlgPresence(QWidget *parent) : QWidget(parent),m_Changed(false)
{
   setupUi(this);
   m_pView->setModel(PresenceStatusModel::instance());
   m_pUp->setIcon     ( KIcon( "go-up"       ) );
   m_pDown->setIcon   ( KIcon( "go-down"     ) );
   m_pAdd->setIcon    ( KIcon( "list-add"    ) );
   m_pRemove->setIcon ( KIcon( "list-remove" ) );
   connect(m_pAdd   , SIGNAL(clicked()),PresenceStatusModel::instance() ,SLOT(addRow())       );
   connect(m_pUp    , SIGNAL(clicked()),this                            ,SLOT(slotMoveUp())   );
   connect(m_pDown  , SIGNAL(clicked()),this                            ,SLOT(slotMoveDown()) );
   connect(m_pRemove, SIGNAL(clicked()),this                            ,SLOT(slotRemoveRow()));
   connect(this     , SIGNAL(updateButtons()) , parent                  ,SLOT(updateButtons()));
   connect(PresenceStatusModel::instance(),SIGNAL(dataChanged(QModelIndex,QModelIndex)),this,SLOT(slotChanged()));

   m_pView->horizontalHeader()->setResizeMode(0,QHeaderView::ResizeToContents);
   m_pView->horizontalHeader()->setResizeMode(1,QHeaderView::Stretch);
   for (int i=2;i<PresenceStatusModel::instance()->columnCount();i++) {
      m_pView->horizontalHeader()->setResizeMode(i,QHeaderView::ResizeToContents);
   }

   //Add an info tip in the account list
   m_pTipManager = new TipManager(m_pView);
   m_pTip = new Tip(i18n("In this table, it is possible to manage different presence states. "
   "The \"Message\" and \"Present\" values will be exported to the server for every accounts that support it. "
   "The other fields are designed to make presence status management easier. Please note that some SIP registrar "
   "have incomplete presence status (publishing) support."),this);
   m_pTip->setMaximumWidth(510);
   m_pTipManager->setCurrentTip(m_pTip);
}
/**
 * @brief
 *
 * @param arg1
 */
void VirtualRotatingDialog::on_numVirtualZonesSpinBox_valueChanged(int arg1)
{
    int _totalRows = ui->zoneInfoTable->rowCount();
    int _newZoneNo = arg1;
    int _cZoneNo = _totalRows;
    if (_newZoneNo > _cZoneNo) // We need to add new rows
    {
        int _noNewRows = _newZoneNo - _cZoneNo;
        for (int i = 0;i < _noNewRows;i++)
            addRow(_cZoneNo+i);

    }
    else{
        if (_newZoneNo < _cZoneNo) // We need to delete rows
        {            
            int _noDeletedRows = _cZoneNo -_newZoneNo;
            ui->numVirtualZonesSpinBox->blockSignals(true);
            for (int i = 0; i <= _noDeletedRows;i++)
                deleteRow(_totalRows - i);

            ui->numVirtualZonesSpinBox->blockSignals(false);
        }
    }

}
GoBuildConfigurationWidget::GoBuildConfigurationWidget(GoBuildConfiguration *bc)
    : NamedWidget(nullptr)
    , m_bc(bc)
{
    // Build UI
    auto mainLayout = new QVBoxLayout(this);
    mainLayout->setMargin(0);

    auto detailsWidget = new DetailsWidget();
    detailsWidget->setState(DetailsWidget::NoSummary);
    mainLayout->addWidget(detailsWidget);

    auto detailsInnerWidget = new QWidget();
    auto formLayout = new QFormLayout(detailsInnerWidget);
    detailsWidget->setWidget(detailsInnerWidget);

    m_buildDirectoryChooser = new PathChooser();
    formLayout->addRow(tr("Build directory:"), m_buildDirectoryChooser);

    // Connect signals
    connect(bc, &GoBuildConfiguration::buildDirectoryChanged,
            this, &GoBuildConfigurationWidget::updateUi);
    connect(m_buildDirectoryChooser, &PathChooser::pathChanged,
            this, &GoBuildConfigurationWidget::onPathEdited);

    setDisplayName(tr(Constants::C_GOBUILDCONFIGURATIONWIDGET_DISPLAY));
    updateUi();
}
EditStudiesInfosWidget::EditStudiesInfosWidget(const LinQedInClient* cl,QWidget* parent):EditInfosWidget(parent,
                                                                                                    tr("Modifica informazioni di studio"),
                                                                                                    cl){
    setAttribute(Qt::WA_DeleteOnClose);
    try{
        infos=dynamic_cast<const Studies*>(&getProfile().getInformationsBySectionName(Studies::getIDString()));
    }catch(const NoInfoException&){infos=0;}
    formWidget=new QFrame;
    form=new QFormLayout;
    highSchool=new QLineEdit; qualification=new QLineEdit;
    connect(highSchool,SIGNAL(returnPressed()),this,SLOT(saveRequest()));
    connect(qualification,SIGNAL(returnPressed()),this,SLOT(saveRequest()));
    form->addRow(tr("Scuola Superiore: "),highSchool); form->setAlignment(highSchool,Qt::AlignCenter);
    form->addRow(tr("Qualificazione Professionale: "),qualification); form->setAlignment(qualification,Qt::AlignCenter);
    initDegrees();

    noDegree=new QLabel(noDegreeS);
    noDegree->setStyleSheet(GUIStyle::errorLabelStyle());
    form->addWidget(noDegree); form->setAlignment(noDegree,Qt::AlignCenter);

    addDegree=new QPushButton(tr("Aggiungi Laurea"));
    addDegree->setCursor(QCursor(Qt::PointingHandCursor));
    form->addWidget(addDegree); form->setAlignment(addDegree,Qt::AlignCenter);
    connect(addDegree,SIGNAL(clicked()),this,SLOT(addRow()));

    formWidget->setLayout(form);
    addWidgetToMainLayout(formWidget,Qt::AlignCenter);
    initButtons();
    formWidget->setObjectName("form");
    formWidget->setStyleSheet("#form{"+GUIStyle::borderStyle()+"padding-left:10px;padding-top:10px;}");
    writeDefaultValues();
}//EditStudiesInfosWidget
Example #26
0
void TransakceForm::fillForm()
{
    ui->tableWidget->setColumnCount(3);
    ui->tableWidget->setRowCount(0);
    ui->tableWidget->setColumnWidth(0,150);
    ui->tableWidget->setColumnWidth(1,100);
    ui->tableWidget->setColumnWidth(2,250);
    QStringList labels; labels << tr("Konto") << tr("Částka") << tr("Poznámka");
    ui->tableWidget->setHorizontalHeaderLabels(labels);

    connect(ui->spnAmount,SIGNAL(valueChanged(int)),this,SLOT(checkAmount()));

    if(addingNew){
        ui->dateEdit->setDate(QDate::currentDate());
    } else {
        ui->dateEdit->setDate(transakce->getDatum());
        ui->spnAmount->setValue(transakce->getSum());

        QList<Transakce::Rozpis> r=transakce->getRozpis();
        QList<Transakce::Rozpis>::const_iterator i;
        for(i=r.constBegin(); i != r.constEnd(); ++i){
            addRow((*i).konto,(*i).amount,(*i).notice);
        }
    }
    checkAmount();
}
Example #27
0
void TreeView::setupToolbar()
{
	ActionManager *ac = Controller::create()->getActionManager();
	toolbar = new QToolBar();

	addRowAction = ac->getGlobalAction(Actions::ADD_NODE);
	toolbar->addAction(addRowAction);
	connect(addRowAction, SIGNAL(triggered()), this, SLOT(addRow()));

	addChildAction = ac->getGlobalAction(Actions::ADD_SUBNODE);
	toolbar->addAction(addChildAction);
	connect(addChildAction, SIGNAL(triggered()), this, SLOT(addChild()));

	removeAction = ac->getGlobalAction(Actions::REMOVE_NODE);
	toolbar->addAction(removeAction);
	connect(removeAction, SIGNAL(triggered()), questionFrame, SLOT(show()));

	toolbar->addSeparator();

	propertyAction = ac->getGlobalAction(Actions::SHOW_NODE_PROPERTIES);
	toolbar->addAction(propertyAction);
	connect(propertyAction, SIGNAL(triggered()), Controller::create()->getNodePropertyWidget(), SLOT(show()));

	welcomeAction = ac->getGlobalAction(Actions::SHOW_WELCOMEVIEW);
	toolbar->addAction(welcomeAction);
	connect(welcomeAction, SIGNAL(triggered(bool)), this, SLOT(showWelcomeView()));
}
Example #28
0
void TestLoad::rootElement_data()
{
    QTest::addColumn<QString>("input");
    QTest::addColumn<int>("output");
    QTest::addColumn<int>("outputRecursive");

    // Basic content
/*    addRow( "<msqrt></msqrt>", 1 );
    addRow( "<msqrt><mrow></mrow></msqrt>", 1 );
    addRow( "<msqrt><mi>x</mi></msqrt>", 1, 2 );
    addRow( "<msqrt><mrow><mi>x</mi></mrow></msqrt>", 2, 2 );*/
    addRow( "<mroot><mi>x</mi><mn>2</mn></mroot>", 2, 4 );

    // More complex content
/*    addRow( "<msqrt>"
            " <mi> x </mi>"
            " <mroot>"
            "  <mrow>"
            "   <mn> 2 </mn>"
            "   <mo> &InvisibleTimes </mn>"
            "   <mi> y </mi>"
            "  </mrow>"
            "  <mfrac>"
            "   <mn> 1 </mn>"
            "   <mn> 2 </mn>"
            "  </frac>"
            " </mroot>"
            "</msqrt", 1, 13 );*/
}
Example #29
0
void TreeView::setupToolbar(KActionCollection *actionCollection)
{
	toolbar = new QToolBar();

	addRowAction = actionCollection->addAction("addnode");
	addRowAction->setText(i18n("Add Node"));
	addRowAction->setIcon(KIcon("list-add"));
	toolbar->addAction(addRowAction);
	connect(addRowAction, SIGNAL(triggered()), this, SLOT(addRow()));

	addChildAction = actionCollection->addAction("addsubnode");
	addChildAction->setText(i18n("Add Subnode"));
	addChildAction->setIcon(KIcon("view-right-new"));
	toolbar->addAction(addChildAction);
	connect(addChildAction, SIGNAL(triggered()), this, SLOT(addChild()));

	removeAction = actionCollection->addAction("removenode");
	removeAction->setText(i18n("Remove Node"));
	removeAction->setIcon(KIcon("list-remove"));
	toolbar->addAction(removeAction);
	connect(removeAction, SIGNAL(triggered()), questionFrame, SLOT(show()));

	propertyAction = actionCollection->addAction("shownodeproperties");
	propertyAction->setText(i18n("Properties"));
	propertyAction->setIcon(KIcon("document-properties"));
	toolbar->addAction(propertyAction);
	connect(propertyAction, SIGNAL(triggered()), Controller::create()->getNodePropertyWidget(), SLOT(show()));
}
NonlinearPropertyFactoryGroupBox::NonlinearPropertyFactoryGroupBox(
        AbstractNonlinearPropertyFactory *model, const QString & title, QWidget *parent)
    : QGroupBox(title, parent), m_model(model)
{
    QGridLayout * layout = new QGridLayout;

    // Add push button
    QPushButton *pushButton = new QPushButton(QIcon(":/images/list-add.svg"), tr("Add"));
    connect(pushButton, SIGNAL(clicked()),
             this, SLOT(addRow()));
    layout->addWidget(pushButton, 0, 0);

    // Remove push button
    m_removeButton = new QPushButton(QIcon(":/images/list-remove.svg"), tr("Remove"));
    m_removeButton->setEnabled(false);
    connect(m_removeButton, SIGNAL(clicked()),
             this, SLOT(removeRow()));
    layout->addWidget(m_removeButton, 0, 1);

    // List view
    m_view = new QListView;
    m_view->setSelectionMode(QAbstractItemView::SingleSelection);
    m_view->setModel(m_model);

    connect(m_view->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
            this, SLOT(updateCurrent(QModelIndex,QModelIndex)));
    connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)),
            this, SLOT(modelsInserted(QModelIndex,int,int)));

    layout->addWidget(m_view, 1, 0, 1, 3);
    setLayout(layout);
}