本文整理汇总了C++中QTableWidgetItem类的典型用法代码示例。如果您正苦于以下问题:C++ QTableWidgetItem类的具体用法?C++ QTableWidgetItem怎么用?C++ QTableWidgetItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QTableWidgetItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QDialog
SettingsDialogImpl::SettingsDialogImpl(QWidget *parent)
: QDialog(parent)
{
ui.setupUi(this);
//setup the whole ui from settings
Settings* settings = Settings::Instance();
connect(ui.sortCheckBox, SIGNAL(stateChanged(int)), this, SLOT(sortStateChanged(int)));
if(settings->getSort() == true)
ui.sortCheckBox->setCheckState(Qt::Checked);
else
{
ui.sortCheckBox->setCheckState(Qt::Unchecked);
ui.sortOngoingCheckBox->setEnabled(false);
ui.sortPriorCheckBox->setEnabled(false);
ui.sortPriorLabel->setEnabled(false);
}
connect(ui.buttonBox, SIGNAL(accepted()), this, SLOT(acceptClicked()));
if(settings->getOngoingSort() == true)
ui.sortOngoingCheckBox->setCheckState(Qt::Checked);
else
ui.sortOngoingCheckBox->setCheckState(Qt::Unchecked);
if(settings->getPriorSort() == true)
ui.sortPriorCheckBox->setCheckState(Qt::Checked);
else
ui.sortPriorCheckBox->setCheckState(Qt::Unchecked);
if(settings->getReloadSort() == true)
ui.sortReloadCheckBox->setCheckState(Qt::Checked);
else
ui.sortReloadCheckBox->setCheckState(Qt::Unchecked);
if(settings->getConvertNames() == true)
ui.convertnamescheckbox->setCheckState(Qt::Checked);
else
ui.convertnamescheckbox->setCheckState(Qt::Unchecked);
if(settings->getScanMedia() == true)
ui.scanmediabox->setCheckState(Qt::Checked);
else
ui.scanmediabox->setCheckState(Qt::Unchecked);
ui.opacitySpinbox->setValue(settings->getOpacity());
// qDebug() << settings->getSort() << settings->getOngoingSort() << settings->getPriorSort();
ui.tableWidget->setColumnWidth(0,300);
ui.tableWidget->setColumnWidth(0,200);
QTableWidgetItem* name = new QTableWidgetItem("Player");
ui.tableWidget->setHorizontalHeaderItem(0,name);
QTableWidgetItem* args = new QTableWidgetItem("Args");
ui.tableWidget->setHorizontalHeaderItem(1,args);
QList<QPair<QString, QString> > players = Settings::Instance()->getPlayerList();
for(int i=0; i<players.size(); i++)
{
QTableWidgetItem* playeritem = new QTableWidgetItem( players.at(i).first );
playeritem->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* argitem = new QTableWidgetItem( players.at(i).second );
//argitem->setFlags(Qt::ItemIsEnabled);
int row = ui.tableWidget->rowCount();
ui.tableWidget->insertRow(row);
ui.tableWidget->setItem(row, 0, playeritem);
ui.tableWidget->setItem(row, 1, argitem);
}
ui.settingsfilelabel->setText(Settings::Instance()->getSettingsFilename());
}
示例2: QString
void rulesDialog::readTest( int index, QgsMapLayerRegistry* layerRegistry )
{
QString testName;
QString layer1Id;
QString layer2Id;
QString tolerance;
QgsProject* project = QgsProject::instance();
QString postfix = QString( "%1" ).arg( index );
testName = project->readEntry( "Topol", "/testname_" + postfix, "" );
tolerance = project->readEntry( "Topol", "/tolerance_" + postfix, "" );
layer1Id = project->readEntry( "Topol", "/layer1_" + postfix, "" );
layer2Id = project->readEntry( "Topol", "/layer2_" + postfix, "" );
QgsVectorLayer* l1;
if ( !( QgsVectorLayer* )layerRegistry->mapLayers().contains( layer1Id ) )
return;
l1 = ( QgsVectorLayer* )layerRegistry->mapLayers()[layer1Id];
if ( !l1 )
return;
QString layer1Name = l1->name();
QString layer2Name;
QgsVectorLayer* l2;
if ( mTestConfMap[testName].useSecondLayer )
{
if ( !( QgsVectorLayer* )layerRegistry->mapLayers().contains( layer2Id ) )
return;
else
{
l2 = ( QgsVectorLayer* )layerRegistry->mapLayers()[layer2Id];
layer2Name = l2->name();
}
}
else
layer2Name = "No layer";
int row = index;
mRulesTable->insertRow( row );
QTableWidgetItem* newItem;
newItem = new QTableWidgetItem( testName );
newItem->setFlags( newItem->flags() & ~Qt::ItemIsEditable );
mRulesTable->setItem( row, 0, newItem );
newItem = new QTableWidgetItem( layer1Name );
newItem->setFlags( newItem->flags() & ~Qt::ItemIsEditable );
mRulesTable->setItem( row, 1, newItem );
newItem = new QTableWidgetItem( layer2Name );
newItem->setFlags( newItem->flags() & ~Qt::ItemIsEditable );
mRulesTable->setItem( row, 2, newItem );
if ( mTestConfMap[testName].useTolerance )
newItem = new QTableWidgetItem( tolerance );
else
newItem = new QTableWidgetItem( QString( "No tolerance" ) );
newItem->setFlags( newItem->flags() & ~Qt::ItemIsEditable );
mRulesTable->setItem( row, 3, newItem );
// add layer ids to hidden columns
newItem = new QTableWidgetItem( layer1Id );
mRulesTable->setItem( row, 4, newItem );
newItem = new QTableWidgetItem( layer2Id );
mRulesTable->setItem( row, 5, newItem );
}
示例3: openFileOfItem
void Window::openFileOfItem(int row, int /* column */)
{
QTableWidgetItem *item = filesTable->item(row, 0);
QDesktopServices::openUrl(QUrl::fromLocalFile(currentDir.absoluteFilePath(item->text())));
}
示例4: QTableWidgetItem
void QgsGrassEdit::setAttributeTable( int field )
{
mAttributeTable->setRowCount( 0 );
QString *key = mProvider->key( field );
if ( !key->isEmpty() ) // Database link defined
{
QVector<QgsField> *cols = mProvider->columns( field );
mAttributeTable->setRowCount( cols->size() );
for ( int c = 0; c < cols->size(); c++ )
{
QgsField col = ( *cols )[c];
QTableWidgetItem *ti;
ti = new QTableWidgetItem( col.name() );
ti->setFlags( ti->flags() & ~Qt::ItemIsEnabled );
mAttributeTable->setItem( c, 0, ti );
ti = new QTableWidgetItem( col.typeName() );
ti->setFlags( ti->flags() & ~Qt::ItemIsEnabled );
mAttributeTable->setItem( c, 1, ti );
QString str;
str.sprintf( "%d", col.length() );
ti = new QTableWidgetItem( str );
ti->setFlags( ti->flags() & ~Qt::ItemIsEnabled );
mAttributeTable->setItem( c, 2, ti );
}
}
else
{
mAttributeTable->setRowCount( 1 );
QTableWidgetItem *ti;
ti = new QTableWidgetItem( "cat" );
mAttributeTable->setItem( 0, 0, ti );
ti = new QTableWidgetItem( "integer" );
ti->setFlags( ti->flags() & ~Qt::ItemIsEnabled );
mAttributeTable->setItem( 0, 1, ti );
ti = new QTableWidgetItem( "" );
ti->setFlags( ti->flags() & ~Qt::ItemIsEnabled );
mAttributeTable->setItem( 0, 2, ti );
}
}
示例5: if
//Timer call to animate the graph bars.
void MonthView::on_growth_animation_timer_update()
{
if (prev_source_name != SOURCE_OTHER )
{
if((opacity <= 255) && (opacity >= 20 ))
{
opacity -= 25;
}else
{
if (opacity <= 20 )
{
opacity =20;
}
if (opacity >= 255)
{
opacity = 255;
}
}
}
bool isAnimationinProgress = false;
all_week_data = 0;
int data;
int sourceData;
int weekly_total = 0;
for(int row = 0; row < 6; row++)
{
weekly_total = 0;
for(int col = 0; col < 7; col++)
{
if ( m_vector_vector_view_selected_day_usage_values.size() != 42)
{
break;
}
QTableWidgetItem *item = ui->tblDates->item(row,col);
QVariant v = item->data(0);
StarRating r = v.value<StarRating>();
// int data;
// int sourceData;
if (ResetAnimation)
{
data = 0;
sourceData =0;
}
else
{
data = r.data_total;
sourceData = r.data_from_source;
}
if (opacity> 20 && prev_source_name != SOURCE_OTHER )
{
isAnimationinProgress = true;
sourceData = ((int)((qreal)(50 * ( m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][prev_source_name] )))/MaxUnit );
if (opacity < 50)
{
sourceData =0;
}
}
else if(data < ((int)((qreal)(50 * ( m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][0] + m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][1] + m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][2] + m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][3] + m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][4] )))/MaxUnit ) )
{
data++;
isAnimationinProgress = true;
}
else if(sourceData < ((int)((qreal)(50 * ( m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][currentSource] )))/MaxUnit ))
{
sourceData++;
isAnimationinProgress= true;
}
QDate dt = QDate::fromString(item->whatsThis());
bool isfuturedate = false;
if(dt.operator <= (QDate::currentDate()))
{
isfuturedate = true;
}
item->setData(0, qVariantFromValue(StarRating(r.date, data, sourceData, currentSource,r.max_data_total,r.max_source_data, opacity, prev_source_name, (qreal)((qreal)(50 * ( m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][prev_source_name] )))/MaxUnit , isfuturedate)));
if (opacity <= 20)
{
opacity= 255;
prev_source_name = SOURCE_OTHER;
}
if(sourceData >0 && isfuturedate)
{
weekly_total += m_vector_vector_view_selected_day_usage_values[(row * 7) + col ][currentSource] ;
}
}
//.........这里部分代码省略.........
示例6: QFrame
MPConfig::MPConfig(QWidget* parent)
: QFrame(parent)
{
setupUi(this);
mdevView->setRowCount(kMaxMidiPorts);
mdevView->verticalHeader()->hide();
mdevView->setSelectionMode(QAbstractItemView::SingleSelection);
mdevView->setShowGrid(false);
//popup = 0;
instrPopup = 0;
_showAliases = -1; // 0: Show first aliases, if available. Nah, stick with -1: none at first.
QStringList columnnames;
columnnames << tr("Port")
<< tr("GUI")
<< tr("N")
<< tr("I")
<< tr("O")
<< tr("Instr")
<< tr("D-Name")
<< tr("Ins")
<< tr("Outs")
<< tr("In Ch")
<< tr("Out Ch")
<< tr("State");
mdevView->setColumnCount(columnnames.size());
mdevView->setHorizontalHeaderLabels(columnnames);
for (int i = 0; i < columnnames.size(); ++i)
{
setWhatsThis(mdevView->horizontalHeaderItem(i), i);
setToolTip(mdevView->horizontalHeaderItem(i), i);
}
mdevView->setFocusPolicy(Qt::NoFocus);
//mdevView->horizontalHeader()->setMinimumSectionSize(60);
mdevView->horizontalHeader()->resizeSection(DEVCOL_NO, 50);
mdevView->horizontalHeader()->resizeSection(DEVCOL_CACHE_NRPN, 20);
mdevView->horizontalHeader()->resizeSection(DEVCOL_REC, 20);
mdevView->horizontalHeader()->resizeSection(DEVCOL_PLAY, 20);
mdevView->horizontalHeader()->resizeSection(DEVCOL_GUI, 40);
mdevView->horizontalHeader()->resizeSection(DEVCOL_INROUTES, 40);
mdevView->horizontalHeader()->resizeSection(DEVCOL_OUTROUTES, 140);
mdevView->horizontalHeader()->resizeSection(DEVCOL_DEF_IN_CHANS, 70);
mdevView->horizontalHeader()->resizeSection(DEVCOL_DEF_OUT_CHANS, 70);
mdevView->horizontalHeader()->resizeSection(DEVCOL_INSTR, 140);
mdevView->horizontalHeader()->resizeSection(DEVCOL_NAME, 140);
mdevView->horizontalHeader()->setStretchLastSection(true);
mdevView->horizontalHeader()->setDefaultAlignment(Qt::AlignVCenter | Qt::AlignLeft);
connect(mdevView, SIGNAL(itemPressed(QTableWidgetItem*)), this, SLOT(rbClicked(QTableWidgetItem*)));
connect(mdevView, SIGNAL(itemChanged(QTableWidgetItem*)), this, SLOT(mdevViewItemRenamed(QTableWidgetItem*)));
connect(song, SIGNAL(songChanged(int)), SLOT(songChanged(int)));
for (int i = kMaxMidiPorts - 1; i >= 0; --i)
{
mdevView->blockSignals(true); // otherwise itemChanged() is triggered and bad things happen.
QString s;
s.setNum(i + 1);
QTableWidgetItem* itemno = new QTableWidgetItem(s);
addItem(i, DEVCOL_NO, itemno, mdevView);
itemno->setTextAlignment(Qt::AlignHCenter);
itemno->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* itemstate = new QTableWidgetItem();
addItem(i, DEVCOL_STATE, itemstate, mdevView);
itemstate->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* iteminstr = new QTableWidgetItem();
addItem(i, DEVCOL_INSTR, iteminstr, mdevView);
iteminstr->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* itemname = new QTableWidgetItem;
addItem(i, DEVCOL_NAME, itemname, mdevView);
itemname->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* itemgui = new QTableWidgetItem;
addItem(i, DEVCOL_GUI, itemgui, mdevView);
itemgui->setTextAlignment(Qt::AlignHCenter);
itemgui->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* itemfb = new QTableWidgetItem;
addItem(i, DEVCOL_CACHE_NRPN, itemfb, mdevView);
itemfb->setTextAlignment(Qt::AlignHCenter);
itemfb->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* itemrec = new QTableWidgetItem;
addItem(i, DEVCOL_REC, itemrec, mdevView);
itemrec->setTextAlignment(Qt::AlignHCenter);
itemrec->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* itemplay = new QTableWidgetItem;
addItem(i, DEVCOL_PLAY, itemplay, mdevView);
itemplay->setTextAlignment(Qt::AlignHCenter);
itemplay->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* itemout = new QTableWidgetItem;
addItem(i, DEVCOL_OUTROUTES, itemout, mdevView);
itemout->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* itemin = new QTableWidgetItem;
addItem(i, DEVCOL_INROUTES, itemin, mdevView);
itemin->setFlags(Qt::ItemIsEnabled);
QTableWidgetItem* itemdefin = new QTableWidgetItem();
addItem(i, DEVCOL_DEF_IN_CHANS, itemdefin, mdevView);
itemdefin->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);
QTableWidgetItem* itemdefout = new QTableWidgetItem();
addItem(i, DEVCOL_DEF_OUT_CHANS, itemdefout, mdevView);
itemdefout->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);
//.........这里部分代码省略.........
示例7: setWindowTitle
void LapTimeComparisonDialog::updateData()
{
int scrollBarPosition = ui->tableWidget->verticalScrollBar()->sliderPosition();
QItemSelectionModel * selection = ui->tableWidget->selectionModel();
// for (int i = ui->tableWidget->rowCount()-1; i >= 0; --i)
// ui->tableWidget->removeRow(i);
QTableWidgetItem *item;
int firstLap = 99, lastLap = 0;
int index[4];
QString wTitle = "Lap time comparison: ";
for (int i = 0; i < 4; ++i)
{
index[i] = 0;
int idx = eventData.getDriverId(getNumber(i));
if (idx > 0)
{
if (i > 0)
wTitle += " - ";
wTitle += eventData.getDriversData()[idx-1].getDriverName();
if(!eventData.getDriversData()[idx-1].getLapData().isEmpty())
{
if (eventData.getDriversData()[idx-1].getLapData()[0].getLapNumber() < firstLap)
firstLap = eventData.getDriversData()[idx-1].getLapData()[0].getLapNumber();
if (eventData.getDriversData()[idx-1].getLapData().last().getLapNumber() > lastLap)
lastLap = eventData.getDriversData()[idx-1].getLapData().last().getLapNumber();
}
DriverData &dd = eventData.getDriversData()[idx-1];
QLabel *lab = qobject_cast<QLabel*>(ui->tableWidget->cellWidget(0, i+1));
lab->setPixmap(ImagesFactory::getInstance().getCarThumbnailsFactory().getCarThumbnail(dd.getNumber(), thumbnailsSize));//eventData.carImages[idx].scaledToWidth(120, Qt::SmoothTransformation));
}
else
{
QLabel *lab = qobject_cast<QLabel*>(ui->tableWidget->cellWidget(0, i+1));
lab->clear();
}
}
setWindowTitle(wTitle);
// ui->tableWidget->insertRow(0);
// ui->tableWidget->setRowHeight(0, 50);
int j = 0, k = firstLap;
for (; k <= lastLap; ++k, ++j)
{
int lapNo = lastLap - k + firstLap;
LapTime laps[4];
if (ui->tableWidget->rowCount() <= j+1)
ui->tableWidget->insertRow(j+1);
item = ui->tableWidget->item(j+1, 0);
if (!item)
{
item = new QTableWidgetItem(QString("%1.").arg(lapNo));
// item->setFlags(Qt::ItemIsSelectable);
item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(j+1, 0, item);
}
else
item->setText(QString("%1.").arg(lapNo));
for (int i = 0; i < 4; ++i)
{
int idx = eventData.getDriverId(getNumber(i));
if (idx > 0 && !eventData.getDriversData()[idx-1].getLapData().isEmpty())
{
//int lapIndex = (reversedOrder ? eventData.driversData[idx-1].lapData.size() - index[i] - 1 : index[i]);
DriverData &dd = eventData.getDriversData()[idx-1];
LapData ld = dd.getLapData(lapNo);
// if (j == 0)
// {
// int idx = (dd.number > 13 ? dd.number-2 : dd.number-1) / 2;
// QLabel *lab = qobject_cast<QLabel*>(ui->tableWidget->cellWidget(0, i+1));
// lab->setPixmap(smallCarImg[idx]);//eventData.carImages[idx].scaledToWidth(120, Qt::SmoothTransformation));
// }
if (dd.getLapData().size() > index[i] && ld.getLapNumber() == lapNo && ld.getCarID() != -1)
{
laps[i] = ld.getTime();
item = ui->tableWidget->item(j+1, i+1);
if (!item)
{
item = new QTableWidgetItem(ld.getTime());
item->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->setItem(j+1, i+1, item);
}
else
item->setText(ld.getTime());
//.........这里部分代码省略.........
示例8: connect
void ThreadRemoveExifDatas::run() {
QTableWidgetItem *item;
Exiv2::ExifData::iterator keyIteratorRemove;
Exiv2::ExifKey *keyRemove;
QVector<QString> listErrorRemoveFile;
QVector<int> listErrorRemoveFilePosition;
connect(this, SIGNAL(progressBarValue(int)), progressBar, SLOT(setValue(int)));
connect(this, SIGNAL(progressBarSetVisible(bool)), progressBar, SLOT(setVisible(bool)));
emit progressBarSetVisible(true);
progressBar->setRange(0, tableWidgetJpeg->rowCount());
for (int i = 0; i < tableWidgetJpeg->rowCount(); i++) {
try {
emit progressBarValue(i);
Exiv2::Image::AutoPtr image;
image = Exiv2::ImageFactory::open(tableWidgetJpeg->item(i, 7)->text().toStdString().c_str());
if (tableWidgetJpeg->item(i, 3) != 0 || tableWidgetJpeg->item(i, 4) != 0 || tableWidgetJpeg->item(i, 5) != 0) {
bool exifRemovido = false;
assert(image.get() != 0);
image->readMetadata();
Exiv2::ExifData &exifData = image->exifData();
Exiv2::ExifKey keyLatitude = Exiv2::ExifKey("Exif.GPSInfo.GPSLatitude");
keyIteratorRemove = exifData.findKey(keyLatitude);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
exifRemovido = true;
}
keyRemove = new Exiv2::ExifKey("Exif.GPSInfo.GPSTimeStamp");
keyIteratorRemove = exifData.findKey(*keyRemove);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
exifRemovido = true;
}
keyRemove = new Exiv2::ExifKey("Exif.GPSInfo.GPSDateStamp");
keyIteratorRemove = exifData.findKey(*keyRemove);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
exifRemovido = true;
}
keyRemove = new Exiv2::ExifKey("Exif.GPSInfo.GPSVersionID");
keyIteratorRemove = exifData.findKey(*keyRemove);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
exifRemovido = true;
}
keyRemove = new Exiv2::ExifKey("Exif.GPSInfo.GPSMapDatum");
keyIteratorRemove = exifData.findKey(*keyRemove);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
exifRemovido = true;
}
keyRemove = new Exiv2::ExifKey("Exif.GPSInfo.GPSLatitudeRef");
keyIteratorRemove = exifData.findKey(*keyRemove);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
}
keyRemove = new Exiv2::ExifKey("Exif.GPSInfo.GPSLongitude");
keyIteratorRemove = exifData.findKey(*keyRemove);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
exifRemovido = true;
}
keyRemove = new Exiv2::ExifKey("Exif.GPSInfo.GPSLongitudeRef");
keyIteratorRemove = exifData.findKey(*keyRemove);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
}
keyRemove = new Exiv2::ExifKey("Exif.GPSInfo.GPSAltitude");
keyIteratorRemove = exifData.findKey(*keyRemove);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
exifRemovido = true;
}
keyRemove = new Exiv2::ExifKey("Exif.GPSInfo.GPSAltitudeRef");
keyIteratorRemove = exifData.findKey(*keyRemove);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
exifRemovido = true;
}
keyRemove = new Exiv2::ExifKey("Exif.GPSInfo.GPSImgDirectionRef");
keyIteratorRemove = exifData.findKey(*keyRemove);
if (keyIteratorRemove != exifData.end()) {
exifData.erase(keyIteratorRemove);
exifRemovido = true;
//.........这里部分代码省略.........
示例9: while
//.........这里部分代码省略.........
}
else if (wu->GetWarningLevel() > 0)
{
switch (wu->GetWarningLevel())
{
case 1:
item->Type = EditType_1;
icon = QIcon(":/huggle/pictures/Resources/blob-warn-1.png");
break;
case 2:
item->Type = EditType_2;
icon = QIcon(":/huggle/pictures/Resources/blob-warn-2.png");
break;
case 3:
item->Type = EditType_3;
icon = QIcon(":/huggle/pictures/Resources/blob-warn-3.png");
break;
case 4:
item->Type = EditType_4;
icon = QIcon(":/huggle/pictures/Resources/blob-warn-4.png");
break;
}
}
}
bool selected = this->CurrentEdit->RevID == item->RevID.toInt();
if (selected && x == 0)
IsLatest = true;
item->IsCurrent = true;
if (selected)
this->SelectedRow = x;
QFont font;
font.setItalic(founder);
font.setBold(selected);
QTableWidgetItem *i = new QTableWidgetItem(icon, "");
this->ui->tableWidget->setItem(x, 0, i);
i = new QTableWidgetItem(item->User);
i->setFont(font);
this->ui->tableWidget->setItem(x, 1, i);
i = new QTableWidgetItem(item->Size);
i->setFont(font);
this->ui->tableWidget->setItem(x, 2, i);
i = new QTableWidgetItem(item->Summary);
i->setFont(font);
this->ui->tableWidget->setItem(x, 3, i);
i = new QTableWidgetItem(item->Date);
i->setFont(font);
this->ui->tableWidget->setItem(x, 4, i);
i = new QTableWidgetItem(item->RevID);
i->setFont(font);
this->ui->tableWidget->setItem(x, 5, i);
this->Items.append(item);
x++;
}
this->ui->tableWidget->resizeRowsToContents();
this->query = nullptr;
this->t1->stop();
if (!this->CurrentEdit->NewPage && !Configuration::HuggleConfiguration->ForcedNoEditJump && !IsLatest)
{
if (Configuration::HuggleConfiguration->UserConfig->LastEdit)
{
this->Display(0, Resources::Html_StopFire, true);
return;
}
else
{
QPoint pntr(0, this->pos().y());
示例10: tr
void
AddIntervalDialog::createClicked()
{
const RideFile *ride = context->currentRide();
if (!ride) {
QMessageBox::critical(this, tr("Select Ride"), tr("No ride selected!"));
return;
}
int maxIntervals = (int) countSpinBox->value();
double windowSizeSecs = (hrsSpinBox->value() * 3600.0
+ minsSpinBox->value() * 60.0
+ secsSpinBox->value());
double windowSizeMeters = (kmsSpinBox->value() * 1000.0
+ msSpinBox->value());
if (windowSizeSecs == 0.0) {
QMessageBox::critical(this, tr("Bad Interval Length"),
tr("Interval length must be greater than zero!"));
return;
}
bool byTime = typeTime->isChecked();
QList<AddedInterval> results;
if (methodBestPower->isChecked()) {
if (peakPowerStandard->isChecked())
findPeakPowerStandard(ride, results);
else
findBests(byTime, ride, (byTime?windowSizeSecs:windowSizeMeters), maxIntervals, results, "");
}
else
findFirsts(byTime, ride, (byTime?windowSizeSecs:windowSizeMeters), maxIntervals, results);
// clear the table
clearResultsTable(resultsTable);
// populate the table
resultsTable->setRowCount(results.size());
int row = 0;
foreach (const AddedInterval &interval, results) {
double secs = interval.start;
double mins = floor(secs / 60);
secs = secs - mins * 60.0;
double hrs = floor(mins / 60);
mins = mins - hrs * 60.0;
// check box
QCheckBox *c = new QCheckBox;
c->setCheckState(Qt::Checked);
resultsTable->setCellWidget(row, 0, c);
// start time
QString start = "%1:%2:%3";
start = start.arg(hrs, 0, 'f', 0);
start = start.arg(mins, 2, 'f', 0, QLatin1Char('0'));
start = start.arg(round(secs), 2, 'f', 0, QLatin1Char('0'));
QTableWidgetItem *t = new QTableWidgetItem;
t->setText(start);
t->setFlags(t->flags() & (~Qt::ItemIsEditable));
resultsTable->setItem(row, 1, t);
QTableWidgetItem *n = new QTableWidgetItem;
n->setText(interval.name);
n->setFlags(n->flags() | (Qt::ItemIsEditable));
resultsTable->setItem(row, 2, n);
// hidden columns - start, stop
QString strt = QString("%1").arg(interval.start); // can't use secs as it gets modified
QTableWidgetItem *st = new QTableWidgetItem;
st->setText(strt);
resultsTable->setItem(row, 3, st);
QString stp = QString("%1").arg(interval.stop); // was interval.start+x
QTableWidgetItem *sp = new QTableWidgetItem;
sp->setText(stp);
resultsTable->setItem(row, 4, sp);
row++;
}
示例11: QTableWidgetItem
void QPhotorec::PartListWidget_updateUI()
{
list_part_t *element;
PartListWidget->setRowCount(0);
PartListWidget->setSortingEnabled(false);
for(element=list_part; element!=NULL; element=element->next)
{
const partition_t *partition=element->part;
if(partition->status!=STATUS_EXT_IN_EXT)
{
const arch_fnct_t *arch=partition->arch;
const int currentRow = PartListWidget->rowCount();
PartListWidget->setRowCount(currentRow + 1);
if(partition->order==NO_ORDER)
{
QTableWidgetItem *item = new QTableWidgetItem();
item->setData(0, "");
PartListWidget->setItem(currentRow, 0, item);
}
else
{
QTableWidgetItem *item = new QTableWidgetItem();
item->setData(0, partition->order);
PartListWidget->setItem(currentRow, 0, item);
}
{
QTableWidgetItem *item=new QTableWidgetItem(QString(get_partition_status(partition)));
item->setTextAlignment(Qt::AlignHCenter| Qt::AlignVCenter);
PartListWidget->setItem(currentRow, 1, item);
}
if(arch->get_partition_typename(partition)!=NULL)
PartListWidget->setItem(currentRow, 2, new QTableWidgetItem(QString(arch->get_partition_typename(partition))));
else if(arch->get_part_type)
PartListWidget->setItem(currentRow, 2, new QTableWidgetItem(tr("Sys=") + QString::number(arch->get_part_type(partition))));
else
PartListWidget->setItem(currentRow, 2, new QTableWidgetItem(tr("Unknown")));
if(partition->upart_type>0)
{
QTableWidgetItem *item=new QTableWidgetItem(QString(arch_none.get_partition_typename(partition)));
item->setToolTip(QString(partition->info));
PartListWidget->setItem(currentRow, 3, item);
}
else
{
PartListWidget->setItem(currentRow, 3, new QTableWidgetItem(""));
}
{
char sizeinfo[32];
QTableWidgetItem *item;
size_to_unit(partition->part_size, &sizeinfo[0]);
item=new QTableWidgetItem(QString(sizeinfo));
item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
PartListWidget->setItem(currentRow, 4, item);
/* Select the partition if it's already known */
if(selected_partition == partition)
PartListWidget->setCurrentItem(item);
}
{
QString partname="";
if(partition->partname[0]!='\0')
{
partname.sprintf("[%s]", partition->partname);
}
if(partition->fsname[0]!='\0')
{
QString fsname;
fsname.sprintf(" [%s]", partition->fsname);
partname.append(fsname);
}
PartListWidget->setItem(currentRow, 5, new QTableWidgetItem(partname));
}
}
}
PartListWidget->setSortingEnabled(true);
PartListWidget->sortByColumn(0, Qt::AscendingOrder);
PartListWidget->resizeColumnsToContents();
}
示例12: QTableWidgetItem
// ******************************************************************************************
// Displays data in the link_pairs_ data structure into a QtTableWidget
// ******************************************************************************************
void DefaultCollisionsWidget::loadCollisionTable()
{
int row = 0;
int progress_counter = 0;
// Show Progress Bar
progress_bar_->setValue(0);
QApplication::processEvents(); // allow the progress bar to be shown
progress_label_->setText("Loading table...");
// Setup Collision Table
collision_table_->setUpdatesEnabled(false); // prevent table from updating until we are completely done
collision_table_->setDisabled(true); // make sure we disable it so that the cellChanged event is not called
collision_table_->clearContents();
// Check if there are no disabled collisions (unprobable?)
if(link_pairs_.empty())
{
collision_table_->setRowCount(1);
QTableWidgetItem* no_collide = new QTableWidgetItem("No Link Pairs Of This Kind");
collision_table_->setItem(0, 0, no_collide);
}
else
{
// The table will be populated, so indicate it on the button
btn_generate_->setText("Regenerate Default Collision Matrix");
}
// Intially set the table to be worst-case scenario of every possible element pair
collision_table_->setRowCount( link_pairs_.size() );
for ( moveit_setup_assistant::LinkPairMap::const_iterator pair_it = link_pairs_.begin();
pair_it != link_pairs_.end();
++pair_it)
{
// Add link pair row if 1) it is disabled from collision checking or 2) the SHOW ALL LINK PAIRS checkbox is checked
if( pair_it->second.disable_check || collision_checkbox_->isChecked() )
{
// Create row elements
QTableWidgetItem* linkA = new QTableWidgetItem( pair_it->first.first.c_str() );
linkA->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
QTableWidgetItem* linkB = new QTableWidgetItem( pair_it->first.second.c_str() );
linkB->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
CheckboxSortWidgetItem* disable_check = new CheckboxSortWidgetItem( );
disable_check->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
if( pair_it->second.disable_check ) // Checked means no collision checking
disable_check->setCheckState(Qt::Checked);
else
disable_check->setCheckState(Qt::Unchecked);
QTableWidgetItem* reason = new QTableWidgetItem( longReasonsToString.at( pair_it->second.reason ) );
reason->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
// Insert row elements into collision table
collision_table_->setItem( row, 0, linkA);
collision_table_->setItem( row, 1, linkB);
collision_table_->setItem( row, 2, disable_check);
collision_table_->setItem( row, 3, reason);
// Increment row count
++row;
}
++progress_counter; // for calculating progress bar
if( progress_counter % 200 == 0 )
{
// Update Progress Bar
progress_bar_->setValue( progress_counter * 100 / link_pairs_.size() );
QApplication::processEvents(); // allow the progress bar to be shown
}
}
// Reduce the table size to only the number of used rows.
collision_table_->setRowCount( row );
// Resize headers. The hiding is a hack so that it resizes correctly
collision_table_->setVisible(false);
collision_table_->resizeColumnToContents(0);
collision_table_->resizeColumnToContents(1);
collision_table_->resizeColumnToContents(2);
collision_table_->resizeColumnToContents(3);
collision_table_->setVisible(true);
collision_table_->setUpdatesEnabled(true); // prevent table from updating until we are completely done
}
示例13: updateRow
void Monitor::updateRow(int tid, void * data){
int i;
int row;
QTableWidgetItem * item;
int64_t oldTimer;
link_task_data_t * task = (link_task_data_t*)data;
int stackUsage;
int heapUsage;
row = -1;
//find the tid if it exists in the table
for(i=0; i < ui->table->rowCount(); i++){
item = ui->table->item(i, THREAD_ID_COL);
if ( item != NULL ){
if ( tid == item->text().toInt() ){
row = i;
break;
}
} else {
row = i;
break;
}
}
if ( task->is_enabled ){
if ( row == -1 ){
row = ui->table->rowCount();
ui->table->insertRow(ui->table->rowCount());
}
} else {
if ( row != -1 ){
ui->table->removeRow(row);
}
return;
}
updateItem(row, NAME_COL, task->name);
if ( task->is_thread ){
updateItem(row, PROCESS_ID_COL, QString::number(task->pid, 10) + " (thread)");
} else {
updateItem(row, PROCESS_ID_COL, QString::number(task->pid, 10));
}
if ( task->tid == 0 ){
updateItem(row, THREAD_ID_COL, QString::number(task->tid, 10) + " (idle)");
updateItem(row, PRIO_COL, "n/a");
} else {
updateItem(row, THREAD_ID_COL, QString::number(task->tid, 10));
updateItem(row, PRIO_COL,
QString::number(task->prio_ceiling, 10) + " (" +
QString::number(task->prio, 10) + ")");
}
stackUsage = (task->mem_loc + task->mem_size) - task->stack_ptr;
if ( task->malloc_loc != 0 ){
heapUsage = task->malloc_loc - task->mem_loc;
} else {
heapUsage = 0;
}
updateItem(row, MEM_COL, QString::number( 100.0 * (stackUsage + heapUsage) / ( task->mem_size)));
updateItem(row, STACK_HEAP_COL, QString::number(task->mem_size) + " ("
+ QString::number(stackUsage, 10) + "/"
+ QString::number(heapUsage, 10) + ")");
item = ui->table->item(row, TASK_TIME_COL);
if ( item != NULL ){
oldTimer = item->text().toLongLong();
} else {
item = NULL;
oldTimer = 0;
}
updateItem(row, TASK_TIME_COL, QString::number(task->timer, 10));
updateItem(row, DELTA_TASK_TIME_COL, QString::number(task->timer - oldTimer, 10));
}
示例14: sql_clear
void MainWindow::fill_links() {
QString app_path = QApplication::applicationDirPath();
QString dbase_path = app_path + "/base.bz";
{
QSqlDatabase base = QSqlDatabase::addDatabase("QSQLITE", "fill-links");
base.setDatabaseName(dbase_path);
base.open();
if(base.isOpen() != true){
QMessageBox msgbox;
msgbox.setText("There was a problem with the database");
msgbox.setInformativeText("Due to unknown reason there was a problem with opening the database.\nThe problem accured during initial opening of the database.");
msgbox.exec();
}
else {
// the database is open
// clear the table
ui->tbl_links->clear();
for ( int i = 0; i <= 2; i++ ) {
ui->tbl_links->removeColumn(0);
}
QSqlQuery sql_clear(base);
sql_clear.prepare("SELECT * FROM data WHERE user LIKE '" + vApp->id_user() + "'");
sql_clear.exec();
while ( sql_clear.next() ) {
ui->tbl_links->removeRow(0);
}
// in case we just deleted one row on will be left behind ...
ui->tbl_links->removeRow(0);
// start structuring new table
ui->tbl_links->insertColumn(0);
ui->tbl_links->insertColumn(1);
QTableWidgetItem *naslov0 = new QTableWidgetItem;
QTableWidgetItem *naslov1 = new QTableWidgetItem;
naslov0->setText("ID");
naslov1->setText("Ime povezave");
ui->tbl_links->setHorizontalHeaderItem(0, naslov0);
ui->tbl_links->setHorizontalHeaderItem(1, naslov1);
ui->tbl_links->setColumnWidth(0, 35); // first column is with ID, so it can be short
ui->tbl_links->setColumnWidth(1, 300);
QSqlQuery sql_fill(base);
sql_fill.prepare("SELECT * FROM data WHERE user LIKE '" + vApp->id_user() + "' AND profile LIKE '" + vApp->id_profile() + "' AND campaign LIKE '" + vApp->id_campaign() + "'");
sql_fill.exec();
int row = 0;
while (sql_fill.next()) {
ui->tbl_links->insertRow(row);
ui->tbl_links->setRowHeight(row, 20);
int col = 0;
int i = 0;
QString polja[2] = {"id", "link_name"};
while (col <= 1) {
QTableWidgetItem *celica = new QTableWidgetItem;
celica->setText(sql_fill.value(sql_fill.record().indexOf(polja[i])).toString());
ui->tbl_links->setItem(row, col, celica);
col++;
i++;
}
row++;
}
}
base.close();
}
QSqlDatabase::removeDatabase("fill-links");
}
示例15: setRowCount
void MusicLrcSearchTableWidget::createSearchedItems(const QString &songname,
const QString &artistname, const QString &time)
{
int count;
setRowCount(count = m_downLoadManager->getSongIdIndex());
QTableWidgetItem *item = new QTableWidgetItem;
item->setData(MUSIC_CHECK_ROLE, false);
setItem(count - 1, 0, item);
item = new QTableWidgetItem;
item->setText(QFontMetrics(font()).elidedText(songname, Qt::ElideRight, 170));
item->setTextColor(QColor(50, 50, 50));
item->setTextAlignment(Qt::AlignCenter);
item->setToolTip(songname);
setItem(count - 1, 1, item);
item = new QTableWidgetItem;
item->setText(QFontMetrics(font()).elidedText(artistname, Qt::ElideRight, 144));
item->setTextColor(QColor(50, 50, 50));
item->setTextAlignment(Qt::AlignCenter);
item->setToolTip(artistname);
setItem(count - 1, 2, item);
item = new QTableWidgetItem(time);
item->setTextColor(QColor(50, 50, 50));
item->setTextAlignment(Qt::AlignCenter);
setItem(count - 1, 3, item);
item = new QTableWidgetItem;
item->setIcon(QIcon(QString::fromUtf8(":/radio/collect")));
setItem(count - 1, 4, item);
}