Esempio n. 1
0
// get speaker's themes by language
QTableWidget *PublicTalks::getSpeakerPublicTalks(int kieli_id, int personid, QString select) {
    QTableWidget *table = new QTableWidget(0,3);
    table->verticalHeader()->setVisible(false);

    //sitten vectoriin kaikki aiheet
    std::vector<sql_item> q;
//    q = sql.selectSql("SELECT * FROM Esitelmat, P_esitelmat WHERE Esitelmat.kieli_id = '"+ kielet[0].getValue("id") +"'"
//                      " AND Esitelmat.aihe_id = P_esitelmat.aihe_id"
//                      " AND P_esitelmat.puhuja_id = '" + QString::number(personid) + "'");
    q = sql.selectSql("SELECT Esitelmat.*, P_esitelmat.puhuja_id, yleisokokous.pvm FROM Esitelmat "
                      "LEFT JOIN yleisokokous ON Esitelmat.aihe_id = yleisokokous.aihe_id "
                      "LEFT JOIN P_esitelmat ON Esitelmat.aihe_id = P_esitelmat.aihe_id "
                      "WHERE P_esitelmat.puhuja_id = '" + QString::number(personid) + "' "
                      "AND Esitelmat.kieli_id = '"+ langId +"' "
                      "GROUP BY Esitelmat.aihe_id ORDER BY Esitelmat.aihe_id");
    table->setRowCount(q.size()+1);
    for(unsigned int i = 0; i < q.size(); i++) {

        int value = QVariant(q[i].getValue("aihe_id")).toInt();
        QTableWidgetItem *item = new QTableWidgetItem();
        item->setData(Qt::DisplayRole,value);
        table->setItem(i+1,0,item);
        //table->setItem(i+1,0,new QTableWidgetItem(q[i].getValue("aihe_id")));
        table->setItem(i+1,1,new QTableWidgetItem(q[i].getValue("aihe")));
        if(table->item(i+1,1)->text() == select) {
            QFont boldfont(table->item(i+1,1)->font().family(),
                           table->item(i+1,1)->font().pointSize(),
                           QFont::Bold);
            table->item(i+1,1)->setFont(boldfont);
        }
        table->setItem(i+1,2,new QTableWidgetItem(q[i].getValue("pvm")));
    }

    return table;
}
void MainWindow::on_showMoreButton_clicked()
{
        if(currSelectedID.toInt() > 0){
            QString imgPath = "images/";
            QTableWidget *current = new QTableWidget;
            if(whatList){
                ui->listOfSci->setHidden(1);
                imgPath += "scientists/";
                current = ui->listOfSci;
            }
            else{
                ui->listOfComps->setHidden(1);
                imgPath += "computers/";
                current = ui->listOfComps;
            }

            imgPath += currSelectedID + ".jpg";
            QPixmap thing(imgPath);
            ui->pictureLable->setScaledContents(true);
            ui->pictureLable->setPixmap(thing);

            displayConnections(currSelectedID);
            fillComboConn();

            int row = currSelectedRow;
            ui->more1->setText(current->item(row, 1)->text());
            ui->more2->setText(current->item(row, 2)->text());
            ui->more3->setText(current->item(row, 3)->text());
            ui->more4->setText(current->item(row, 4)->text());
            ui->more5->setText(current->item(row, 5)->text());
            ui->moreUI->setVisible(1);
    }

    return;
}
Esempio n. 3
0
void ListingTracePane::setDebuggingState(bool b)
{
    QTableWidget *tableWidget;
    if (Sim::trapped) {
        tableWidget = ui->listingPepOsTraceTableWidget;
        ui->listingPepOsTraceTableWidget->show();
        ui->listingTraceTableWidget->hide();
    }
    else {
        tableWidget = ui->listingTraceTableWidget;
        ui->listingPepOsTraceTableWidget->hide();
        ui->listingTraceTableWidget->show();
    }

    for (int i = 0; i < tableWidget->rowCount(); i++) {
        tableWidget->item(i, 1)->setBackgroundColor(Qt::white);
        tableWidget->item(i, 1)->setTextColor(Qt::black);
    }
    highlightedItemList.clear();
    
    if (b && Pep::memAddrssToAssemblerListing->contains(Sim::programCounter)) {
        QTableWidgetItem *highlightedItem = tableWidget->item(Pep::memAddrssToAssemblerListing->value(Sim::programCounter), 1);
        highlightedItem->setBackgroundColor(QColor(56, 117, 215));
        highlightedItem->setTextColor(Qt::white);
        highlightedItemList.append(highlightedItem);

        tableWidget->scrollToItem(highlightedItem);
    }
    tableWidget->horizontalScrollBar()->setValue(tableWidget->horizontalScrollBar()->minimum());
//    resizeDocWidth();
}
Esempio n. 4
0
QVector<QVariantList> DebugPanel::getBreakpoints()
{
    QTableWidget *table = ui->breakpointTableWidget;
    QVector<QVariantList> breakpoints;
    for (int row = 0; row < table->rowCount(); row++) {
        QVariantList bp;
        QCheckBox *cb = static_cast<QCheckBox *>(table->cellWidget(row,0));
        if (cb->isChecked()) {
            QTableWidgetItem *item = table->item(row,1);
            bp << item->data(Qt::DisplayRole).toString();
			if (bp.back().toString() == "instr" ) {
				item = table->item(row,2);
				bp << item->data(Qt::DisplayRole).toDouble();
				item = table->item(row,3);
				bp << item->data(Qt::DisplayRole).toInt();
				breakpoints.append(bp);
			} else {
				item = table->item(row,2);
				QStringList parts = item->data(Qt::DisplayRole).toString().split(":");
				Q_ASSERT(parts.size() == 2);
				bp << parts[0].toInt();
				bp << parts[1].toInt();
				item = table->item(row,3);
				bp << item->data(Qt::DisplayRole).toInt();
				breakpoints.append(bp);
			}
        }
    }
    return breakpoints;
}
Esempio n. 5
0
void TableView::coloringRows(QList<double> x,int start,int end)
{
    QList<QColor> colors;
    colors << QColor(255,255,255) << QColor(255,0,0) << QColor(0,255,0) << QColor(0,0,255) << QColor(255,255,0);
    QTableWidget* table =  getTableWidget();
    if(start<0||start>table->columnCount())
    {
        start = 0;
    }
    if(end<0||end>table->columnCount())
    {
        end = table->columnCount();
    }
    if(0!=table){
        for(int i=0;i<x.length();i++)
        {
            if(table->item(i,0))
            {
                for(int j=start;j<end;j++)
                {
                    int idx = ((int)x[i])%colors.length();
                    table->item(i,j)->setBackgroundColor( colors[idx]);

                }
            }
        }
    }
}
Esempio n. 6
0
void Table::setItemEditable(int row, int column, bool editable)
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    if(editable)
        tablewidget->item(row, column)->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable);
    else
        tablewidget->item(row, column)->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
Esempio n. 7
0
void AccountWindow::setAccountToRow(uint row, Account &account)
{
	QTableWidget *pTable = TableWindow::getTable();

  pTable->item(row, Username)->setText(account.username());
  pTable->item(row, Contest)->setText(Account::typeAsString(account.type()));
  pTable->item(row, Description)->setText(account.description());
}
Esempio n. 8
0
void MainWindow::updateRow(int i, Persona *p)
{
    QTableWidget *t = ui->tableWidget;
    t->item(i, 1)->setText(p->nombre());
    t->item(i, 2)->setText(p->direccion());
    t->item(i, 3)->setText(p->telefono());
    t->item(i, 4)->setText(p->email());
}
Esempio n. 9
0
void GlobePlugin::elevationLayersChanged()
{
  if ( mIsGlobeRunning )
  {
    QgsDebugMsg( "elevationLayersChanged: Globe Running, executing" );
    osg::ref_ptr<Map> map = mMapNode->getMap();

    if ( map->getNumElevationLayers() > 1 )
    {
      mOsgViewer->getDatabasePager()->clear();
    }

    // Remove elevation layers
    ElevationLayerVector list;
    map->getElevationLayers( list );
    for ( ElevationLayerVector::iterator i = list.begin(); i != list.end(); ++i )
    {
      map->removeElevationLayer( *i );
    }

    // Add elevation layers
    QSettings settings;
    QString cacheDirectory = settings.value( "cache/directory", QgsApplication::qgisSettingsDirPath() + "cache" ).toString();
    QTableWidget* table = mSettingsDialog->elevationDatasources();
    for ( int i = 0; i < table->rowCount(); ++i )
    {
      QString type = table->item( i, 0 )->text();
      //bool cache = table->item( i, 1 )->checkState();
      QString uri = table->item( i, 2 )->text();
      ElevationLayer* layer = 0;

      if ( "Raster" == type )
      {
        GDALOptions options;
        options.url() = uri.toStdString();
        layer = new osgEarth::ElevationLayer( uri.toStdString(), options );
      }
      else if ( "TMS" == type )
      {
        TMSOptions options;
        options.url() = uri.toStdString();
        layer = new osgEarth::ElevationLayer( uri.toStdString(), options );
      }
      map->addElevationLayer( layer );

      //if ( !cache || type == "Worldwind" ) layer->setCache( 0 ); //no tms cache for worldwind (use worldwind_cache)
    }
#if OSGEARTH_VERSION_GREATER_OR_EQUAL( 2, 5, 0 )
    double scale = QgsProject::instance()->readDoubleEntry( "Globe-Plugin", "/verticalScale", 1 );
    setVerticalScale( scale );
#endif
  }
  else
  {
    QgsDebugMsg( "layersChanged: Globe NOT running, skipping" );
    return;
  }
}
Esempio n. 10
0
void UIUtil::insertMatInQtable(Mat &mat, QTableWidget &table) {
  for (int row = 0; row < mat.size().height; row++) {
    for (int col = 0; col < mat.size().width; col++) {
      if (table.item(row, col) == 0)
        table.setItem(row, col, new QTableWidgetItem());
      table.item(row, col)->setText(QString::number(mat.at<double>(row, col), 'g', 15));
    }
  }
}
Esempio n. 11
0
void MainWindow::slotMount()
{
	QTableWidget * table = m_ui->tableWidget ;
	int row = table->currentRow() ;
	QString device = table->item( row,0 )->text() ;
	QString type   = table->item( row,2 )->text() ;
	QString label  = table->item( row,3 )->text() ;
	this->mount( type,device,label ) ;
}
Esempio n. 12
0
Mat UIUtil::getMatFromQtable(QTableWidget &table) {
  Mat_<double> mat(table.rowCount(), table.columnCount());
  for (int row = 0; row < table.rowCount(); row++) {
    for (int col = 0; col < table.columnCount(); col++) {
      if (table.item(row, col) != NULL)
        mat(row, col) = table.item(row, col)->text().toDouble();
      else
        mat(row, col) = 0;
    }
  }
  return mat;
}
Esempio n. 13
0
void tablewidget::selectTableRow( QTableWidgetItem * current,QTableWidgetItem * previous )
{
	QTableWidget * table ;

	int col = 0 ;
	int i   = 0 ;
	int j   = 0 ;

	if( current && previous ){

		if( previous->row() == current->row() ){
			table = current->tableWidget() ;
			table->setCurrentCell( current->row(),table->columnCount() - 1 ) ;
			table->setFocus() ;
			return ;
		}
	}

	if( current ){

		table = current->tableWidget() ;

		if( table->rowCount() > 0 ){

			col = table->columnCount() ;
			j = current->row() ;

			for( i = 0 ; i < col ; i++ ){
				table->item( j,i )->setSelected( true ) ;
			}
		}

		table->setCurrentCell( j,table->columnCount() -1 ) ;
		table->setFocus() ;
	}

	if( previous ){

		table = previous->tableWidget() ;

		if( table->rowCount() > 0 ){

			col = table->columnCount() ;
			j = previous->row() ;

			for( i = 0 ; i < col ; i++ ){
				table->item( j,i )->setSelected( false ) ;
			}
		}

		table->setFocus() ;
	}
}
Esempio n. 14
0
ItemTagsLoader::Tag ItemTagsLoader::tagFromTable(int row)
{
    QTableWidget *t = ui->tableWidget;

    Tag tag;
    tag.name = t->item(row, tagsTableColumns::name)->text();
    const QColor color =
            cellWidgetProperty(t, row, tagsTableColumns::color, propertyColor).value<QColor>();
    tag.color = serializeColor(color);
    tag.icon = cellWidgetProperty(t, row, tagsTableColumns::icon, "currentIcon").toString();
    tag.styleSheet = t->item(row, tagsTableColumns::styleSheet)->text();
    tag.match = t->item(row, tagsTableColumns::match)->text();
    return tag;
}
Esempio n. 15
0
QList<double> TableView::getColumn(int id)
{
    QList<double> res;
    QTableWidget* table =  getTableWidget();
    if(0!=table)
    {
        if(id>getColumnCount()&&id<0)
        {
            return res;
        }
        bool isOk = false;
        for(int i=0;i<getRowCount();i++)
        {

            QTableWidgetItem* wi = table->item(i,id);
            if(!wi)
                continue;
            double dat = wi->data(Qt::DisplayRole).toDouble(&isOk);
            if(isOk){
                res.push_back(dat);
            }
        }

        return res;
    }
    return res;
}
Esempio n. 16
0
QList<QList<double> > TableView::getColumns(int id0,int id1,int id2,int id3)
{
    QList<QList<double> > list;

    QTableWidget* table =  getTableWidget();
    if(0!=table)
    {
        for(int i=0;i<getRowCount();i++)
        {

            bool isOk = false;
            QList<double> small;
            for(int j=0;j<getColumnCount();j++)
            {
                if(j==id0||j==id1||j==id2||j==id3)
                {
                    QTableWidgetItem* wi = table->item(i,j);
                    if(!wi)
                        continue;
                    double dat = wi->data(Qt::DisplayRole).toDouble(&isOk);
                    if(isOk){
                        small.push_back(dat);
                    }
                }
            }
            list.push_back(small);
        }

    }

    return list;
}
Esempio n. 17
0
void model_import_dlg::on_color_pick()
{
	QTableWidget * table = mesh_tab->findChild<QTableWidget*>("colorsTable");

	int row = table->currentRow();
	int r = table->item(row, 0)->text().toInt();
	int g = table->item(row, 1)->text().toInt();
	int b = table->item(row, 2)->text().toInt();

	QColor color(r, g, b);
	color = QColorDialog::getColor(color, this, "Pick color");

	table->item(row, 0)->setText(QString::number(color.red()));
	table->item(row, 1)->setText(QString::number(color.green()));
	table->item(row, 2)->setText(QString::number(color.blue()));
}
Esempio n. 18
0
void model_import_dlg::on_texture_dialog_done(bool add, QString path, QString type)
{
	QTableWidget * table = mesh_tab->findChild<QTableWidget*>("texturesTable");

	int row = 0;

	if (add)
	{
		row = table->rowCount();
		table->insertRow(row);
	}
	else
	{
		row = table->currentRow();
	}

	table->setItem(row, 0, new QTableWidgetItem(path));
	table->setItem(row, 1, new QTableWidgetItem(type));
	table->setColumnWidth(0, 350);
	table->setColumnWidth(1, 150);

	for (int i = 0; i < table->rowCount(); i++)
		for (int j = 0; j < table->columnCount(); j++)
			table->item(i, j)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
}
int FAT_IRSALIYE_SATIR_SECIMI::SINGLE_LINE_SELECTED ( int p_selected_row_number )
{
    QTableWidget * tableWidget = GET_TABLE_WIDGET();

    *m_secilen_id = tableWidget->item ( p_selected_row_number, IRSALIYE_SATIRI_ID_COLUMN )->text().toInt();
    return ADAK_EXIT;
}
Esempio n. 20
0
QTableWidget* DatabaseView::snapshotsTable()
{
	if(tables.find(SNAPSHOTS) != tables.end())
	{
		return tables[SNAPSHOTS].second;
	}

	QList<Snapshot> snapslist = Database::getInstance().getSnapshots();
	QTableWidget *table;
	const QSize previewSize = QSize(64,64);
	table = new QTableWidget(snapslist.count(), 6);
	table->setIconSize(previewSize);
	table->setHorizontalHeaderLabels(QStringList()<<"Снимок"<<"Ширина"<<"Высота"<<"Дата"<<"На сцене"<<"hidden");
	table->setSelectionBehavior(QAbstractItemView::SelectRows);
	int row = 0;
	QByteArray imageBytes;
	foreach(Snapshot snapshot,snapslist)
	{
		table->setItem(row, 0, new QTableWidgetItem(QPixmap::fromImage(snapshot.image.scaled(previewSize,Qt::KeepAspectRatio)),""));		
		table->setItem(row, 1, new QTableWidgetItem(QString("%1").arg(snapshot.width)));
		table->setItem(row, 2, new QTableWidgetItem(QString("%1").arg(snapshot.height)));
		table->setItem(row, 3, new QTableWidgetItem(snapshot.created.toString()));
		table->setItem(row, 4, new QTableWidgetItem(snapshot.in_scene ? "Да" : "Нет"));
		table->setItem(row, 5, new QTableWidgetItem(QString("%1").arg(snapshot.id)));
		table->verticalHeader()->resizeSection(row, previewSize.height());
		for(int i = 0; i < 4; i++)
			table->item(row,i)->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
		row++;
	}
Esempio n. 21
0
void ItemTagsLoader::addTagToSettingsTable(const ItemTagsLoader::Tag &tag)
{
    QTableWidget *t = ui->tableWidget;

    const int row = t->rowCount();

    t->insertRow(row);
    t->setItem( row, tagsTableColumns::name, new TagTableWidgetItem(tag.name) );
    t->setItem( row, tagsTableColumns::match, new QTableWidgetItem(tag.match) );
    t->setItem( row, tagsTableColumns::styleSheet, new QTableWidgetItem(tag.styleSheet) );
    t->setItem( row, tagsTableColumns::color, new QTableWidgetItem() );
    t->setItem( row, tagsTableColumns::icon, new QTableWidgetItem() );

    auto colorButton = new QPushButton(t);
    const QColor color = tag.color.isEmpty()
            ? QColor::fromRgb(50, 50, 50)
            : deserializeColor(tag.color);
    setColorIcon(colorButton, color);
    t->setCellWidget(row, tagsTableColumns::color, colorButton);
    connect(colorButton, &QAbstractButton::clicked, this, &ItemTagsLoader::onColorButtonClicked);

    auto iconButton = new IconSelectButton(t);
    iconButton->setCurrentIcon(tag.icon);
    t->setCellWidget(row, tagsTableColumns::icon, iconButton);
    connect(iconButton, &IconSelectButton::currentIconChanged, this, &ItemTagsLoader::onAllTableWidgetItemsChanged);

    onTableWidgetItemChanged(t->item(row, 0));
}
Esempio n. 22
0
void SkillEditFrame::onCurrentItemChanged(DataContainerItem *current) {
	if (current == 0)
		return;
	QTableWidget *skillTable = this->findChild<QTableWidget *>("skillTable");
	DataContainerItem *item = current;
	if (item->getStringData().size() > 0) {
		StatsContainer *skill = GenStatsReader::getContainer(*skillStats, item->getStringData());
		if (skill != 0) {
			typedef std::map<std::string, std::string> StringMap;
			StringMap dataMap = skill->getBaseDataMap();
			for (int i=0; i<skillTable->rowCount(); ++i) {
				for (int j=0; j<skillTable->columnCount(); ++j) {
					delete skillTable->item(i, j);
				}
			}
			
			skillTable->setRowCount(0);
			int row = 0;
			for (StringMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it) {
				QTableWidgetItem *nameItem = new QTableWidgetItem();
				nameItem->setText(it->first.c_str());
				QTableWidgetItem *valueItem = new QTableWidgetItem();
				valueItem->setText(it->second.c_str());
				skillTable->insertRow(row);
				skillTable->setItem(row, 0, nameItem);
				skillTable->setItem(row, 1, valueItem);
				++row;
			}

			skillTable->resizeRowsToContents();
			skillTable->resizeColumnsToContents();
		}
	}
}
Esempio n. 23
0
void ListingTracePane::updateListingTrace()
{
    // tableWidget depends on whether we are in the OS or a program
    QTableWidget *tableWidget;
    if (Sim::trapped) {
        tableWidget = ui->listingPepOsTraceTableWidget;
        ui->listingPepOsTraceTableWidget->show();
        ui->listingTraceTableWidget->hide();
    }
    else {
        tableWidget = ui->listingTraceTableWidget;
        ui->listingPepOsTraceTableWidget->hide();
        ui->listingTraceTableWidget->show();
    }

    for (int i = highlightedItemList.size() - 1; i >= 0; i--) {
        highlightedItemList.at(i)->setBackgroundColor(Qt::white);
        highlightedItemList.at(i)->setTextColor(Qt::black);
        highlightedItemList.removeLast();
    }
    if (Pep::memAddrssToAssemblerListing->contains(Sim::programCounter)) {
        QTableWidgetItem *highlightedItem = tableWidget->item(Pep::memAddrssToAssemblerListing->value(Sim::programCounter), 1);
        highlightedItem->setBackgroundColor(QColor(56, 117, 215));
        highlightedItem->setTextColor(Qt::white);
        highlightedItemList.append(highlightedItem);

        tableWidget->scrollToItem(highlightedItem);
    }
    tableWidget->horizontalScrollBar()->setValue(tableWidget->horizontalScrollBar()->minimum());
}
Esempio n. 24
0
void ParamCompareDialog::checkAll()
{
    QLOG_DEBUG() << " check uncheck all parameters";
    QTableWidget* table = ui->compareTableWidget;

    if(ui->checkAllBox->isChecked()){
        for(int rowCount = 0; rowCount < table->rowCount(); ++rowCount){
            QTableWidgetItem* item = table->item(rowCount, PCD_COLUMN_CHECKBOX);
            if (item) item->setCheckState(Qt::Checked);
        }
    } else {
        for(int rowCount = 0; rowCount < table->rowCount(); ++rowCount){
            QTableWidgetItem* item = table->item(rowCount, PCD_COLUMN_CHECKBOX);
            if (item) item->setCheckState(Qt::Unchecked);
        }
    }
}
Esempio n. 25
0
void Recepcjonista::on_modyfikuj_klienta_Button_clicked()
{
    QTableWidget* tw = ui->klienci_tableWidget;
    string pesel = tw->item(chosenClientIndex, 0)->text().toStdString();
    string imie =  tw->item(chosenClientIndex, 1)->text().toStdString();
    string nazwisko =  tw->item(chosenClientIndex, 2)->text().toStdString();
    string adres =  tw->item(chosenClientIndex, 3)->text().toStdString();
    string nr_telefonu =  tw->item(chosenClientIndex, 4)->text().toStdString();
    string email =  tw->item(chosenClientIndex, 5)->text().toStdString();

    string miasto;
    string ulica;
    string nrbudynku;
    string kod;

    int i=0;
    while(adres[i] != ' ')
    {
        miasto.append(&adres[i]);
        i++;
    }
    i++;
    while(adres[i] != ' ')
    {
        ulica.append(&adres[i]);
        i++;
    }
    i++;
    while(adres[i] != ' ')
    {
        nrbudynku.append(&adres[i]);
        i++;
    }
    i++;
    while(adres[i] != ' ')
    {
        kod.append(&adres[i]);
        i++;
    }
    i++;
    QString s = "%1";
    QString s1 = s.arg(id_pracownika);
    string query = "UPDATE klient SET ('"+pesel+"','"+imie+"','"+nazwisko+"','"+miasto+"','"+kod+"','"+ulica+"',"+ nrbudynku +"," + nr_telefonu + ",'"+ email+"',"+s1.toStdString()+")";
    bool retval = mSQL->exec(query);

}
Esempio n. 26
0
QVariantMap ItemSyncLoader::applySettings()
{
    // Apply settings from tab sync path table.
    QTableWidget *t = ui->tableWidgetSyncTabs;
    QStringList tabPaths;
    m_tabPaths.clear();
    for (int row = 0; row < t->rowCount(); ++row) {
        const QString tabName = t->item(row, syncTabsTableColumns::tabName)->text();
        if ( !tabName.isEmpty() ) {
            const QString tabPath = t->item(row, syncTabsTableColumns::path)->text();
            tabPaths << tabName << tabPath;
            m_tabPaths.insert(tabName, tabPath);
        }
    }
    m_settings.insert(configSyncTabs, tabPaths);

    // Apply settings from file format table.
    t = ui->tableWidgetFormatSettings;
    QVariantList formatSettings;
    m_formatSettings.clear();
    for (int row = 0; row < t->rowCount(); ++row) {
        FileFormat fileFormat;
        fileFormat.extensions = t->item(row, formatSettingsTableColumns::formats)->text()
                .split( QRegExp("[,;\\s]"), QString::SkipEmptyParts );
        fileFormat.itemMime = t->item(row, formatSettingsTableColumns::itemMime)->text();
        if ( fileFormat.extensions.isEmpty() && fileFormat.itemMime.isEmpty() )
            continue;
        fileFormat.icon = t->cellWidget(row, formatSettingsTableColumns::icon)
                ->property("currentIcon").toString();

        QVariantMap format;
        format["formats"] = fileFormat.extensions;
        format["itemMime"] = fileFormat.itemMime;
        format["icon"] = fileFormat.icon;
        formatSettings.append(format);

        fixUserExtensions(&fileFormat.extensions);
        fixUserMimeType(&fileFormat.itemMime);
        m_formatSettings.append(fileFormat);
    }
    m_settings.insert(configFormatSettings, formatSettings);

    return m_settings;
}
Esempio n. 27
0
void Table::setItem(int row, int column, std::string text, bool suppressSignals)
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    bool oldSignalsState = tablewidget->blockSignals(suppressSignals);
    QTableWidgetItem *item = tablewidget->item(row, column);
    if(!item) item = new QTableWidgetItem;
    item->setText(QString::fromStdString(text));
    tablewidget->setItem(row, column, item);
    tablewidget->blockSignals(oldSignalsState);
}
Esempio n. 28
0
//Это нужно вынести в отдельный класс!
//--->
void MainWindow::fillYearTable(QTableWidget& tableYear)
{
    int j = 0;
    QTableWidgetItem *newItem;
    tableYear.setColumnCount(1);
    for(int i = PASTYEARS; i < FUTUREYEARS; i++)
    {
        tableYear.insertRow(j);
        newItem = new QTableWidgetItem();
        newItem->setText(QString::number(selDate_.year() + i));
        tableYear.setItem(j, 0, newItem);
        if((selDate_.year() + i) == selDate_.year())
            tableYear.item(j, 0)->setBackground(Qt::red);
        else
            tableYear.item(j, 0)->setBackground(Qt::cyan);
        j++;
    }
    standartStuffForAllTables(*ui->twYear);
}
Esempio n. 29
0
void MainWindow::fillMonthTable(QTableWidget& tableMonth)
{
    int j = 0;
    QTableWidgetItem *newItem;
    tableMonth.setColumnCount(1);
    for(int i = 1; i < MONTHS+1; i++)
    {
        tableMonth.insertRow(j);
        newItem = new QTableWidgetItem();
        newItem->setText(QString::number(i));
        tableMonth.setItem(j, 0, newItem);
        if(i == selDate_.month())
            tableMonth.item(j, 0)->setBackground(Qt::red);
        else
            tableMonth.item(j, 0)->setBackground(Qt::magenta);
        j++;
    }
    standartStuffForAllTables(*ui->twMonth);
}
Esempio n. 30
0
void MainWindow::actualizarSeleccionado()
{
    Persona *p = selectedPersona;
    QTableWidget * t = ui->tableWidget;
    for (int i = 0; i < t->rowCount(); i++) {
        if (t->item(i, 0)->text().toLong() == p->id()) {
            updateRow( i, p);
        }
    }
}