void RKObjectListView::settingsChanged () { RK_TRACE (APP); setRootObject (root_object); if (!root_object) { setFirstColumnSpanned (0, QModelIndex (), true); setItemDelegateForRow (0, rkdelegate); setFirstColumnSpanned (1, QModelIndex (), true); setItemDelegateForRow (1, rkdelegate); } resizeColumnToContents (0); }
DbHeaderListItem::DbHeaderListItem(QTreeWidget* parent, const QString& key) : QObject(parent), QTreeWidgetItem(parent) { // Reset all item flags: item is not selectable. setFlags(Qt::ItemIsEnabled); setDisabled(false); setExpanded(true); setFirstColumnSpanned(true); setTextAlignment(0, Qt::AlignCenter); QFont fn0(font(0)); fn0.setBold(true); fn0.setItalic(false); setFont(0, fn0); QFont fn1(font(1)); fn1.setBold(true); fn1.setItalic(false); setFont(1, fn1); setText(0, key); slotThemeChanged(); connect(ThemeManager::instance(), SIGNAL(signalThemeChanged()), this, SLOT(slotThemeChanged())); }
TimerBItem::TimerBItem(MCU_MSP430 *cpu) : QTreeWidgetItem(QTreeWidgetItem::UserType) { m_cpu = cpu; setText(0, "Timer B"); setFirstColumnSpanned(true); setExpanded(true); QTreeWidgetItem *item; Variant *v = m_cpu->getVariantPtr(); #define ADD_ITEM(METHOD, NAME) if (METHOD != 0) { \ item = new MemoryItem(this, NAME, METHOD, t); \ } VariableType t("uint16_t", 1, VariableType::Unsigned, VariableType::Base); ADD_ITEM(v->getTBCTL(), "TBCTL"); ADD_ITEM(v->getTBR(), "TBR"); ADD_ITEM(v->getTBCCTL0(), "TBCCTL0"); ADD_ITEM(v->getTBCCR0(), "TBCCR0"); ADD_ITEM(v->getTBCCTL1(), "TBCCTL1"); ADD_ITEM(v->getTBCCR1(), "TBCCR1"); ADD_ITEM(v->getTBCCTL2(), "TBCCTL2"); ADD_ITEM(v->getTBCCR2(), "TBCCR2"); ADD_ITEM(v->getTBCCTL3(), "TBCCTL3"); ADD_ITEM(v->getTBCCR3(), "TBCCR3"); ADD_ITEM(v->getTBCCTL4(), "TBCCTL4"); ADD_ITEM(v->getTBCCR4(), "TBCCR4"); ADD_ITEM(v->getTBCCTL5(), "TBCCTL5"); ADD_ITEM(v->getTBCCR5(), "TBCCR5"); ADD_ITEM(v->getTBCCTL6(), "TBCCTL6"); ADD_ITEM(v->getTBCCR6(), "TBCCR6"); ADD_ITEM(v->getTBIV(), "TBIV"); }
void DiveListView::fixMessyQtModelBehaviour() { QAbstractItemModel *m = model(); for(int i = 0; i < model()->rowCount(); i++){ if (m->rowCount( m->index(i, 0) ) != 0){ setFirstColumnSpanned(i, QModelIndex(), true); } } }
void QgsIdentifyResultsWebViewItem::loadFinished( bool ok ) { Q_UNUSED( ok ); QgsDebugMsg( "Entered" ); mWebView->show(); treeWidget()->setItemWidget( this, 0, mWebView ); // Span columns to save some space, must be after setItemWidget() to take efect. setFirstColumnSpanned( true ); }
SrtTableTreeWidgetItem(QTreeWidget *parent, const srt_stat_table *srt_table) : QTreeWidgetItem (parent, srt_table_type_), srt_table_(srt_table) { setText(0, srt_table_->name); setFirstColumnSpanned(true); setExpanded(true); for (int i = 0; i < srt_table_->num_procs; i++) { new SrtRowTreeWidgetItem(this, &srt_table_->procedures[i]); } }
PlacesView::PlacesView(QWidget* parent): QTreeView(parent), currentPath_(NULL) { setRootIsDecorated(false); setHeaderHidden(true); setIndentation(12); connect(this, &QTreeView::clicked, this, &PlacesView::onClicked); connect(this, &QTreeView::pressed, this, &PlacesView::onPressed); setIconSize(QSize(24, 24)); // FIXME: we may share this model amont all views model_ = new PlacesModel(this); setModel(model_); QHeaderView* headerView = header(); headerView->setSectionResizeMode(0, QHeaderView::Stretch); headerView->setSectionResizeMode(1, QHeaderView::Fixed); headerView->setStretchLastSection(false); expandAll(); // FIXME: is there any better way to make the first column span the whole row? setFirstColumnSpanned(0, QModelIndex(), true); // places root setFirstColumnSpanned(1, QModelIndex(), true); // devices root setFirstColumnSpanned(2, QModelIndex(), true); // bookmarks root // the 2nd column is for the eject buttons setSelectionBehavior(QAbstractItemView::SelectRows); // FIXME: why this does not work? setAllColumnsShowFocus(false); setAcceptDrops(true); setDragEnabled(true); // update the umount button's column width based on icon size onIconSizeChanged(iconSize()); #if QT_VERSION >= QT_VERSION_CHECK(5, 5, 0) // this signal requires Qt >= 5.5 connect(this, &QAbstractItemView::iconSizeChanged, this, &PlacesView::onIconSizeChanged); #endif }
ExpertPacketTreeWidgetItem(QTreeWidgetItem *parent, expert_info_t *expert_info = NULL) : QTreeWidgetItem (parent, packet_type_), packet_num_(0), hf_id_(-1) { if (expert_info) { packet_num_ = expert_info->packet_num; hf_id_ = expert_info->hf_index; protocol_ = expert_info->protocol; summary_ = expert_info->summary; } setFirstColumnSpanned(true); setText(packet_col_, QString("%1: %2") .arg(packet_num_) .arg(summary_)); }
void views::treeView::needExpanding(QModelIndex parent, int start, int end) { // QVariant var=parent.data(EXPAND_ROLE); QVariant var; if( parent.isValid() ) { var=parent.data(SPAND_ROLE); } else { var=model()->property(SPAN_PROP); } if(var.canConvert<bool>() && var.toBool() ) { for(int i=start;i<=end;i++) { setFirstColumnSpanned(i,parent,true); } } }
int RangeTreeWidget::addRange(const QVariant &min, const QVariant &max, const QString &title) { int row = m_data.size(); Range range; range.min = min; range.max = max; range.title = title; range.id = row; m_ranges << range; m_data [row] = new QStandardItem(title); m_model->insertRow(row, m_data [row]); setFirstColumnSpanned(row, QModelIndex(), true); // openPersistentEditor(model()->index(row, 0, QModelIndex())); // expand the first row if(row == 0) { setExpanded(model()->index(row, 0, QModelIndex()), true); } return row; }
ezQtShortcutEditorDlg::ezQtShortcutEditorDlg(QWidget* parent) : QDialog(parent) { setupUi(this); EZ_VERIFY(connect(Shortcuts, SIGNAL(itemSelectionChanged()), this, SLOT(SlotSelectionChanged())) != nullptr, "signal/slot connection failed"); m_iSelectedAction = -1; KeyEditor->setEnabled(false); ezMap<ezString, ezMap<ezString, ezInt32>> SortedItems; { auto itActions = ezActionManager::GetActionIterator(); while (itActions.IsValid()) { if (itActions.Value()->m_Type == ezActionType::Action) { SortedItems[itActions.Value()->m_sCategoryPath][itActions.Value()->m_sActionName] = m_ActionDescs.GetCount(); m_ActionDescs.PushBack(itActions.Value()); } itActions.Next(); } } { ezQtScopedBlockSignals bs(Shortcuts); ezQtScopedUpdatesDisabled ud(Shortcuts); Shortcuts->setAlternatingRowColors(true); Shortcuts->setEditTriggers(QAbstractItemView::EditTrigger::NoEditTriggers); Shortcuts->setExpandsOnDoubleClick(true); ezStringBuilder sTemp; for (auto it = SortedItems.GetIterator(); it.IsValid(); ++it) { auto pParent = new QTreeWidgetItem(); pParent->setData(0, Qt::DisplayRole, it.Key().GetData()); Shortcuts->addTopLevelItem(pParent); pParent->setExpanded(true); pParent->setFirstColumnSpanned(true); pParent->setFlags(Qt::ItemFlag::ItemIsEnabled); QFont font = pParent->font(0); font.setBold(true); pParent->setFont(0, font); for (auto it2 : it.Value()) { const auto& item = m_ActionDescs[it2.Value()]; auto pItem = new QTreeWidgetItem(pParent); /// \todo Instead of removing &, replace it by underlined text (requires formatted text output) sTemp = ezTranslate(item->m_sActionName); sTemp.ReplaceAll("&", ""); pItem->setData(0, Qt::UserRole, it2.Value()); pItem->setData(0, Qt::DisplayRole, item->m_sActionName.GetData()); pItem->setData(1, Qt::DisplayRole, sTemp.GetData()); pItem->setData(2, Qt::DisplayRole, item->m_sShortcut.GetData()); pItem->setData(3, Qt::DisplayRole, ezTranslateTooltip(item->m_sActionName)); if (item->m_sShortcut == item->m_sDefaultShortcut) pItem->setBackground(2, QBrush()); else pItem->setBackgroundColor(2, Qt::darkYellow); sTemp.Set("Default: ", item->m_sDefaultShortcut.IsEmpty() ? "<none>" : item->m_sDefaultShortcut); pItem->setToolTip(2, QString::fromUtf8(sTemp.GetData())); } } Shortcuts->resizeColumnToContents(0); Shortcuts->resizeColumnToContents(2); } ButtonAssign->setEnabled(false); ButtonRemove->setEnabled(false); ButtonReset->setEnabled(false); }
MdKeyListViewItem::MdKeyListViewItem(QTreeWidget* const parent, const QString& key) : QObject(parent), QTreeWidgetItem(parent) { m_key = key; m_decryptedKey = key; // Standard Exif key descriptions. if (key == QLatin1String("Iop")) { m_decryptedKey = i18n("Interoperability"); } else if (key == QLatin1String("Image")) { m_decryptedKey = i18n("Image Information"); } else if (key == QLatin1String("Photo")) { m_decryptedKey = i18n("Photograph Information"); } else if (key == QLatin1String("GPSInfo")) { m_decryptedKey = i18n("Global Positioning System"); } else if (key == QLatin1String("Thumbnail")) { m_decryptedKey = i18n("Embedded Thumbnail"); } // Standard IPTC key descriptions. else if (key == QLatin1String("Envelope")) { m_decryptedKey = i18n("IIM Envelope"); } else if (key == QLatin1String("Application2")) { m_decryptedKey = i18n("IIM Application 2"); } // Standard XMP key descriptions. else if (key == QLatin1String("aux")) { m_decryptedKey = i18n("Additional Exif Properties"); } else if (key == QLatin1String("crs")) { m_decryptedKey = i18n("Camera Raw"); } else if (key == QLatin1String("dc")) { m_decryptedKey = i18n("Dublin Core"); } else if (key == QLatin1String("digiKam")) { m_decryptedKey = i18n("digiKam schema"); } else if (key == QLatin1String("exif")) { m_decryptedKey = i18n("Exif-specific Properties"); } else if (key == QLatin1String("iptc")) { m_decryptedKey = i18n("IPTC Core"); } else if (key == QLatin1String("iptcExt")) { m_decryptedKey = i18n("IPTC Extension schema"); } else if (key == QLatin1String("MicrosoftPhoto")) { m_decryptedKey = i18n("Microsoft Photo"); } else if (key == QLatin1String("pdf")) { m_decryptedKey = i18n("Adobe PDF"); } else if (key == QLatin1String("photoshop")) { m_decryptedKey = i18n("Adobe Photoshop"); } else if (key == QLatin1String("plus")) { m_decryptedKey = i18n("PLUS License Data Format Schema"); } else if (key == QLatin1String("tiff")) { m_decryptedKey = i18n("TIFF Properties"); } else if (key == QLatin1String("xmp")) { m_decryptedKey = i18n("Basic Schema"); } else if (key == QLatin1String("xmpBJ")) { m_decryptedKey = i18n("Basic Job Ticket"); } else if (key == QLatin1String("xmpDM")) { m_decryptedKey = i18n("Dynamic Media"); } else if (key == QLatin1String("xmpMM")) { m_decryptedKey = i18n("Media Management "); } else if (key == QLatin1String("xmpRights")) { m_decryptedKey = i18n("Rights Management"); } else if (key == QLatin1String("xmpTPg")) { m_decryptedKey = i18n("Paged-Text"); } // Additional XMP key descriptions. else if (key == QLatin1String("mwg-rs")) { m_decryptedKey = i18n("Metadata Working Group Regions"); } else if (key == QLatin1String("dwc")) { m_decryptedKey = i18n("Darwin Core"); } // Reset all item flags: item is not selectable. setFlags(Qt::ItemIsEnabled); setDisabled(false); setExpanded(true); setFirstColumnSpanned(true); setTextAlignment(0, Qt::AlignCenter); QFont fn0(font(0)); fn0.setBold(true); fn0.setItalic(false); setFont(0, fn0); QFont fn1(font(1)); fn1.setBold(true); fn1.setItalic(false); setFont(1, fn1); setText(0, m_decryptedKey); slotThemeChanged(); connect(ThemeManager::instance(), SIGNAL(signalThemeChanged()), this, SLOT(slotThemeChanged())); }
void CLvQInfo::fillInfo(ofiItem_t *data, bool update) ///////////////////////////////////////////////////// { m_bFilled = true; m_info = *data; m_parent->setItemText(0, tr("Quick information : ") + data->title); QStandardItemModel *m = (QStandardItemModel *)model(); if (!update) { m->removeRows(0, m->rowCount()); } for (int i = 0; i < data->tTextItem.count(); i++) { ofiTextItem_t *item = &data->tTextItem[i]; if (update) { m->item(i, 1)->setText(item->value); } else { QList <QStandardItem *> tRow; QStandardItem *label = new QStandardItem; QStandardItem *value = new QStandardItem; QFont f = label->font(); f.setPointSizeF(f.pointSizeF() - 0.25); label->setFont(f); value->setFont(f); label->setText(item->label); label->setToolTip(item->label); if (item->bBold) { QFont f = label->font(); f.setBold(true); label->setFont(f); } if (!item->bIsTitle) { value->setText(item->value); value->setToolTip(item->value); } tRow.append(label); tRow.append(value); m->appendRow(tRow); if (item->bIsTitle) { setFirstColumnSpanned(i, QModelIndex(), true); } } } }
void setUpRootIndex(int row) { expand(model()->index(row, 0)); setFirstColumnSpanned(row, QModelIndex(), true); }
ChatPanel::ChatPanel(const QStringList &botNames, UsersColorsPool *colorsPool, TextEditorModifier *chatInputModifier, EmojiManager *emojiManager) : QWidget(nullptr), ui(new Ui::ChatPanel), emojiManager(emojiManager), botNames(botNames), autoTranslating(false), colorsPool(colorsPool), unreadedMessages(0), on(false) { ui->setupUi(this); QVBoxLayout *contentLayout = new QVBoxLayout(ui->scrollContent); contentLayout->setContentsMargins(0, 0, 0, 0); ui->scrollContent->setLayout(contentLayout); ui->topicLabel->setVisible(false); // disable blue border when QLineEdit has focus in mac ui->chatText->setAttribute(Qt::WA_MacShowFocusRect, 0); previousVerticalScrollBarMaxValue = ui->chatScroll->verticalScrollBar()->value(); emojiWidget = new EmojiWidget(emojiManager, this); emojiWidget->setVisible(false); qobject_cast<QVBoxLayout *>(layout())->insertWidget(layout()->count()-2, emojiWidget); emojiWidget->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::MinimumExpanding); auto emojiIcon = IconFactory::createChatEmojiIcon(Qt::black, on); emojiAction = ui->chatText->addAction(emojiIcon, QLineEdit::LeadingPosition); if (chatInputModifier) { bool finishEditorPressingReturnKey = false; chatInputModifier->modify(ui->chatText, finishEditorPressingReturnKey); } ui->scrollContent->installEventFilter(this); setupSignals(); instances.append(this); auto root = new QTreeWidgetItem(ui->treeWidget, QStringList()); root->setFirstColumnSpanned(true); // the root col span ui->treeWidget->addTopLevelItem(root); connect(ui->treeWidget, &QTreeWidget::collapsed, [=](){ ui->treeWidget->setMaximumHeight(20); }); connect(ui->treeWidget, &QTreeWidget::expanded, [=](){ auto root = ui->treeWidget->topLevelItem(0); Q_ASSERT(root); if (root->childCount() > 0) ui->treeWidget->setMaximumHeight(150); }); connect(ui->treeWidget, &QTreeWidget::clicked, [=](QModelIndex index){ auto root = ui->treeWidget->topLevelItem(0); Q_ASSERT(root); if (root->isExpanded()) ui->treeWidget->collapse(index); else ui->treeWidget->expand(index); }); ui->treeWidget->setMaximumHeight(20); ui->treeWidget->setVisible(false); ui->treeWidget->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->treeWidget, &QTreeWidget::customContextMenuRequested, this, &ChatPanel::showContextMenu); ui->buttonOnOff->setIcon(IconFactory::createChatOnOffIcon(Qt::black)); ui->buttonOnOff->setChecked(on); connect(ui->buttonOnOff, &QPushButton::toggled, this, &ChatPanel::toggleOnOff); updatePlaceHolderText(); updateEmojiIcon(); showConnectedUsersWidget(false); }