void MainWindow::standartStuffForAllTables(QTableWidget& table) { table.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); table.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); table.setEditTriggers(QAbstractItemView::NoEditTriggers); table.verticalHeader()->hide(); table.horizontalHeader()->hide(); table.setEditTriggers(QAbstractItemView::NoEditTriggers); table.setSelectionMode(QAbstractItemView::NoSelection); table.setFocusPolicy(Qt::NoFocus); }
QTableWidget *StManagerStudyListComp::createStudyTable () { QTableWidget *table = new QTableWidget; table->setSelectionBehavior( QAbstractItemView::SelectRows ); table->setSelectionMode( QAbstractItemView::SingleSelection ); table->setEditTriggers( QAbstractItemView::NoEditTriggers ); QStringList labels; for ( int i = 0; i < ATTRIBUTE_NUMBER; i++ ) { labels << tr( attributeNames[i] ); } table->setColumnCount( labels.size() + 1 ); table->setHorizontalHeaderLabels( labels ); table->setColumnHidden( ATTRIBUTE_NUMBER, true ); for ( int i = 0; i < ATTRIBUTE_NUMBER; i++ ) { if ( attributeResizes[i] ) { table->horizontalHeader()->setResizeMode( i, QHeaderView::ResizeToContents ); } } connect( table, SIGNAL(itemSelectionChanged()), this, SLOT(setEnabledView()) ); connect( table, SIGNAL(itemDoubleClicked( QTableWidgetItem * )), this, SLOT(view()) ); return table; }
void QgsMessageLogViewer::logMessage( QString message, QString tag, QgsMessageLog::MessageLevel level ) { #ifdef ANDROID mCount++; #else mButton->setToolTip( tr( "%1 message(s) logged." ).arg( mCount++ ) ); #endif if ( !isVisible() && level > QgsMessageLog::INFO ) { mButton->show(); if ( mShowToolTips ) QToolTip::showText( mButton->mapToGlobal( QPoint( 0, 0 ) ), mButton->toolTip() ); } if ( tag.isNull() ) tag = tr( "General" ); int i; for ( i = 0; i < tabWidget->count() && tabWidget->tabText( i ) != tag; i++ ) ; QTableWidget *w; if ( i < tabWidget->count() ) { w = qobject_cast<QTableWidget *>( tabWidget->widget( i ) ); tabWidget->setCurrentIndex( i ); } else { w = new QTableWidget( 0, 3, this ); w->verticalHeader()->setDefaultSectionSize( 16 ); w->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents ); w->verticalHeader()->setVisible( false ); w->setGridStyle( Qt::DotLine ); w->setEditTriggers( QAbstractItemView::NoEditTriggers ); w->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel ); w->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel ); w->setHorizontalHeaderLabels( QStringList() << tr( "Timestamp" ) << tr( "Message" ) << tr( "Level" ) ); tabWidget->addTab( w, tag ); tabWidget->setCurrentIndex( tabWidget->count() - 1 ); } int n = w->rowCount(); w->setRowCount( n + 1 ); QTableWidgetItem *item = new QTableWidgetItem( QDateTime::currentDateTime().toString( Qt::ISODate ) ); w->setItem( n, 0, item ); w->setItem( n, 1, new QTableWidgetItem( message ) ); w->setItem( n, 2, new QTableWidgetItem( QString::number( level ) ) ); w->scrollToBottom(); w->horizontalHeader()->resizeSections( QHeaderView::ResizeToContents ); }
QTableWidget *StManagerStudyListComp::createSeriesSelectionTable () { QTableWidget *seriesTable = new QTableWidget; seriesTable->setSelectionMode( QAbstractItemView::SingleSelection ); seriesTable->setEditTriggers( QAbstractItemView::NoEditTriggers ); seriesTable->setColumnCount( 1 ); seriesTable->horizontalHeader()->setResizeMode( QHeaderView::Stretch ); seriesTable->horizontalHeader()->hide(); return seriesTable; }
void Table::setEditable(bool editable) { QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget()); if(editable) { // TODO } else { tablewidget->setEditTriggers(QAbstractItemView::NoEditTriggers); } }
TableView::TableView(QObject * parent):VisualNode(parent) { _realcount=0; this->_widget = new visual::ui::QTableWidgetCopy(_invisibleParent); QTableWidget* table = getTableWidget(); if(0!=table){ table->setEditTriggers(QTableWidget::NoEditTriggers); table->setFocusPolicy(Qt::NoFocus); } //setHeader("Col1;Col2;Col3"); }
void ParameterWin::creatTableItem(command_attr_t *commands, quint16 size) { QVector <command_attr_t *> cVector; QStringList table; qDebug() << "command size = " << size; for (int i = 0; i < size; ++i) { if (!commands[i].tableName.isEmpty()) { if (!table.contains(commands[i].tableName)) { table.append(commands[i].tableName); } } } for (int i = 0; i < table.size(); ++i) { cVector.clear(); for (int j = 0; j < size; ++j) { if (commands[j].tableName == table.at(i)) { cVector.append(&commands[j]); } } QTableWidget *tableWidget = new QTableWidget; tableWidgetVector.append(tableWidget); QStringList row, column; for (int i = 0; i < cVector.size(); ++i) { if (!column.contains(cVector[i]->paraName)) { column << cVector[i]->paraName; } if (!row.contains(cVector[i]->columnName)) { row << cVector[i]->columnName; } } tableWidget->setColumnCount(row.size()); tableWidget->setRowCount(column.size()); tableWidget->setHorizontalHeaderLabels(row); tableWidget->setVerticalHeaderLabels(column); for (int i = 0, k = 0; i < row.size(); ++i) { for (int j = 0; j < column.size(); ++j) { Cell *item = new Cell(cVector[k]); item->setTextAlignment(Qt::AlignCenter); item->setToolTip(cVector[k]->comment); item->setText(cVector[k++]->paraValue.toString()); tableWidget->setItem(j, i, item); } } connect(tableWidget, SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(somethingChanged(QTableWidgetItem *))); if ((cVector[0]->paraAttr&WRITE) != WRITE) { tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); } tabWidget->addTab(tableWidget, cVector[0]->tableName); } }
void initNogoodTable(QTableWidget& ng_table) { ng_table.setEditTriggers(QAbstractItemView::NoEditTriggers); ng_table.setColumnCount(3); QStringList table_header; table_header << "Id" << "Occurrence" << "Literals"; ng_table.setHorizontalHeaderLabels(table_header); ng_table.setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); ng_table.setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); }
AccountWindow::AccountWindow(QWidget* parent, const QString &name, Qt::WindowFlags wflags) :TableWindow(parent, name, wflags) { QStringList nameList; QTableWidget *pTable; QAction* pAction; pTable = TableWindow::getTable(); m_pDb = ISql::pInstance(); pAction = new QAction(tr("&New..."), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_new())); MDIWindow::addAction(pAction); pAction = new QAction(tr("&Edit..."), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_edit())); MDIWindow::addAction(pAction, true); pAction = new QAction(tr("&Delete"), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_delete())); MDIWindow::addAction(pAction); pAction = new QAction(this); pAction->setSeparator(true); MDIWindow::addAction(pAction); pAction = new QAction(tr("&Export all..."), this); connect(pAction, SIGNAL(triggered()), this, SLOT(exportTable())); MDIWindow::addAction(pAction); // configure the table TableWindow::setWindowIcon(QIcon(":/document.xpm")); pTable->setEditTriggers(QAbstractItemView::NoEditTriggers); pTable->setSelectionMode(QAbstractItemView::SingleSelection); // header nameList += tr("Username"); nameList += tr("Contest"); nameList += tr("Description"); setupHeader(nameList); pTable->setColumnWidth(Username, 100); pTable->setColumnWidth(Contest, 100); pTable->setColumnWidth(Description, 200); connect(m_pDb, SIGNAL(accountsChanged()), this, SLOT(file_update())); file_update(); }
void model_import_dlg::create_mesh_tab(QTabWidget * parent, size_t index, render::lod lod) { QWidget * tab = new QWidget(parent); tab->setObjectName("meshTab"); auto & geometry = conv.get(index).geometry.at(lod); auto & material = conv.get(index).materials.at(lod); QGroupBox * geometry_box = new QGroupBox(tab); geometry_box->setGeometry(10, 10, 561, 115); geometry_box->setTitle("Geometry"); QLabel * vertices = new QLabel(geometry_box); vertices->setGeometry(20, 20, 200, 20); vertices->setText("Vertices: " + QString::number(geometry.vertex_count)); QLabel * faces = new QLabel(geometry_box); faces->setGeometry(20, 40, 200, 20); faces->setText("Faces: " + QString::number(geometry.index_count / 3)); QLabel * indices = new QLabel(geometry_box); indices->setGeometry(20, 60, 200, 20); indices->setText("Indices: " + QString::number(geometry.index_count)); QLabel * layout = new QLabel(geometry_box); layout->setGeometry(20, 80, 200, 20); layout->setText("Layout: " + QString::fromStdString(render::vertex::str(geometry.vertex_type))); QGroupBox * material_box = new QGroupBox(tab); material_box->setGeometry(10, 130, 561, 400); material_box->setTitle("Material"); QGroupBox * colors_box = new QGroupBox(material_box); colors_box->setGeometry(15, 20, 455, 134); colors_box->setTitle("Colors"); QTableWidget * colorsTable = new QTableWidget(colors_box); colorsTable->setGeometry(15, 25, 237, 92); colorsTable->setObjectName("colorsTable"); colorsTable->setRowCount(3); colorsTable->setColumnCount(3); colorsTable->setFrameShape(QFrame::NoFrame); colorsTable->setShowGrid(false); colorsTable->setSelectionBehavior(QAbstractItemView::SelectionBehavior::SelectRows); colorsTable->setEditTriggers(QAbstractItemView::DoubleClicked); colorsTable->horizontalHeader()->setDefaultSectionSize(60); colorsTable->verticalHeader()->setDefaultSectionSize(23); colorsTable->setSelectionMode(QAbstractItemView::SelectionMode::SingleSelection); QStringList color_types; color_types.append("Ambient"); color_types.append("Diffuse"); color_types.append("Specular"); QStringList color_channels; color_channels.append("R"); color_channels.append("G"); color_channels.append("B"); colorsTable->setVerticalHeaderLabels(color_types); colorsTable->setHorizontalHeaderLabels(color_channels); colorsTable->setItem(0, 0, new QTableWidgetItem(QString::number(rgb_to_byte(material.ambient.x)))); colorsTable->setItem(0, 1, new QTableWidgetItem(QString::number(rgb_to_byte(material.ambient.y)))); colorsTable->setItem(0, 2, new QTableWidgetItem(QString::number(rgb_to_byte(material.ambient.z)))); colorsTable->setItem(1, 0, new QTableWidgetItem(QString::number(rgb_to_byte(material.diffuse.x)))); colorsTable->setItem(1, 1, new QTableWidgetItem(QString::number(rgb_to_byte(material.diffuse.y)))); colorsTable->setItem(1, 2, new QTableWidgetItem(QString::number(rgb_to_byte(material.diffuse.z)))); colorsTable->setItem(2, 0, new QTableWidgetItem(QString::number(rgb_to_byte(material.specular.x)))); colorsTable->setItem(2, 1, new QTableWidgetItem(QString::number(rgb_to_byte(material.specular.y)))); colorsTable->setItem(2, 2, new QTableWidgetItem(QString::number(rgb_to_byte(material.specular.z)))); QPushButton * colorPick = new QPushButton(colors_box); colorPick->setGeometry(290, 24, 75, 23); colorPick->setObjectName("colorPick"); colorPick->setText("Pick"); for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) colorsTable->item(i, j)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); QObject::connect(colorsTable, SIGNAL(itemSelectionChanged()), this, SLOT(on_color_table_changed())); QObject::connect(colorPick, SIGNAL(pressed()), this, SLOT(on_color_pick())); QLabel * spec_power = new QLabel(colors_box); spec_power->setGeometry(290, 89, 80, 23); spec_power->setText("Specular power: "); QDoubleSpinBox * spec_power_box = new QDoubleSpinBox(colors_box); spec_power_box->setObjectName("specularSpinBox"); spec_power_box->setDecimals(2); spec_power_box->setSingleStep(0.05); spec_power_box->setFrame(false); spec_power_box->setGeometry(390, 89, 50, 23); spec_power_box->setValue(material.specular_power); QGroupBox * textures_box = new QGroupBox(material_box); textures_box->setGeometry(15, 159, 531, 225); textures_box->setTitle("Textures"); QTableWidget * texturesTable = new QTableWidget(textures_box); texturesTable->setObjectName("texturesTable"); texturesTable->setGeometry(15, 25, 500, 150); texturesTable->setRowCount(material.textures.size()); texturesTable->setColumnCount(2); texturesTable->setFrameShape(QFrame::NoFrame); texturesTable->setShowGrid(false); texturesTable->setSelectionBehavior(QAbstractItemView::SelectionBehavior::SelectRows); texturesTable->setEditTriggers(QAbstractItemView::DoubleClicked); texturesTable->horizontalHeader()->setDefaultSectionSize(60); texturesTable->verticalHeader()->setDefaultSectionSize(23); texturesTable->verticalHeader()->setVisible(false); QStringList texture_headers; texture_headers.append("File"); texture_headers.append("Type"); texturesTable->setHorizontalHeaderLabels(texture_headers); int i = 0; assimp::texture_type_map texture_map; for (auto texture : material.textures) { texturesTable->setItem(i, 0, new QTableWidgetItem(QString::fromStdString(texture.second.texture_path.generic_string()))); texturesTable->setItem(i, 1, new QTableWidgetItem(QString::fromStdString(texture_map.get(texture.first)))); texturesTable->setColumnWidth(0, 350); texturesTable->setColumnWidth(1, 150); i++; } for (i = 0; i < texturesTable->rowCount(); i++) for (int j = 0; j < texturesTable->columnCount(); j++) texturesTable->item(i, j)->setTextAlignment(Qt::AlignHCenter | Qt::AlignVCenter); QPushButton * add_texture = new QPushButton(textures_box); add_texture->setGeometry(15, 185, 75, 23); add_texture->setText("Add"); QPushButton * edit_texture = new QPushButton(textures_box); edit_texture->setGeometry(100, 185, 75, 23); edit_texture->setObjectName("textureEditButton"); edit_texture->setText("Edit"); edit_texture->setEnabled(false); QPushButton * delete_texture = new QPushButton(textures_box); delete_texture->setGeometry(185, 185, 75, 23); delete_texture->setObjectName("textureDeleteButton"); delete_texture->setText("Delete"); delete_texture->setEnabled(false); QObject::connect(texturesTable, SIGNAL(itemSelectionChanged()), this, SLOT(on_texture_table_changed())); QObject::connect(add_texture, SIGNAL(pressed()), this, SLOT(on_texture_add())); QObject::connect(edit_texture, SIGNAL(pressed()), this, SLOT(on_texture_edit())); QObject::connect(delete_texture, SIGNAL(pressed()), this, SLOT(on_texture_delete())); QString title = "Mesh " + QString::number(index); parent->addTab(tab, title); }
void InfoDialog::setupUi(const Tags &tags) { int row = 0; QVBoxLayout *layout = new QVBoxLayout; layout->setContentsMargins(0,0,0,0); setWindowTitle(tr("EXIF information")); if (!tags.fileName().isEmpty()) setWindowTitle(windowTitle() + " - " + QFileInfo(tags.fileName()).fileName()); setWindowIcon(QIcon(":images/exif_info")); if (tags.size()) { QMapIterator<int, QPair<Tag, Data> > tag(tags); QTableWidget *tableWidget = new QTableWidget(tags.size(),2,this); tableWidget->setAlternatingRowColors(true); tableWidget->verticalHeader()->setVisible(false); tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers); tableWidget->setSelectionMode(QAbstractItemView::NoSelection); tableWidget->setHorizontalHeaderItem(0,new QTableWidgetItem(tr("Tag"))); tableWidget->setHorizontalHeaderItem(1,new QTableWidgetItem(tr("Value"))); tableWidget->horizontalHeader()->setStretchLastSection(true); while (tag.hasNext()) { QTableWidgetItem *item; QPair<Tag,Data> exifValue = tag.next().value(); item = new QTableWidgetItem(exifValue.first.title); item->setToolTip(exifValue.first.description.split(". ",QString::SkipEmptyParts).join("\n")); tableWidget->setItem(row,0,item); item = new QTableWidgetItem(exifValue.second.readableValue); item->setToolTip(exifValue.first.description.split(". ",QString::SkipEmptyParts).join("\n")); tableWidget->setItem(row++,1,item); } tableWidget->resizeColumnsToContents(); tableWidget->resizeRowsToContents(); layout->addWidget(tableWidget); } else { QLabel *label = new QLabel(tr("No EXIF information available"),this); label->setAlignment(Qt::AlignCenter); layout->addWidget(label); } #ifdef Q_WS_MAC QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok,Qt::Horizontal,this); connect(buttonBox,SIGNAL(accepted()),this,SLOT(close())); layout->addWidget(buttonBox); #endif setLayout(layout); resize(600,400); }
ValidationResultDialog::ValidationResultDialog(ValidationItem* item) { //return if there's no parent if (item == NULL) { return; } QDialogButtonBox* buttons = new QDialogButtonBox(QDialogButtonBox::Ok,Qt::Horizontal, this); QPushButton* print_button = new QPushButton("Save to File", buttons); QVBoxLayout* mainLayout = new QVBoxLayout(); QGroupBox* resultGroup = new QGroupBox(tr("Validation Results"),this); QGridLayout* layout = new QGridLayout(); QVBoxLayout* resultGroupLayout = new QVBoxLayout(); int type = item->getValidationType(); if (type < 4 || type==5) { String train_fit ="R^2"; String pred_qual="Q^2"; String n = item->modelItem()->getRegistryEntry()->getStatName(item->getValidationStatistic()); if(n!="") { train_fit = n+"<br>on training data"; pred_qual = "predictive<br>"+n; } QLabel* rlabel = new QLabel(train_fit.c_str(),this); layout->addWidget(rlabel, 0,1); QString tmp; QLabel* qlabel=NULL; if(type<3) { qlabel = new QLabel(tmp.setNum(item->k())+ " fold "+pred_qual.c_str(),this); } else if(type==3) // boostrap { qlabel = new QLabel(QString(pred_qual.c_str())+" of "+tmp.setNum(item->numOfSamples())+ "\nbootstrap samples",this); } else if(type==5) { qlabel = new QLabel(tmp.setNum(item->getNoExternalFolds())+ " fold nested "+pred_qual.c_str(),this); } layout->addWidget(qlabel, 0,2); QLabel* rvaluelabel = new QLabel(QString(((String)(item->getR2())).c_str()),this); layout->addWidget(rvaluelabel,1,1); QLabel* qvaluelabel = new QLabel(QString(((String)(item->getQ2())).c_str()),this); layout->addWidget(qvaluelabel,1,2); resultGroup->setLayout(layout); } else if (type == 4) { QString value; float num; QStringList labels; labels << "# Tests" << "R^2" << "Q^2"; QTableWidget* table = new QTableWidget(item->resultOfRandTest()->rows(), 3, this); table->verticalHeader()->hide(); table->setHorizontalHeaderLabels (labels); table->setAlternatingRowColors(true); table->setDragDropMode(QAbstractItemView::NoDragDrop); table->setEditTriggers(QAbstractItemView::NoEditTriggers); table->horizontalHeader()->setResizeMode(QHeaderView::Stretch); table->horizontalHeader()->setResizeMode(2,QHeaderView::Stretch); for (int i = 0; i < item->resultOfRandTest()->rows();i++) { value.setNum(i); QTableWidgetItem* num_of_Test = new QTableWidgetItem(value); table->setItem(i, 0, num_of_Test); num = (*(item->resultOfRandTest()))(i,item->resultOfRandTest()->cols()-2); value.setNum(num); QTableWidgetItem* r = new QTableWidgetItem(value); table->setItem(i, 1, r); num = (*(item->resultOfRandTest()))(i,item->resultOfRandTest()->cols()-1); value.setNum(num); QTableWidgetItem* q = new QTableWidgetItem(value); table->setItem(i, 2, q); } QScrollArea* scrollArea = new QScrollArea(this); scrollArea->setHorizontalScrollBarPolicy ( Qt::ScrollBarAlwaysOff ); scrollArea->setVerticalScrollBarPolicy ( Qt::ScrollBarAsNeeded ); scrollArea->setFrameShape(QFrame::NoFrame); scrollArea->setWidget(table); scrollArea->setWidgetResizable(true); resultGroupLayout->addWidget(scrollArea); resultGroup->setLayout(resultGroupLayout); } mainLayout->addWidget(resultGroup); mainLayout->addWidget(buttons); mainLayout->addStretch(1); setLayout(mainLayout); setWindowTitle("Validation Results for " + item->name()); connect(buttons, SIGNAL(accepted()), this, SLOT(accept())); connect(print_button, SIGNAL(clicked()), this, SLOT(saveToFile())); }
void VirshGui::populateVMInfos(string vmname) { VMStatus vmstatus = vmlist[vmname].getStatus(); string strstatus = vmlist[vmname].statusToString(vmstatus); string memory = vmlist[vmname].getMemory(); string vmxml = vmlist[vmname].dumpXML(); string cpuCount = vmlist[vmname].getCPUCount(); string ostype = vmlist[vmname].getOSType(); string arch = vmlist[vmname].getArch(); vector<string> bootDevs = vmlist[vmname].getBootDevs(); vector<string> hvFeatures = vmlist[vmname].getHVFeatures(); vector<string> cpuFeatures = vmlist[vmname].getCPUFeatures(); string bootDevStr = join(bootDevs, ", "); string hvFeatureStr = join(hvFeatures, ", "); string cpuFeatureStr = join(cpuFeatures, ", "); if (vmstatus == VMStatus::shutoff) { ui->startStopButton->setText("VM starten"); ui->startStopButton->setEnabled(true); ui->shutdownButton->setDisabled(true); ui->rebootButton->setDisabled(true); ui->virtViewerButton->setDisabled(true); } else if (vmstatus == VMStatus::running) { ui->startStopButton->setText("VM ausschalten"); ui->startStopButton->setEnabled(true); ui->shutdownButton->setEnabled(true); ui->rebootButton->setEnabled(true); ui->virtViewerButton->setEnabled(true); } else { ui->startStopButton->setText("keine Aktion"); ui->startStopButton->setDisabled(true); ui->shutdownButton->setDisabled(true); ui->rebootButton->setDisabled(true); ui->virtViewerButton->setDisabled(true); } while (ui->snapshotsTabLayout->count() > 0) { QLayoutItem *item = ui->snapshotsTabLayout->takeAt(0); delete item->widget(); delete item; } int snapshotTableCount = 0; for (auto hdd : vmlist[vmname].getHDDImages()) { int row = 0; QGroupBox *hddGroupBox = new QGroupBox(QString::fromStdString(hdd.getPath())); hddGroupBox->setFlat(false); QVBoxLayout *hddVBox = new QVBoxLayout; QTableWidget *snapshotTable = new QTableWidget(0, 5, this); snapshotTable->setSelectionMode(QAbstractItemView::SingleSelection); snapshotTable->setHorizontalHeaderLabels(QStringList() << "ID" << "Tag" << "VM Size" << "Date" << "VM Clock"); snapshotTable->horizontalHeader()->setSectionResizeMode(0, QHeaderView::ResizeToContents); //snapshotTable->setColumnWidth(0, 45); snapshotTable->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch); snapshotTable->horizontalHeader()->setSectionResizeMode(2, QHeaderView::ResizeToContents); snapshotTable->horizontalHeader()->setSectionResizeMode(3, QHeaderView::ResizeToContents); snapshotTable->horizontalHeader()->setSectionResizeMode(4, QHeaderView::ResizeToContents); snapshotTable->verticalHeader()->hide(); snapshotTable->setAlternatingRowColors(true); //snapshotTable->setSortingEnabled(true); snapshotTable->setEditTriggers(QTableWidget::NoEditTriggers); connect(snapshotTable, &QTableWidget::cellPressed, [this, snapshotTableCount](){ clearSnapshotSelectionsExcept(snapshotTableCount); }); snapshotTableCount++; for (auto snapshot : hdd.getSnapshots()) { snapshotTable->setRowCount(row + 1); QTableWidgetItem *id = new QTableWidgetItem( QString::fromStdString(snapshot.getID())); QTableWidgetItem *tag = new QTableWidgetItem( QString::fromStdString(snapshot.getTag())); QTableWidgetItem *size = new QTableWidgetItem( QString::fromStdString(snapshot.getSize())); QTableWidgetItem *date = new QTableWidgetItem( QString::fromStdString(snapshot.getDate())); QTableWidgetItem *clock = new QTableWidgetItem( QString::fromStdString(snapshot.getClock())); snapshotTable->setItem(row, 0, id); snapshotTable->setItem(row, 1, tag); snapshotTable->setItem(row, 2, size); snapshotTable->setItem(row, 3, date); snapshotTable->setItem(row, 4, clock); row++; } hddVBox->addWidget(snapshotTable); QHBoxLayout *addSnapHBox = new QHBoxLayout; QLineEdit *addSnapNameEdit = new QLineEdit; QPushButton *addSnapButton = new QPushButton; addSnapButton->setText("Snapshot erstellen"); addSnapButton->setEnabled(false); string hddPath = hdd.getPath(); connect(addSnapNameEdit, &QLineEdit::textChanged, [this, addSnapButton, addSnapNameEdit](){ toggleAddSnapshotButton(addSnapButton, addSnapNameEdit); }); connect(addSnapButton, &QPushButton::clicked, [this, hddPath, vmname, addSnapNameEdit](){ createSnapshot(hddPath, vmname, addSnapNameEdit->text().toStdString()); }); addSnapHBox->addWidget(addSnapNameEdit); addSnapHBox->addWidget(addSnapButton); hddVBox->addLayout(addSnapHBox); hddGroupBox->setLayout(hddVBox); ui->snapshotsTabLayout->addWidget(hddGroupBox); } QPushButton *applySnapshotButton = new QPushButton("Snapshot Anwenden", this); connect(applySnapshotButton, SIGNAL(clicked(bool)), this, SLOT(applySnapshot())); //connect(applySnapshotButton, &QPushButton::clicked, [this](){ clearSnapshotSelectionsExcept(1); }); ui->snapshotsTabLayout->addWidget(applySnapshotButton); ui->xmlDisplay->setText(QString::fromStdString(vmxml)); ui->vmnameLabel->setText(QString::fromStdString(vmname)); ui->statusLabel->setText(QString::fromStdString(strstatus)); ui->memoryLabel->setText(QString::fromStdString(memory)); ui->cpucountLabel->setText(QString::fromStdString(cpuCount)); ui->typeLabel->setText(QString::fromStdString(ostype)); ui->archLabel->setText(QString::fromStdString(arch)); ui->bootdevLabel->setText(QString::fromStdString(bootDevStr)); ui->hvFeaturesLabel->setText(QString::fromStdString(hvFeatureStr)); ui->hvFeaturesLabel->setWordWrap(true); ui->cpuFeaturesLabel->setText(QString::fromStdString(cpuFeatureStr)); ui->cpuFeaturesLabel->setWordWrap(true); }
AirSpaceWindow::AirSpaceWindow(QWidget* parent, const QString &name, Qt::WindowFlags wflags, IDataBase::SourceType src) :TableWindow(parent, name, wflags) { QStringList nameList; QAction* pAction; QTableWidget *pTable; pTable = TableWindow::getTable(); m_pWebMapView = NULL; m_pAirSpaceView = NULL; m_externSelect = false; switch(src) { case IDataBase::SqlDB: m_pDb = ISql::pInstance(); connect(m_pDb, SIGNAL(airSpacesChanged()), this, SLOT(file_update())); pAction = new QAction(tr("&Edit"), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_edit())); MDIWindow::addAction(pAction, true); pAction = new QAction(tr("&Delete"), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_delete())); MDIWindow::addAction(pAction); pAction = new QAction(tr("&Add to GPS..."), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_AddToGPS())); MDIWindow::addAction(pAction, true); break; case IDataBase::GPSdevice: { m_pDb = IGPSDevice::pInstance(); connect(m_pDb, SIGNAL(airSpacesChanged()), this, SLOT(file_update())); pAction = new QAction(tr("&Delete"), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_delete())); MDIWindow::addAction(pAction); pAction = new QAction(tr("&Update"), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_update())); MDIWindow::addAction(pAction); } break; case IDataBase::File: { m_pDb = NULL; pAction = new QAction(tr("&Add to GPS..."), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_AddToGPS())); MDIWindow::addAction(pAction, true); } break; } if(src != IDataBase::SqlDB) { pAction = new QAction(tr("Add to DB..."), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_AddToSqlDB())); MDIWindow::addAction(pAction, true); pAction = new QAction(tr("&Update"), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_update())); MDIWindow::addAction(pAction); } // import/export pAction = new QAction(this); pAction->setSeparator(true); MDIWindow::addAction(pAction); if(src == IDataBase::File) { pAction = new QAction(tr("&Import..."), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_open())); MDIWindow::addAction(pAction); } pAction = new QAction(tr("&Export all..."), this); connect(pAction, SIGNAL(triggered()), this, SLOT(exportTable())); MDIWindow::addAction(pAction); // view pAction = new QAction(this); pAction->setSeparator(true); MDIWindow::addAction(pAction); pAction = new QAction(tr("&View..."), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_viewAirSpace())); MDIWindow::addAction(pAction); pAction = new QAction(tr("View &Web Map..."), this); connect(pAction, SIGNAL(triggered()), this, SLOT(file_viewWebMap())); MDIWindow::addAction(pAction, true); TableWindow::setWindowIcon(QIcon(":/document.xpm")); // configure the table pTable->setEditTriggers(QAbstractItemView::NoEditTriggers); pTable->setSelectionMode(QAbstractItemView::ExtendedSelection); // header nameList += tr("Name"); nameList += tr("Low [m]"); nameList += tr("High [m]"); nameList += tr("Class"); nameList += tr("Comment"); setupHeader(nameList); pTable->setColumnWidth(Name, 200); pTable->setColumnWidth(High, 100); pTable->setColumnWidth(Low, 100); pTable->setColumnWidth(Class, 80); pTable->setColumnWidth(Comment, 750); connect(m_pDb, SIGNAL(airSpacesChanged()), this, SLOT(file_update())); if(src == IDataBase::File) { file_open(); } else { file_update(); } }