当前位置: 首页>>代码示例>>C++>>正文


C++ QTableWidget::setEditTriggers方法代码示例

本文整理汇总了C++中QTableWidget::setEditTriggers方法的典型用法代码示例。如果您正苦于以下问题:C++ QTableWidget::setEditTriggers方法的具体用法?C++ QTableWidget::setEditTriggers怎么用?C++ QTableWidget::setEditTriggers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTableWidget的用法示例。


在下文中一共展示了QTableWidget::setEditTriggers方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: standartStuffForAllTables

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);
}
开发者ID:Wargy,项目名称:IzzyTime,代码行数:11,代码来源:mainwindow.cpp

示例2: tr

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;
}
开发者ID:JanKolomaznik,项目名称:MedV4D,代码行数:29,代码来源:StManagerStudyListComp.cpp

示例3: logMessage

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 );
}
开发者ID:Aladar64,项目名称:QGIS,代码行数:55,代码来源:qgsmessagelogviewer.cpp

示例4:

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;
}
开发者ID:JanKolomaznik,项目名称:MedV4D,代码行数:12,代码来源:StManagerStudyListComp.cpp

示例5: setEditable

void Table::setEditable(bool editable)
{
    QTableWidget *tablewidget = static_cast<QTableWidget*>(getQWidget());
    if(editable)
    {
        // TODO
    }
    else
    {
        tablewidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
    }
}
开发者ID:fferri,项目名称:v_repExtCustomUI,代码行数:12,代码来源:Table.cpp

示例6: getTableWidget

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");
}
开发者ID:kulikovv,项目名称:ProcessingSDK,代码行数:12,代码来源:tableview.cpp

示例7: creatTableItem

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);
    }

}
开发者ID:niuyuxin,项目名称:crsui,代码行数:52,代码来源:parameterwin.cpp

示例8: initNogoodTable

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);


}
开发者ID:cp-profiler,项目名称:cp-profiler,代码行数:13,代码来源:cmp_tree_dialog.cpp

示例9: QAction

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();
}
开发者ID:Iv,项目名称:FlyHigh,代码行数:50,代码来源:AccountWindow.cpp

示例10: create_mesh_tab

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");

//.........这里部分代码省略.........
开发者ID:levka17,项目名称:Engine-Editor,代码行数:101,代码来源:model_import_dlg.cpp

示例11: setupUi

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);
}
开发者ID:kamawanu,项目名称:wally-imported,代码行数:62,代码来源:exif.cpp

示例12: if

		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);
//.........这里部分代码省略.........
开发者ID:HeyJJ,项目名称:ball,代码行数:101,代码来源:validationResultDialog.C

示例13: populateVMInfos

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);

//.........这里部分代码省略.........
开发者ID:SteveCharleston,项目名称:virsh-gui,代码行数:101,代码来源:virshgui.cpp

示例14: switch


//.........这里部分代码省略.........
      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();
  }
}
开发者ID:Iv,项目名称:FlyHigh,代码行数:101,代码来源:AirSpaceWindow.cpp


注:本文中的QTableWidget::setEditTriggers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。