void FlyLinks::PopulateTreeWidgetItems( const QMap<QString,QString>& objDataMap) { QMapIterator<QString,QString> objIterMap(objDataMap); QFont font; font.setPointSizeF(8.25); font.setUnderline(true); m_pObjPopup->setSortingEnabled(false); QBrush brush(QColor(85, 0, 255, 255)); brush.setStyle(Qt::NoBrush); QTreeWidgetItem *pItem = new QTreeWidgetItem(m_pObjPopup); pItem = m_pObjPopup->headerItem(); pItem->setText(0,tr("1")); pItem->setFont(0, font); pItem->setForeground(0, brush); pItem->setTextAlignment(0, Qt::AlignLeft); m_pObjTreeItemsVec.push_back(pItem); int iCount = 0; while(objIterMap.hasNext()) { objIterMap.next(); QBrush brush(QColor(85, 0, 255, 255)); brush.setStyle(Qt::NoBrush); QTreeWidgetItem *pItem = new QTreeWidgetItem(m_pObjPopup); pItem = m_pObjPopup->topLevelItem(iCount++); pItem->setText(0,objIterMap.key()); pItem->setData(0,Qt::UserRole,objIterMap.value()); pItem->setFont(0, font); pItem->setForeground(0, brush); pItem->setTextAlignment(0, Qt::AlignLeft); } }
void AddComponentDialog::searchComponents(const QString& input) { setSelectedComponent(nullptr); mUi->treeComponents->clear(); // min. 2 chars to avoid freeze on entering first character due to huge result if (input.length() > 1) { SearchResult result = searchComponentsAndDevices(input); QHashIterator<FilePath, SearchResultComponent> cmpIt(result); while (cmpIt.hasNext()) { cmpIt.next(); QTreeWidgetItem* cmpItem = new QTreeWidgetItem(mUi->treeComponents); cmpItem->setText(0, cmpIt.value().name); cmpItem->setData(0, Qt::UserRole, cmpIt.key().toStr()); QHashIterator<FilePath, SearchResultDevice> devIt(cmpIt.value().devices); while (devIt.hasNext()) { devIt.next(); QTreeWidgetItem* devItem = new QTreeWidgetItem(cmpItem); devItem->setText(0, devIt.value().name); devItem->setData(0, Qt::UserRole, devIt.key().toStr()); devItem->setText(1, devIt.value().pkgName); devItem->setTextAlignment(1, Qt::AlignRight); } cmpItem->setText(1, QString("[%1]").arg(cmpIt.value().devices.count())); cmpItem->setTextAlignment(1, Qt::AlignRight); cmpItem->setExpanded(!cmpIt.value().match); } } mUi->treeComponents->sortByColumn(0, Qt::AscendingOrder); }
void K3b::ImageWritingDialog::Private::createCueBinItems( const QString& cueFile, const QString& imageFile ) { QTreeWidgetItem* isoRootItem = new QTreeWidgetItem( infoView ); isoRootItem->setText( 0, i18n("Detected:") ); isoRootItem->setText( 1, i18n("Cue/bin image") ); isoRootItem->setForeground( 0, infoTextColor ); isoRootItem->setIcon( 1, KIcon( "application-x-cd-image") ); isoRootItem->setTextAlignment( 0, Qt::AlignRight ); QTreeWidgetItem* item = new QTreeWidgetItem( infoView ); item->setText( 0, i18n("Filesize:") ); item->setText( 1, KIO::convertSize( K3b::filesize(KUrl(imageFile)) ) ); item->setForeground( 0, infoTextColor ); item->setTextAlignment( 0, Qt::AlignRight ); item = new QTreeWidgetItem( infoView ); item->setText( 0, i18n("Image file:") ); item->setText( 1, imageFile ); item->setForeground( 0, infoTextColor ); item->setTextAlignment( 0, Qt::AlignRight ); item = new QTreeWidgetItem( infoView ); item->setText( 0, i18n("Cue file:") ); item->setText( 1, cueFile ); item->setForeground( 0, infoTextColor ); item->setTextAlignment( 0, Qt::AlignRight ); }
// Constructor. qtractorMidiListView::qtractorMidiListView ( QWidget *pParent ) : qtractorFileListView(qtractorFileList::Midi, pParent) { QTreeWidget::setColumnCount(qtractorMidiListView::LastColumn + 1); QTreeWidgetItem *pHeaderItem = QTreeWidget::headerItem(); pHeaderItem->setText(qtractorMidiListView::Name, tr("Name")); pHeaderItem->setText(qtractorMidiListView::Format, tr("Fmt")); pHeaderItem->setText(qtractorMidiListView::Tracks, tr("Tracks")); pHeaderItem->setText(qtractorMidiListView::Resolution, tr("tpqn")); pHeaderItem->setText(qtractorMidiListView::Path, tr("Path")); pHeaderItem->setText(qtractorMidiListView::LastColumn, QString::null); pHeaderItem->setTextAlignment( qtractorMidiListView::Format, Qt::AlignRight); pHeaderItem->setTextAlignment( qtractorMidiListView::Tracks, Qt::AlignRight); pHeaderItem->setTextAlignment( qtractorMidiListView::Resolution, Qt::AlignRight); QHeaderView *pHeader = QTreeWidget::header(); pHeader->resizeSection(qtractorMidiListView::Name, 160); QTreeWidget::resizeColumnToContents(qtractorMidiListView::Format); QTreeWidget::resizeColumnToContents(qtractorMidiListView::Tracks); QTreeWidget::resizeColumnToContents(qtractorMidiListView::Resolution); pHeader->resizeSection(qtractorMidiListView::Path, 160); }
UpdateCenterImpl::UpdateCenterImpl(Updates *updates, bool autoDownloadAndInstall, QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { setupUi(this); // resize for macosx #ifndef Q_OS_WIN32 resize(630, 366); #endif closedByButton = false; // version lblxVSTVersion->setText(QString(lblxVSTVersion->text()).arg(PROGRAM_VERSION)); // set update class this->updates = updates; // configure updates list QStringList headers; headers << tr(" File ") << tr(" Version ") << tr(" Size ") << tr(" Progress "); // add the headers lsvUpdates->setHeaderLabels(headers); // change headers sizes QFontMetrics fm = fontMetrics(); QHeaderView *header = lsvUpdates->header(); // resize header->resizeSection(1, fm.width(headers.at(0) + "9.99.999 alpha")); header->resizeSection(2, fm.width(headers.at(1) + " 1024,99Mb ")); // configure resize mode header->setHighlightSections(false); header->setStretchLastSection(false); header->setSectionResizeMode(0, QHeaderView::Stretch); // set header text aligment QTreeWidgetItem * headerItem = lsvUpdates->headerItem(); headerItem->setTextAlignment(1, Qt::AlignHCenter | Qt::AlignVCenter); headerItem->setTextAlignment(2, Qt::AlignRight | Qt::AlignVCenter); headerItem->setTextAlignment(3, Qt::AlignHCenter | Qt::AlignVCenter); // fill data fillUpdates(); // signals connect(lsvUpdates, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(itemChanged(QTreeWidgetItem*, int))); connect(btnCancel, SIGNAL(clicked()), this, SLOT(btnCancelClicked())); connect(btnUpdate, SIGNAL(clicked()), this, SLOT(btnUpdateClicked())); // updater connect(updates, SIGNAL(downloadingUpdate(int, int, int)), this, SLOT(downloadingUpdate(int, int, int))); connect(updates, SIGNAL(downloadUpdateFinished(int)), this, SLOT(downloadUpdateFinished(int))); connect(updates, SIGNAL(downloadUpdateError(int)), this, SLOT(downloadUpdateError(int))); connect(updates, SIGNAL(downloadsFinished()), this, SLOT(downloadsFinished())); connect(updates, SIGNAL(readyToInstallUpdates()), this, SLOT(readyToInstallUpdates())); connect(updates, SIGNAL(failedToInstallUpdates()), this, SLOT(failedToInstallUpdates())); // if auto download & install updates, then... if (autoDownloadAndInstall) { // disable update button lsvUpdates->setEnabled(false); btnUpdate->setEnabled(false); // start automatically to download updates (in 500ms) QTimer::singleShot(500, this, SLOT(btnUpdateClicked())); } }
void PublicationDashboardWindow::updateTreeWidget() { ui.treeWidget->clear(); //find records in range QList<PublicationRecord> recordsInRange = filterByDateRange(records, ui.startDateSelector->date(), ui.endDateSelector->date()); //count the records QMap<QString, int> pubTypeSummary; QMap<QString, QMap<QString, int>> nameSummary; QMap<QString, QMap<QString, QSet<QString>>> titleSummary; for (const PublicationRecord &record : recordsInRange) { ++pubTypeSummary[record.type]; ++nameSummary[record.type][record.memberName]; titleSummary[record.type][record.memberName].insert(record.title); } //build the view QTreeWidgetItem *root = new QTreeWidgetItem(ui.treeWidget, (QStringList() << "Publications" << "" << "" << "" << QString::number(recordsInRange.size()))); root->setTextAlignment(totalNumColumn, Qt::AlignRight); ui.treeWidget->expandItem(root); for (auto pubType = pubTypeSummary.begin(); pubType != pubTypeSummary.end(); ++pubType) { QTreeWidgetItem *pubNode = new QTreeWidgetItem(root, (QStringList() << "" << pubType.key() << "" << "" << QString::number(pubType.value()))); pubNode->setTextAlignment(totalNumColumn, Qt::AlignRight); QMap<QString, int> &currNameSummary = nameSummary[pubType.key()]; for (auto name = currNameSummary.begin(); name != currNameSummary.end(); ++name) { QTreeWidgetItem *nameNode = new QTreeWidgetItem(pubNode, (QStringList() << "" << "" << name.key() << "" << QString::number(name.value()))); nameNode->setTextAlignment(totalNumColumn, Qt::AlignRight); QSet<QString> &currTitleSummary = titleSummary[pubType.key()][name.key()]; for (QString &title : sortSet(currTitleSummary)) { QTreeWidgetItem *titleNode = new QTreeWidgetItem(nameNode, (QStringList() << "" << "" << "" << title << "")); titleNode->setTextAlignment(totalNumColumn, Qt::AlignRight); } } } //set the dropdown values ui.visualizationFacultyNameSelector->clear(); ui.visualizationFacultyNameSelector->addItems(listFacultyNames(recordsInRange)); setColumnWidths(); }
ChatLobbyWidget::ChatLobbyWidget(QWidget *parent, Qt::WFlags flags) : RsAutoUpdatePage(5000, parent, flags) { setupUi(this); QObject::connect(NotifyQt::getInstance(), SIGNAL(lobbyListChanged()), SLOT(lobbyChanged())); QObject::connect(NotifyQt::getInstance(), SIGNAL(chatLobbyEvent(qulonglong,int,const QString&,const QString&)), this, SLOT(displayChatLobbyEvent(qulonglong,int,const QString&,const QString&))); QObject::connect(NotifyQt::getInstance(), SIGNAL(chatLobbyInviteReceived()), this, SLOT(readChatLobbyInvites())); QObject::connect(lobbyTreeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(lobbyTreeWidgetCostumPopupMenu())); QObject::connect(lobbyTreeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)), this, SLOT(itemDoubleClicked(QTreeWidgetItem*,int))); QObject::connect(newlobbypushButton, SIGNAL(clicked()), this, SLOT(createChatLobby())); compareRole = new RSTreeWidgetItemCompareRole; compareRole->setRole(COLUMN_NAME, ROLE_SORT); lobbyTreeWidget->setColumnCount(COLUMN_COUNT); lobbyTreeWidget->sortItems(COLUMN_NAME, Qt::AscendingOrder); QTreeWidgetItem *headerItem = lobbyTreeWidget->headerItem(); headerItem->setText(COLUMN_NAME, tr("Name")); headerItem->setText(COLUMN_USER_COUNT, tr("Count")); headerItem->setText(COLUMN_TOPIC, tr("Topic")); headerItem->setTextAlignment(COLUMN_NAME, Qt::AlignHCenter | Qt::AlignVCenter); headerItem->setTextAlignment(COLUMN_TOPIC, Qt::AlignHCenter | Qt::AlignVCenter); headerItem->setTextAlignment(COLUMN_USER_COUNT, Qt::AlignHCenter | Qt::AlignVCenter); QHeaderView *header = lobbyTreeWidget->header(); header->setResizeMode(COLUMN_NAME, QHeaderView::Interactive); header->setResizeMode(COLUMN_USER_COUNT, QHeaderView::Interactive); header->setResizeMode(COLUMN_TOPIC, QHeaderView::Stretch); lobbyTreeWidget->setColumnWidth(COLUMN_NAME, 200); lobbyTreeWidget->setColumnWidth(COLUMN_USER_COUNT, 50); privateLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER); privateLobbyItem->setText(COLUMN_NAME, tr("Private Lobbies")); privateLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "1"); privateLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, RS_CHAT_LOBBY_PRIVACY_LEVEL_PRIVATE); lobbyTreeWidget->insertTopLevelItem(0, privateLobbyItem); publicLobbyItem = new RSTreeWidgetItem(compareRole, TYPE_FOLDER); publicLobbyItem->setText(COLUMN_NAME, tr("Public Lobbies")); publicLobbyItem->setData(COLUMN_NAME, ROLE_SORT, "2"); publicLobbyItem->setData(COLUMN_DATA, ROLE_PRIVACYLEVEL, RS_CHAT_LOBBY_PRIVACY_LEVEL_PUBLIC); lobbyTreeWidget->insertTopLevelItem(1, publicLobbyItem); lobbyTreeWidget->expandAll(); lobbyChanged(); }
void RoomSelector::retranslateUi() { setTitle(tr("Rooms")); joinButton->setText(tr("Joi&n")); QTreeWidgetItem *header = roomList->headerItem(); header->setText(0, tr("Room")); header->setText(1, tr("Description")); header->setText(2, tr("Permissions")); header->setText(3, tr("Players")); header->setText(4, tr("Games")); header->setTextAlignment(2, Qt::AlignRight); header->setTextAlignment(3, Qt::AlignRight); header->setTextAlignment(4, Qt::AlignRight); }
QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool* tool, Qt::WFlags f ) : QDialog( tool->canvas()->topLevelWidget(), f ), mTool( tool ) { setupUi( this ); QPushButton *nb = new QPushButton( tr( "&New" ) ); buttonBox->addButton( nb, QDialogButtonBox::ActionRole ); connect( nb, SIGNAL( clicked() ), this, SLOT( restart() ) ); mMeasureArea = tool->measureArea(); mTotal = 0.; // Set one cell row where to update current distance // If measuring area, the table doesn't get shown QTreeWidgetItem* item = new QTreeWidgetItem( QStringList( QString::number( 0, 'f', 1 ) ) ); item->setTextAlignment( 0, Qt::AlignRight ); mTable->addTopLevelItem( item ); //mTable->setHeaderLabels(QStringList() << tr("Segments (in meters)") << tr("Total") << tr("Azimuth") ); QSettings settings; int s = settings.value( "/qgis/measure/projectionEnabled", "2" ).toInt(); if ( s == 2 ) mcbProjectionEnabled->setCheckState( Qt::Checked ); else mcbProjectionEnabled->setCheckState( Qt::Unchecked ); connect( mcbProjectionEnabled, SIGNAL( stateChanged( int ) ), this, SLOT( changeProjectionEnabledState() ) ); updateUi(); }
void OpenEditorsWindow::addHistoryItems(const QList<EditLocation> &history, EditorView *view, OpenEditorsModel *model, QSet<IDocument *> &documentsDone) { foreach (const EditLocation &hi, history) { if (hi.document.isNull() || documentsDone.contains(hi.document)) continue; documentsDone.insert(hi.document.data()); QString title = model->displayNameForDocument(hi.document); QTC_ASSERT(!title.isEmpty(), continue); QTreeWidgetItem *item = new QTreeWidgetItem(); if (hi.document->isModified()) title += tr("*"); item->setIcon(0, !hi.document->fileName().isEmpty() && hi.document->isFileReadOnly() ? model->lockedIcon() : m_emptyIcon); item->setText(0, title); item->setToolTip(0, hi.document->fileName()); item->setData(0, Qt::UserRole, QVariant::fromValue(hi.document.data())); item->setData(0, Qt::UserRole+1, QVariant::fromValue(view)); item->setTextAlignment(0, Qt::AlignLeft); m_editorList->addTopLevelItem(item); if (m_editorList->topLevelItemCount() == 1){ m_editorList->setCurrentItem(item); } } }
void QgsMeasureDialog::addPoint( QgsPoint &p ) { Q_UNUSED( p ); int numPoints = mTool->points().size(); if ( mMeasureArea && numPoints > 2 ) { double area = mDa.measurePolygon( mTool->points() ); editTotal->setText( formatArea( area ) ); } else if ( !mMeasureArea && numPoints >= 1 ) { if ( !mTool->done() ) { QTreeWidgetItem * item = new QTreeWidgetItem( QStringList( QLocale::system().toString( 0.0, 'f', mDecimalPlaces ) ) ); item->setTextAlignment( 0, Qt::AlignRight ); mTable->addTopLevelItem( item ); mTable->scrollToItem( item ); } if ( numPoints > 1 ) { mTotal = mDa.measureLine( mTool->points() ); editTotal->setText( formatDistance( mTotal ) ); } } QgsDebugMsg( "Exiting" ); }
void qsldb::showQslCards(QString q) { cardList->clear(); res = db->Query(q); if(db->GetState()) { qDebug() << db->GetError(); } n = 0; while( res->Next() != 0) { r = 1; i = 0; rows = res->GetCurrentRow(); QTreeWidgetItem *item = new QTreeWidgetItem(cardList); item->setText(i++,rows->GetField(r++)); item->setText(i++,rows->GetField(r++)); item->setText(i++,rows->GetField(r++)); item->setText(i++,rows->GetField(r++)); item->setText(i,rows->GetField(r++)); item->setTextAlignment(i++,Qt::AlignCenter); item->setText(i++,rows->GetField(r++)); n++; } res->Close(); p.setNum(n); labeldbSize->setText("Qsl Bestand: "+p); }
//! [5] void GSuggestCompletion::showCompletion(const QStringList &choices, const QStringList &hits) { if (choices.isEmpty() || choices.count() != hits.count()) return; const QPalette &pal = editor->palette(); QColor color = pal.color(QPalette::Disabled, QPalette::WindowText); popup->setUpdatesEnabled(false); popup->clear(); for (int i = 0; i < choices.count(); ++i) { QTreeWidgetItem * item; item = new QTreeWidgetItem(popup); item->setText(0, choices[i]); item->setText(1, hits[i]); item->setTextAlignment(1, Qt::AlignRight); item->setTextColor(1, color); } popup->setCurrentItem(popup->topLevelItem(0)); popup->resizeColumnToContents(0); popup->resizeColumnToContents(1); popup->adjustSize(); popup->setUpdatesEnabled(true); int h = popup->sizeHintForRow(0) * qMin(7, choices.count()) + 3; popup->resize(popup->width(), h); popup->move(editor->mapToGlobal(QPoint(0, editor->height()))); popup->setFocus(); popup->show(); }
QgsMeasureDialog::QgsMeasureDialog( QgsMeasureTool* tool, Qt::WFlags f ) : QDialog( tool->canvas()->topLevelWidget(), f ), mTool( tool ) { setupUi( this ); QPushButton *nb = new QPushButton( tr( "&New" ) ); buttonBox->addButton( nb, QDialogButtonBox::ActionRole ); connect( nb, SIGNAL( clicked() ), this, SLOT( restart() ) ); mMeasureArea = tool->measureArea(); mTotal = 0.; // Set one cell row where to update current distance // If measuring area, the table doesn't get shown QTreeWidgetItem* item = new QTreeWidgetItem( QStringList( QString::number( 0, 'f', 1 ) ) ); item->setTextAlignment( 0, Qt::AlignRight ); mTable->addTopLevelItem( item ); // Update whenever the canvas has refreshed. Maybe more often than needed, // but at least every time any canvas related settings changes connect( mTool->canvas(), SIGNAL( mapCanvasRefreshed() ), this, SLOT( updateSettings() ) ); updateSettings(); }
void OpenEditorsWindow::setEditors(EditorView *mainView, EditorView *view, OpenEditorsModel *model) { m_editorList->clear(); bool first = true; QSet<IFile*> filesDone; foreach (const EditLocation &hi, view->editorHistory()) { if (hi.file.isNull() || filesDone.contains(hi.file)) continue; QString title = model->displayNameForFile(hi.file); QTC_ASSERT(!title.isEmpty(), continue;) filesDone.insert(hi.file.data()); QTreeWidgetItem *item = new QTreeWidgetItem(); if (hi.file->isModified()) title += tr("*"); item->setIcon(0, hi.file->isReadOnly() ? model->lockedIcon() : m_emptyIcon); item->setText(0, title); item->setToolTip(0, hi.file->fileName()); item->setData(0, Qt::UserRole, QVariant::fromValue(hi.file.data())); item->setData(0, Qt::UserRole+1, QVariant::fromValue(view)); item->setTextAlignment(0, Qt::AlignLeft); m_editorList->addTopLevelItem(item); if (first){ m_editorList->setCurrentItem(item); first = false; } }
void LauncherWindow::set_arg(QString action, QString arg, QString val) { qDebug() << "set_arg" << action << " " << arg << " " << val; QList<QTreeWidgetItem *> items = tree->findItems(arg, Qt::MatchExactly, 0); if(action == "remove") { if(items.count() == 0) { //* item not there return; } QTreeWidgetItem *removeItem = items.first(); tree->invisibleRootItem()->removeChild(removeItem); return; } if(action == "set") { if(items.count() == 0) { QTreeWidgetItem *newItem = new QTreeWidgetItem(); //* add Item if not exist newItem->setText(C_ARG, arg); newItem->setTextAlignment(C_ARG, Qt::AlignRight); newItem->setText(C_VAL, val); tree->addTopLevelItem(newItem); return; } else { QTreeWidgetItem *item = items.first(); //* update existing item->setText(C_VAL, val); return; } } qDebug() << "UNHANDLED"; }
void EditorCompletion::showCompletion(const QStringList& choices) { if (!choices.count()) return; int maxIdentifierLength = 0; int maxDescriptionLength = 0; QFontMetrics metrics(m_editor->font()); m_popup->setUpdatesEnabled(false); m_popup->clear(); for (int i = 0; i < choices.count(); ++i) { QStringList pair = choices.at(i).split(':'); QTreeWidgetItem* item = new QTreeWidgetItem(m_popup, pair); if (item && m_editor->layoutDirection() == Qt::RightToLeft) item->setTextAlignment(0, Qt::AlignRight); int length = metrics.boundingRect(pair.at(0)).width(); if (length > maxIdentifierLength) maxIdentifierLength = length; length = metrics.boundingRect(pair.at(1)).width(); if (length > maxDescriptionLength) maxDescriptionLength = length; } m_popup->sortItems(1, Qt::AscendingOrder); m_popup->sortItems(0, Qt::AscendingOrder); m_popup->setCurrentItem(m_popup->topLevelItem(0)); // Size of the pop-up. m_popup->resizeColumnToContents(0); m_popup->setColumnWidth(0, m_popup->columnWidth(0) + 25); m_popup->resizeColumnToContents(1); m_popup->setColumnWidth(1, m_popup->columnWidth(1) + 25); const int maxVisibleItems = 8; const int height = m_popup->sizeHintForRow(0) * qMin(maxVisibleItems, choices.count()) + 3; const int width = m_popup->columnWidth(0) + m_popup->columnWidth(1) + 1; // Position, reference is editor's cursor position in global coord. QTextCursor cursor = m_editor->textCursor(); cursor.movePosition(QTextCursor::StartOfWord); const int pixelsOffset = metrics.width(m_editor->text(), cursor.position()); QPoint position = m_editor->mapToGlobal(QPoint(pixelsOffset, m_editor->height())); // If popup is partially invisible, move to other position. const QRect screen = QApplication::desktop()->availableGeometry(m_editor); if (position.y() + height > screen.y() + screen.height()) position.setY(position.y() - height - m_editor->height()); if (position.x() + width > screen.x() + screen.width()) position.setX(screen.x() + screen.width() - width); m_popup->setUpdatesEnabled(true); m_popup->setGeometry(QRect(position, QSize(width, height))); m_popup->show(); m_popup->setFocus(); }
QvvMainWindow::QvvMainWindow() : QMainWindow() { toolbar = NULL; rand_seeded = 0; opt_thumbs = 0; opt_dirs_only = 0; last_sort_col = 1; last_sort_ord = Qt::AscendingOrder; setAttribute( Qt::WA_DeleteOnClose ); setObjectName( "QvvMainWindow" ); setWindowTitle( QString() + " QVV " + QVV_VERSION ); // crashes ICEWM :( //setWindowIcon( QIcon( QPixmap( ":/images/qvv_icon_128x128.png" ) ) ); resize( 640, 400 ); tree = new QvvTreeWidget( this ); tree->setMinimumSize( 400, 200 ); QTreeWidgetItem *header = new QTreeWidgetItem(); header->setText( 0, "Type" ); header->setText( 1, "Name" ); header->setText( 2, "Size" ); header->setText( 3, "Modify Time" ); header->setTextAlignment( 2, Qt::AlignRight ); tree->setColumnCount( 4 ); tree->setHeaderItem( header ); tree->setColumnWidth( 0, 70 ); tree->setColumnWidth( 1, 300 ); tree->setColumnWidth( 2, 80 ); tree->setColumnWidth( 3, 120 ); tree->setIconSize( QSize( 64, 64 ) ); tree->setSortingEnabled( 1 ); tree->sortByColumn( 1, Qt::AscendingOrder ); tree->setDragEnabled( 1 ); tree->setSelectionMode( QAbstractItemView::ExtendedSelection ); setCentralWidget( tree ); setupMenuBar(); //statusBar()->showMessage( "." ); //loadDir( QString( "." ) ); connect( tree, SIGNAL(itemActivated(QTreeWidgetItem *, int)), this, SLOT(slotItemActivated(QTreeWidgetItem *, int))); }
void AudioDeviceConfig::listDevices(RtAudio* audio, QString apiName) { QTreeWidgetItem* item = NULL; RtAudioDeviceInfo info; QTreeWidgetItem* headerAPI = new QTreeWidgetItem(audioDevicesList, QStringList(apiName)); QFont APInameFont; APInameFont.setPointSize(9); //APInameFont.setBold(true); headerAPI->setFont(0, APInameFont); headerAPI->setFlags(Qt::ItemIsEnabled); int devices = audio->getDeviceCount(); for (int i=1; i<= devices; i++) { try { info = audio->getDeviceInfo(i); } catch (RtError &error) { QMessageBox::warning(this,"Error obtaining DirectShow device info!", QString::fromStdString(error.getMessage()), QMessageBox::Ok, QMessageBox::NoButton,QMessageBox::NoButton); break; } item = new QTreeWidgetItem(headerAPI); if(info.probed) item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); else item->setFlags(Qt::ItemIsSelectable); item->setText(0, QString::fromStdString(info.name)); item->setText(1, QString::number(i)); item->setTextAlignment(1,Qt::AlignHCenter); (info.isDefault ? item->setCheckState(2,Qt::Checked) : item->setCheckState(2,Qt::Unchecked)); item->setTextAlignment(2,Qt::AlignHCenter); (info.probed ? item->setCheckState(3,Qt::Checked) : item->setCheckState(3,Qt::Unchecked)); item->setTextAlignment(3,Qt::AlignHCenter); } audioDevicesList->expandItem(headerAPI); }
bool wxListCtrl::SetItem(wxListItem& info) { const long id = info.GetId(); QTreeWidgetItem *qitem = QtGetItem(id); if ( qitem != NULL ) { if ((info.m_mask & wxLIST_MASK_TEXT) && !info.GetText().IsNull() ) qitem->setText(info.GetColumn(), wxQtConvertString(info.GetText())); qitem->setTextAlignment(info.GetColumn(), wxQtConvertTextAlign(info.GetAlign())); if ( info.m_mask & wxLIST_MASK_DATA ) { QVariant variant = qVariantFromValue(info.GetData()); qitem->setData(0, Qt::UserRole, variant); } if (info.m_mask & wxLIST_MASK_STATE) { if ((info.m_stateMask & wxLIST_STATE_FOCUSED) && (info.m_state & wxLIST_STATE_FOCUSED)) m_qtTreeWidget->setCurrentItem(qitem, 0); if (info.m_stateMask & wxLIST_STATE_SELECTED) qitem->setSelected(info.m_state & wxLIST_STATE_SELECTED); } if (info.m_mask & wxLIST_MASK_IMAGE) { if (info.m_image >= 0) { wxImageList *imglst = GetImageList(InReportView() ? wxIMAGE_LIST_SMALL : wxIMAGE_LIST_NORMAL); wxCHECK_MSG(imglst, false, "invalid listctrl imagelist"); const wxBitmap* bitmap = imglst->GetBitmapPtr(info.m_image); if (bitmap != NULL) { // set the new image: qitem->setIcon( info.GetColumn(), QIcon( *bitmap->GetHandle() )); } } else { // remove the image using and empty qt icon: qitem->setIcon( info.GetColumn(), QIcon() ); } } for (int col=0; col<GetColumnCount(); col++) { if ( info.GetFont().IsOk() ) qitem->setFont(col, info.GetFont().GetHandle() ); if ( info.GetTextColour().IsOk() ) qitem->setTextColor(col, info.GetTextColour().GetHandle()); if ( info.GetBackgroundColour().IsOk() ) qitem->setBackgroundColor(col, info.GetBackgroundColour().GetHandle()); } return true; } else return false; }
void KateBuildView::addError(const QString &filename, const QString &line, const QString &column, const QString &message) { bool isError=false; bool isWarning=false; QTreeWidgetItem* item = new QTreeWidgetItem(m_buildUi.errTreeWidget); item->setBackground(1, Qt::gray); // The strings are twice in case kate is translated but not make. if (message.contains(QStringLiteral("error")) || message.contains(i18nc("The same word as 'make' uses to mark an error.","error")) || message.contains(QStringLiteral("undefined reference")) || message.contains(i18nc("The same word as 'ld' uses to mark an ...","undefined reference")) ) { isError=true; item->setForeground(1, Qt::red); m_numErrors++; item->setHidden(false); } if (message.contains(QStringLiteral("warning")) || message.contains(i18nc("The same word as 'make' uses to mark a warning.","warning")) ) { isWarning=true; item->setForeground(1, Qt::yellow); m_numWarnings++; item->setHidden(m_buildUi.displayModeSlider->value() > 2); } item->setTextAlignment(1, Qt::AlignRight); // visible text //remove path from visible file name QFileInfo file(filename); item->setText(0, file.fileName()); item->setText(1, line); item->setText(2, message.trimmed()); // used to read from when activating an item item->setData(0, Qt::UserRole, filename); item->setData(1, Qt::UserRole, line); item->setData(2, Qt::UserRole, column); if ((isError==false) && (isWarning==false)) { item->setHidden(m_buildUi.displayModeSlider->value() > 1); } item->setData(0, IsErrorRole, isError); item->setData(0, IsWarningRole, isWarning); // add tooltips in all columns // The enclosing <qt>...</qt> enables word-wrap for long error messages item->setData(0, Qt::ToolTipRole, filename); item->setData(1, Qt::ToolTipRole, QStringLiteral("<qt>%1</qt>").arg(message)); item->setData(2, Qt::ToolTipRole, QStringLiteral("<qt>%1</qt>").arg(message)); }
void QgsMeasureDialog::updateUi() { // Set tooltip to indicate how we calculate measurments QString toolTip = tr( "The calculations are based on:" ); if ( ! mTool->canvas()->hasCrsTransformEnabled() ) { toolTip += "<br> * " + tr( "Project CRS transformation is turned off." ) + " "; toolTip += tr( "Canvas units setting is taken from project properties setting (%1)." ).arg( QGis::tr( mCanvasUnits ) ); toolTip += "<br> * " + tr( "Ellipsoidal calculation is not possible, as project CRS is undefined." ); setWindowTitle( tr( "Measure (OTF off)" ) ); } else { if ( mDa.ellipsoidalEnabled() ) { toolTip += "<br> * " + tr( "Project CRS transformation is turned on and ellipsoidal calculation is selected." ) + " "; toolTip += "<br> * " + tr( "The coordinates are transformed to the chosen ellipsoid (%1), and the result is in meters" ).arg( mDa.ellipsoid() ); } else { toolTip += "<br> * " + tr( "Project CRS transformation is turned on but ellipsoidal calculation is not selected." ); toolTip += "<br> * " + tr( "The canvas units setting is taken from the project CRS (%1)." ).arg( QGis::tr( mCanvasUnits ) ); } setWindowTitle( tr( "Measure (OTF on)" ) ); } if (( mCanvasUnits == QGis::Meters && mDisplayUnits == QGis::Feet ) || ( mCanvasUnits == QGis::Feet && mDisplayUnits == QGis::Meters ) ) { toolTip += "<br> * " + tr( "Finally, the value is converted from %1 to %2." ).arg( QGis::tr( mCanvasUnits ) ).arg( QGis::tr( mDisplayUnits ) ); } editTotal->setToolTip( toolTip ); mTable->setToolTip( toolTip ); mNotesLabel->setText( toolTip ); QGis::UnitType newDisplayUnits; double dummy = 1.0; convertMeasurement( dummy, newDisplayUnits, true ); mTable->setHeaderLabels( QStringList() << tr( "Parts" ) ); mTable->clear(); const QList< QList< QgsPoint > >& points = mTool->getPoints(); double total = 0.; for ( int i = 0, n = points.size(); i < n; ++i ) { double value = measureGeometry( points[i], mMeasureArea ); QTreeWidgetItem* item = new QTreeWidgetItem( QStringList() << formatValue( value, mMeasureArea ) ); item->setTextAlignment( 0, Qt::AlignRight ); mTable->addTopLevelItem( item ); total += value; } editTotal->setText( formatValue( total, mMeasureArea ) ); mTool->updateLabels(); }
void RoomSelector::processListRoomsEvent(const Event_ListRooms &event) { const int roomListSize = event.room_list_size(); for (int i = 0; i < roomListSize; ++i) { const ServerInfo_Room &room = event.room_list(i); for (int j = 0; j < roomList->topLevelItemCount(); ++j) { QTreeWidgetItem *twi = roomList->topLevelItem(j); if (twi->data(0, Qt::UserRole).toInt() == room.room_id()) { if (room.has_name()) twi->setData(0, Qt::DisplayRole, QString::fromStdString(room.name())); if (room.has_description()) twi->setData(1, Qt::DisplayRole, QString::fromStdString(room.description())); if (room.has_permissionlevel()) twi->setData(2, Qt::DisplayRole, getRoomPermissionDisplay(room)); if (room.has_player_count()) twi->setData(3, Qt::DisplayRole, room.player_count()); if (room.has_game_count()) twi->setData(4, Qt::DisplayRole, room.game_count()); return; } } QTreeWidgetItem *twi = new QTreeWidgetItem; twi->setData(0, Qt::UserRole, room.room_id()); if (room.has_name()) twi->setData(0, Qt::DisplayRole, QString::fromStdString(room.name())); if (room.has_description()) twi->setData(1, Qt::DisplayRole, QString::fromStdString(room.description())); if (room.has_permissionlevel()) twi->setData(2, Qt::DisplayRole, getRoomPermissionDisplay(room)); twi->setData(3, Qt::DisplayRole, room.player_count()); twi->setData(4, Qt::DisplayRole, room.game_count()); twi->setTextAlignment(2, Qt::AlignRight); twi->setTextAlignment(3, Qt::AlignRight); twi->setTextAlignment(4, Qt::AlignRight); roomList->addTopLevelItem(twi); if (room.has_auto_join()) if (room.auto_join()) emit joinRoomRequest(room.room_id(), false); } }
void UpdateCenterImpl::fillUpdates() { for (int n = 0; n < updates->getUpdatesCount(); n++) { QTreeWidgetItem *item = new QTreeWidgetItem(lsvUpdates); item->setTextAlignment(1, Qt::AlignHCenter | Qt::AlignVCenter); item->setTextAlignment(2, Qt::AlignRight | Qt::AlignVCenter); item->setTextAlignment(3, Qt::AlignHCenter | Qt::AlignVCenter); item->setText(0, updates->getUpdateItem(n)->getCaption()); item->setText(1, updates->getUpdateItem(n)->getVersion()); item->setText(2, fileSizeToString(updates->getUpdateItem(n)->getSize())); item->setText(3, "-"); item->setSizeHint(0, QSize(18,18)); item->setCheckState(0, Qt::Checked); } }
void iota::showIota(QString q) { iotaList->clear(); QSqlQuery query; query.exec(q); n = query.size(); while(query.next()) { i = 0; r = 0; QTreeWidgetItem *item = new QTreeWidgetItem(iotaList); item->setText(r++,query.value(i).toString()); item->setTextAlignment(i++,Qt::AlignCenter); item->setText(r++,query.value(i).toString()); item->setTextAlignment(i++,Qt::AlignCenter); item->setText(r++,query.value(i).toString()); } t = tr("Eintraege : ")+t.setNum(n); labelCount->setText(t); wLineEdit->setFocus(); }
/** * Add root to the tree widget with the with thier values as specified * @brief TreeWidgetForPresentation::AddRoot * @param name name of root * @param total total sum of the root * @return QTreeWidgetItem */ QTreeWidgetItem* TreeWidgetForPublication::AddRoot(QString name, QString total) { createtreewidget->setHeaderHidden(false); //set header QTreeWidget hidden createtreewidget->setColumnCount(2); //specify three columns for the tree widget createtreewidget->setColumnWidth(0, 200); //the first column width set createtreewidget->setColumnWidth(1, 50); QStringList list; list << "" << "Total"; QTreeWidgetItem *headeritms = new QTreeWidgetItem(list); headeritms->setTextAlignment(0, Qt::AlignRight); headeritms->setTextAlignment(1, Qt::AlignCenter); createtreewidget->setHeaderItem(headeritms); createtreewidget->setHeaderLabels(list); QTreeWidgetItem *itm = new QTreeWidgetItem(createtreewidget); itm->setText(0, name); //first column itm->setText(1, total); createtreewidget->addTopLevelItem(itm); return itm; }
// private QTreeWidgetItem* QgsAuthSslConfigWidget::addRootItem( const QString &label ) { QTreeWidgetItem *item = new QTreeWidgetItem( QStringList() << label, ( int )ConfigParent ); setItemBold_( item ); item->setTextAlignment( 0, Qt::AlignVCenter ); item->setFlags( item->flags() & ~Qt::ItemIsSelectable ); treeSslConfig->insertTopLevelItem( treeSslConfig->topLevelItemCount(), item ); return item; }
void TreeWidgetHeaderSetupDialog::setHeader(QTreeWidget* view, int) { m_view = view; QTreeWidgetItem* header = view->headerItem(); for( int i=0;i<header->columnCount();i++ ) { QTreeWidgetItem* item = new QTreeWidgetItem(ui->MasterView); item->setText(0, header->text(i)); item->setTextAlignment(0, header->textAlignment(i)); item->setCheckState(0, view->isColumnHidden(i) ? Qt::Unchecked : Qt::Checked); } }
void VariablesWidget::fillTable() { setUpdatesEnabled(false); m_filterTimer->stop(); m_variables->clear(); QString term = m_searchFilter->text(); QVector<Variable> variables = Evaluator::instance()->variables(); for (int k = 0; k < variables.count(); ++k) { QString upper = variables.at(k).name.toUpper(); if (m_itemPolicy == ShowUser && (upper == QLatin1String("ANS") || upper == QLatin1String("E") || upper == QLatin1String("PHI") || upper == QLatin1String("PI"))) { continue; } QStringList str; str << variables.at(k).name << formatValue(variables.at(k).value); if (term.isEmpty() || str.at(0).contains(term, Qt::CaseInsensitive) || str.at(1).contains(term, Qt::CaseInsensitive)) { QTreeWidgetItem *item = new QTreeWidgetItem(m_variables, str); item->setTextAlignment(0, Qt::AlignLeft | Qt::AlignVCenter); item->setTextAlignment(1, Qt::AlignLeft | Qt::AlignVCenter); } } m_variables->resizeColumnToContents(0); m_variables->resizeColumnToContents(1); if (m_variables->topLevelItemCount() > 0 || m_itemPolicy != ShowAll) { m_noMatchLabel->hide(); m_variables->sortItems(0, Qt::AscendingOrder); } else { m_noMatchLabel->setGeometry(m_variables->geometry()); m_noMatchLabel->show(); m_noMatchLabel->raise(); } m_searchFilter->setFocus(); setUpdatesEnabled(true); }
void QgsMeasureDialog::restart() { mTool->restart(); // Set one cell row where to update current distance // If measuring area, the table doesn't get shown mTable->clear(); QTreeWidgetItem* item = new QTreeWidgetItem( QStringList( QString::number( 0, 'f', 1 ) ) ); item->setTextAlignment( 0, Qt::AlignRight ); mTable->addTopLevelItem( item ); mTotal = 0.; updateUi(); }