本文整理汇总了C++中QTableWidgetItem::toolTip方法的典型用法代码示例。如果您正苦于以下问题:C++ QTableWidgetItem::toolTip方法的具体用法?C++ QTableWidgetItem::toolTip怎么用?C++ QTableWidgetItem::toolTip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTableWidgetItem
的用法示例。
在下文中一共展示了QTableWidgetItem::toolTip方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tableCurrentItemChanged
void QgsDatumTransformDialog::tableCurrentItemChanged( QTableWidgetItem *, QTableWidgetItem * )
{
int row = mDatumTransformTableWidget->currentRow();
if ( row < 0 )
return;
QTableWidgetItem *srcItem = mDatumTransformTableWidget->item( row, 0 );
mLabelSrcDescription->setText( srcItem ? srcItem->toolTip() : QString() );
QTableWidgetItem *destItem = mDatumTransformTableWidget->item( row, 1 );
mLabelDstDescription->setText( destItem ? destItem->toolTip() : QString() );
setOKButtonEnabled();
}
示例2: receiveDataFinshed
void MusicCloudSharedSongTableWidget::receiveDataFinshed(const QNDataItems &items)
{
clear();
int count = items.count();
if(count == 0)
{
emit updateLabelMessage(tr("List Is Empty!"));
createUploadFileWidget();
return;
}
delete m_openFileWidget;
m_openFileWidget = nullptr;
setRowCount(count);
QHeaderView *headerview = horizontalHeader();
for(int i=0; i<count; ++i)
{
QNDataItem dataItem = items[i];
QTableWidgetItem *item = new QTableWidgetItem;
item->setData(MUSIC_DATAS_ROLE, QVariant::fromValue<QNDataItem>(dataItem));
setItem(i, 0, item);
item = new QTableWidgetItem;
item->setToolTip(dataItem.m_name);
item->setText(MusicUtils::Widget::elidedText(font(), item->toolTip(), Qt::ElideRight, headerview->sectionSize(1) - 20));
item->setTextColor(QColor(MusicUIObject::MColorStyle12_S));
item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
setItem(i, 1, item);
item = new QTableWidgetItem;
item->setToolTip(MusicUtils::Number::size2Label(dataItem.m_size));
item->setText(MusicUtils::Widget::elidedText(font(), item->toolTip(), Qt::ElideRight, headerview->sectionSize(2) - 5));
item->setTextColor(QColor(MusicUIObject::MColorStyle12_S));
item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
setItem(i, 2, item);
///insert server datas into caches
MusicUploadData data;
data.m_path = dataItem.m_name.trimmed();
data.m_name = data.m_path;
data.m_state = MusicUploadData::Successed;
if(!m_waitedFiles.contains(data))
{
m_waitedFiles << data;
}
}
m_currentUploadIndex = m_waitedFiles.count();
emit updateLabelMessage(tr("List Update Finished!"));
}
示例3: deleteFileToServer
void MusicCloudSharedSongTableWidget::deleteFileToServer()
{
if(currentRow() < 0)
{
return;
}
QTableWidgetItem *it = item(currentRow(), 1);
if(it == nullptr)
{
return;
}
MusicUploadData data;
data.m_path = it->toolTip();
data.m_name = data.m_path;
data.m_state = MusicUploadData::Successed;
m_waitedFiles.removeOne(data);
m_qnDeleteData->deleteDataToServer(QN_BUCKET, data.m_name);
if(--m_currentUploadIndex < 0)
{
m_currentUploadIndex = 0;
}
if(m_fileDialog->isVisible())
{
m_fileDialog->creatFilesManager(m_waitedFiles);
}
}
示例4: toolTip
int TableWidgetItem::toolTip ( lua_State * L )// const QString
{
QTableWidgetItem* lhs = ValueInstaller2<QTableWidgetItem>::check( L, 1 );
//QString* res = ValueInstaller2<QString>::create( L );
//*res = lhs->toolTip();
Util::push( L, lhs->toolTip() );
return 1;
}
示例5: createSearchedItem
void MusicLrcSearchTableWidget::createSearchedItem(const MusicSearchedItem &songItem)
{
int count = rowCount();
setRowCount(count + 1);
QHeaderView *headerview = horizontalHeader();
QTableWidgetItem *item = new QTableWidgetItem;
item->setData(MUSIC_CHECK_ROLE, false);
setItem(count, 0, item);
item = new QTableWidgetItem;
item->setToolTip(songItem.m_songName);
item->setText(MusicUtils::Widget::elidedText(font(), item->toolTip(), Qt::ElideRight, headerview->sectionSize(1) - 20));
item->setTextColor(QColor(100, 100, 100));
item->setTextAlignment(Qt::AlignCenter);
setItem(count, 1, item);
item = new QTableWidgetItem;
item->setToolTip(songItem.m_singerName);
item->setText(MusicUtils::Widget::elidedText(font(), item->toolTip(), Qt::ElideRight, headerview->sectionSize(2) - 20));
item->setTextColor(QColor(100, 100, 100));
item->setTextAlignment(Qt::AlignCenter);
setItem(count, 2, item);
item = new QTableWidgetItem(songItem.m_time);
item->setTextColor(QColor(100, 100, 100));
item->setTextAlignment(Qt::AlignCenter);
setItem(count, 3, item);
item = new QTableWidgetItem;
item->setIcon(QIcon(randToGetStrength()));
setItem(count, 4, item);
item = new QTableWidgetItem;
item->setIcon(QIcon(":/tiny/lb_server_type"));
item->setToolTip(songItem.m_type);
setItem(count, 5, item);
item = new QTableWidgetItem;
item->setIcon(QIcon(":/contextMenu/btn_download"));
setItem(count, 6, item);
}
示例6: resizeWindow
void MusicVideoTableWidget::resizeWindow(float delta)
{
QHeaderView *headerview = horizontalHeader();
headerview->resizeSection(0, 30*delta);
headerview->resizeSection(1, 210*delta);
headerview->resizeSection(2, 136*delta);
headerview->resizeSection(3, 30*delta);
headerview->resizeSection(4, 55*delta);
headerview->resizeSection(5, 24*delta);
headerview->resizeSection(6, 24*delta);
headerview->resizeSection(7, 24*delta);
//resize row
for(int i=0; i<rowCount(); ++i)
{
QTableWidgetItem *it = item(i, 1);
it->setText(QFontMetrics(font()).elidedText(it->toolTip(), Qt::ElideRight,
headerview->sectionSize(1) - 5));
it = item(i, 2);
it->setText(QFontMetrics(font()).elidedText(it->toolTip(), Qt::ElideRight,
headerview->sectionSize(2) - 5));
}
}
示例7: setupStatusContainer
QWidget* ProcessingManager::setupStatusContainer() {
queueLabel_ = new QLabel("Idle");
queueLabel_->setWordWrap(true);
QFont font = queueLabel_->font();
font.setBold(true);
queueLabel_->setFont(font);
processingLabel_ = new QLabel("Processing, ");
processingLabel_->setFont(font);
processingLabel_->setVisible(false);
QHBoxLayout* labelLayout = new QHBoxLayout();
labelLayout->setSpacing(0);
labelLayout->addStretch(0);
labelLayout->addWidget(processingLabel_, 0);
labelLayout->addWidget(queueLabel_, 0);
labelLayout->addStretch(1);
executeButton_ = new QPushButton(ApplicationData::icon("play"), tr("Start Processing"));
executeButton_->setCheckable(true);
executeButton_->setChecked(false);
connect(executeButton_, &QAbstractButton::clicked, this, &ProcessingManager::executeProcesses);
autoProcessButton_ = new QCheckBox("Automatically start processing, once there are images in queue");
autoProcessButton_->setChecked(ProjectPreferences().processAutoCheck());
connect(autoProcessButton_, &QCheckBox::toggled, [=](bool check){
ProjectPreferences().setProcessAutoCheck(check);
});
QHBoxLayout* buttonLayout = new QHBoxLayout();
buttonLayout->addStretch(0);
buttonLayout->addWidget(executeButton_, 0);
buttonLayout->addStretch(1);
buttonLayout->addWidget(autoProcessButton_, 0);
statusEntryTable_ = new QTableWidget(0, 3);
statusEntryTable_->setSelectionBehavior(QAbstractItemView::SelectRows);
statusEntryTable_->setAttribute(Qt::WA_MacShowFocusRect, 0);
QStringList labels;
labels << tr("Id") << tr("Image") << tr("Process");
statusEntryTable_->setHorizontalHeaderLabels(labels);
statusEntryTable_->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch);
statusEntryTable_->verticalHeader()->hide();
statusEntryTable_->setShowGrid(false);
statusEntryTable_->setAlternatingRowColors(true);
statusEntryTable_->setSortingEnabled(true);
statusEntryTable_->sortByColumn(2, Qt::SortOrder::AscendingOrder);
connect(statusEntryTable_, &QTableWidget::itemDoubleClicked, [ = ](QTableWidgetItem* it){
if (it && it->row() != -1) {
QTableWidgetItem* sibling = statusEntryTable_->item(it->row(), 1);
if (sibling && !sibling->toolTip().isEmpty()) {
ProjectImage* image = projectData.projectImage(sibling->toolTip());
projectData.openImage(image);
}
}
});
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->setMargin(10);
mainLayout->setSpacing(10);
mainLayout->addLayout(labelLayout);
mainLayout->addLayout(buttonLayout);
mainLayout->addWidget(statusEntryTable_);
GroupContainer* container = new GroupContainer;
container->setTitle("Current Status");
container->setContainerLayout(mainLayout);
return container;
}
示例8: updateTableValues
void BoundTableWidget::updateTableValues(bool noSignal)
{
if (_boundTo == NULL) {
return;
}
int columnCount = this->columnCount();
int rowCount = this->rowCount();
_groups.clear();
std::vector<std::string> verticalHeaders;
// Get verticalHeaders
for (int i = 0; i < rowCount; ++i) {
QTableWidgetItem *verticalHeaderItem = this->verticalHeaderItem(i);
QString header = "";
if (verticalHeaderItem != NULL) {
header = verticalHeaderItem->toolTip(); // Tooltip will have the entire text
}
verticalHeaders.push_back(fq(header));
}
for (int i = 0; i < columnCount; ++i) {
Options *newRow = static_cast<Options *>(_boundTo->rowTemplate()->clone());
OptionString *factorName = static_cast<OptionString *>(newRow->get("name"));
QString header = "";
QTableWidgetItem *horizontalHeaderItem = this->horizontalHeaderItem(i);
if (horizontalHeaderItem != NULL) {
header = horizontalHeaderItem->text();
} else {
// TODO: Revisit this part
continue;
}
factorName->setValue(fq(header));
OptionDoubleArray *option = static_cast<OptionDoubleArray *>(newRow->get("values"));
OptionVariables *headers = static_cast<OptionVariables *>(newRow->get("levels"));
headers->setValue(verticalHeaders);
std::vector<double> values;
std::vector<std::string> levels;
for (int j = 0; j < rowCount; ++j) {
QTableWidgetItem *rowItem = this->item(j, i);
QString content = "";
if (rowItem != NULL) {
content = rowItem->text();
}
values.push_back(content.toDouble());
}
option->setValue(values);
_groups.push_back(newRow);
}
if (noSignal)
_boundTo->blockSignals(true);
_boundTo->setValue(_groups);
if (noSignal)
_boundTo->blockSignals(false, false);
}