void OBSBasicFilters::CustomContextMenu(const QPoint &pos, bool async) { QListWidget *list = async ? ui->asyncFilters : ui->effectFilters; QListWidgetItem *item = list->itemAt(pos); QMenu popup(window()); QPointer<QMenu> addMenu = CreateAddFilterPopupMenu(async); if (addMenu) popup.addMenu(addMenu); if (item) { const char *renameSlot = async ? SLOT(RenameAsyncFilter()) : SLOT(RenameEffectFilter()); const char *removeSlot = async ? SLOT(on_removeAsyncFilter_clicked()) : SLOT(on_removeEffectFilter_clicked()); popup.addSeparator(); popup.addAction(QTStr("Rename"), this, renameSlot); popup.addAction(QTStr("Remove"), this, removeSlot); } popup.exec(QCursor::pos()); }
void OBSBasicFilters::RemoveFilter(OBSSource filter) { uint32_t flags = obs_source_get_output_flags(filter); bool async = (flags & OBS_SOURCE_ASYNC) != 0; QListWidget *list = async ? ui->asyncFilters : ui->effectFilters; for (int i = 0; i < list->count(); i++) { QListWidgetItem *item = list->item(i); QVariant v = item->data(Qt::UserRole); OBSSource curFilter = v.value<OBSSource>(); if (filter == curFilter) { DeleteListItem(list, item); break; } } const char *filterName = obs_source_get_name(filter); const char *sourceName = obs_source_get_name(source); if (!sourceName || !filterName) return; const char *filterId = obs_source_get_id(filter); blog(LOG_INFO, "User removed filter '%s' (%s) from source '%s'", filterName, filterId, sourceName); main->SaveProject(); }
void MainWindow::formChannelList(){ if (m_availableChannelsQuery->getChannels().size() == 0 ) return; else { m_availableChannels = m_availableChannelsQuery->getChannels(); } m_subscribedChannels = m_subscribedChannelsQuery->getChannels(); QListWidget * listWidget = ui->channelsListWidget; QListWidget * subscribedListWidget = ui->subscribedListWidget; // Tab - channels while(listWidget->count()>0) { listWidget->takeItem(0); } foreach (Channel s, m_availableChannels){ QListWidgetItem * item = new QListWidgetItem(s.getName()); if (isSubscribed(s.getName())){ item->setBackgroundColor(Qt::lightGray); } listWidget->addItem(item); }
void MainWindow::strDelete(unsigned char strNum) { QListWidget* list; list = nullptr; switch(strNum) { case 1:list = listOfRows1;break; case 2:list = listOfRows2;break; case 3:list = listOfRows3;break; case 4:list = listOfRows4;break; } if(list != nullptr) { int i = list->currentRow(); if(list->count()>=2) { if(i!=0) lcd->setLineNumber(strNum-1,i-1); else lcd->setLineNumber(strNum-1,i); lcd->getData()->deleteLine(strNum-1,i); lcd->setPos(0,strNum-1); display->update(); fillLists(lcd->getData()); } else QMessageBox::warning(this,"Недопустимая операция","Невозможно удалить последнюю строку"); } }
void CReportDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { const QAbstractItemModel* model = index.model(); QVariant data = index.data(Qt::DisplayRole); //Populate the editor if(data.type() != QVariant::List) QStyledItemDelegate::setEditorData(editor,index); QVariantList validReports = index.data(Qt::EditRole).toList(); QVariantList currentReportsList = data.toList(); QListWidget* listWidget = static_cast<QListWidget*>(editor); // Prepare the items in the list foreach(QVariant dataElement,validReports) { QString outString = dataElement.toString(); if(m_reportNameModel!=(QAbstractItemModel*)NULL) { outString+=":"+searchReportColumnForId(dataElement.toInt()); } QListWidgetItem* item = new QListWidgetItem(outString); item->setData(Qt::UserRole,dataElement); //Now, determine if the ítem SHOULD be checked if(currentReportsList.contains(dataElement)) { item->setCheckState(Qt::Checked); } else { item->setCheckState(Qt::Unchecked); } listWidget->addItem(item); }
void MainWindow::fillLists(DisplayData *display) { QListWidget* list; unsigned char rowsCount = display->getRowCount(); if(font != nullptr) for(int i=1;i<=4;i++) { switch(i) { case 1:list = listOfRows1;break; case 2:list = listOfRows2;break; case 3:list = listOfRows3;break; case 4:list = listOfRows4;break; } if(rowsCount>=i) { list->clear(); for(int j=0;j<display->getCountOfLinesInRow(i-1);j++) { QString text = QString::number(j) + ")" + display->getLine(i-1,j)->getAsString(font); list->addItem(text); } } quint16 num = lcd->getCurrentLineNumber(i-1); if(num<list->count()) list->setCurrentRow(num,QItemSelectionModel::SelectCurrent); } }
void MainWindow::resizeEvent(QResizeEvent *) { QListWidget *lst = ui->lst_debug; QRect geo = lst->geometry(); geo.setHeight( this->height() - geo.top() - 20 ); lst->setGeometry(geo); }
void MessageHandlerWidget::fatalMessageReceived(const QString &app, const QString &message, const QTime &time, const QStringList &backtrace) { if (Endpoint::isConnected() && !qobject_cast<MessageHandlerClient*>(ObjectBroker::object<MessageHandlerInterface*>())) { // only show on remote side return; } QDialog dlg; dlg.setWindowTitle(QObject::tr("QFatal in %1 at %2").arg(app).arg(time.toString())); QGridLayout *layout = new QGridLayout; QLabel *iconLabel = new QLabel; QIcon icon = dlg.style()->standardIcon(QStyle::SP_MessageBoxCritical, 0, &dlg); int iconSize = dlg.style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, &dlg); iconLabel->setPixmap(icon.pixmap(iconSize, iconSize)); iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); layout->addWidget(iconLabel, 0, 0); QLabel *errorLabel = new QLabel; errorLabel->setTextFormat(Qt::PlainText); errorLabel->setWordWrap(true); errorLabel->setText(message); layout->addWidget(errorLabel, 0, 1); QDialogButtonBox *buttons = new QDialogButtonBox; if (!backtrace.isEmpty()) { QListWidget *backtraceWidget = new QListWidget; foreach (const QString &frame, backtrace) { backtraceWidget->addItem(frame); }
void MainWindow::strPaste(unsigned char strNum) { QListWidget* list; list = nullptr; if(copyFlag==false) { QMessageBox::warning(this,"сообщение","Буфер обмена пуст"); return; } else { switch(strNum) { case 1:list = listOfRows1;break; case 2:list = listOfRows2;break; case 3:list = listOfRows3;break; case 4:list = listOfRows4;break; } if(list != nullptr) { int i = list->currentRow(); lcd->getData()->insertLine(copyLine,strNum-1,i); lcd->setLineNumber(strNum-1,i); lcd->setPos(0,strNum-1); display->update(); fillLists(lcd->getData()); } } }
void CQReportDefinition::btnItemClicked() { assert(CCopasiRootContainer::getDatamodelList()->size() > 0); CModel* pModel = (*CCopasiRootContainer::getDatamodelList())[0]->getModel(); if (!pModel) return; std::vector< const CCopasiObject * > SelectedVector = // CCopasiSelectionDialog::getObjectVector(this, CQSimpleSelectionTree::NO_RESTRICTION); CCopasiSelectionDialog::getObjectVector(this, CQSimpleSelectionTree::AnyObject); CQReportListItem * pItem; if (SelectedVector.size() != 0) { QListWidget * pList = static_cast< QListWidget * >(mpReportSectionTab->currentPage()); std::vector< const CCopasiObject * >::const_iterator it = SelectedVector.begin(); std::vector< const CCopasiObject * >::const_iterator end = SelectedVector.end(); for (; it != end; ++it) { pItem = new CQReportListItem(*it); pList->addItem(pItem); } mChanged = true; } return; }
//! [8] ApplicationsTab::ApplicationsTab(const QFileInfo &fileInfo, QWidget *parent) : QWidget(parent) { QLabel *topLabel = new QLabel(tr("Open with:")); QListWidget *applicationsListBox = new QListWidget; QStringList applications; for (int i = 1; i <= 30; ++i) applications.append(tr("Application %1").arg(i)); applicationsListBox->insertItems(0, applications); QCheckBox *alwaysCheckBox; if (fileInfo.suffix().isEmpty()) alwaysCheckBox = new QCheckBox(tr("Always use this application to " "open this type of file")); else alwaysCheckBox = new QCheckBox(tr("Always use this application to " "open files with the extension '%1'").arg(fileInfo.suffix())); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(topLabel); layout->addWidget(applicationsListBox); layout->addWidget(alwaysCheckBox); setLayout(layout); }
void HistoryElementModifyEvent::doEventPlace() { if(!m_scene) return; LvlScene* lvlScene; if(!(lvlScene = qobject_cast<LvlScene*>(m_scene))) return; LevelSMBX64Event rmEvents = m_event; MainWinConnect::pMainWin->dock_LvlEvents->setEventToolsLocked(true); QListWidgetItem * item; item = new QListWidgetItem; item->setText(rmEvents.name); item->setFlags(Qt::ItemIsEditable); item->setFlags(item->flags() | Qt::ItemIsEnabled); item->setFlags(item->flags() | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsSelectable); item->setData(Qt::UserRole, QString::number(rmEvents.meta.array_id) ); QListWidget* evList = MainWinConnect::pMainWin->dock_LvlEvents->getEventList(); LevelSMBX64Event NewEvent = rmEvents; lvlScene->m_data->events.push_back(NewEvent); evList->addItem(item); lvlScene->m_data->meta.modified = true; MainWinConnect::pMainWin->EventListsSync(); MainWinConnect::pMainWin->dock_LvlEvents->setEventToolsLocked(false); }
Dialog::Dialog( QWidget *parent ) : QDialog( parent ) { //ui.setupUi( this ); QLabel *Label1 = new QLabel( tr( "Label1" ) ); QLabel *Label2 = new QLabel( tr( "Label2" ) ); QLabel *Label3 = new QLabel( tr( "Label3" ) ); QListWidget *list = new QListWidget( this ); list->insertItem( 0, tr( "Window1" ) ); list->insertItem( 1, tr( "Window2" ) ); list->insertItem( 2, tr( "Window3" ) ); QStackedWidget *stack = new QStackedWidget( this ); stack->addWidget( Label1 ); stack->addWidget( Label2 ); stack->addWidget( Label3 ); QHBoxLayout *Layout = new QHBoxLayout( this ); Layout->setMargin( 5 ); Layout->setSpacing( 5 ); Layout->addWidget( list ); Layout->addWidget( stack, 0, Qt::AlignHCenter ); Layout->setStretchFactor( list, 1 ); Layout->setStretchFactor( stack, 3 ); connect( list, SIGNAL( currentRowChanged( int ) ), stack, SLOT( setCurrentIndex( int ) ) ); }
void PageItem::slotSetFormData() { QTextEdit *textEdit = qobject_cast<QTextEdit*>(sender()); if (textEdit) // textEdit == 0 if the above cast fails { slotSetFormData(textEdit->toPlainText()); return; } QListWidget *listWidget = qobject_cast<QListWidget*>(sender()); if (listWidget) { QList<int> choices; for (int i = 0; i < listWidget->count(); ++i) { if (listWidget->item(i)->isSelected()) choices << i; } QString objectName = sender()->objectName(); if (!objectName.startsWith(QLatin1String("PageItem::formField"))) return; int which = objectName.remove(QLatin1String("PageItem::formField")).toInt(); Poppler::FormFieldChoice *formField = static_cast<Poppler::FormFieldChoice*>(m_formFields.at(which).field); formField->setCurrentChoices(choices); return; } }
void ListBoxControl::update (int pId) { uicontrol::properties& up = properties<uicontrol> (); QListWidget* list = qWidget<QListWidget> (); switch (pId) { case uicontrol::properties::ID_STRING: m_blockCallback = true; list->clear (); list->addItems (Utils::fromStringVector (up.get_string_vector ())); updateSelection (list, up.get_value ().matrix_value ()); m_blockCallback = false; break; case uicontrol::properties::ID_MIN: case uicontrol::properties::ID_MAX: if ((up.get_max () - up.get_min ()) > 1) list->setSelectionMode (QAbstractItemView::ExtendedSelection); else list->setSelectionMode (QAbstractItemView::SingleSelection); break; case uicontrol::properties::ID_VALUE: m_blockCallback = true; updateSelection (list, up.get_value ().matrix_value ()); m_blockCallback = false; break; default: BaseControl::update (pId); break; } }
void MainWindow::DisplayProcess() { QListWidget* list = this->ui.procListWidget; QListWidgetItem* current = list->currentItem(); if (current == NULL) return; this->ui.procIdText->setText(current->text()); Process* process = this->model->getProcess(current->text().toInt()); if (process != NULL) { if(strlen(process->name) == 0x00) { this->window->setWindowTitle(QApplication::translate("window", "Process Watch Dog", 0, QApplication::UnicodeUTF8)); } else { this->window->setWindowTitle(QString("Application: [%1]").arg(process->name)); } UpdateProcessStatusIcon(process); } }
void AddPluginDialog::filter() { QListWidget* pluginList = ui->pluginList; const int curr_item = 0 < pluginList->count() ? pluginList->currentRow() : 0; pluginList->clear(); static QIcon fallIco = XdgIcon::fromTheme("preferences-plugin"); int pluginCount = mPlugins.length(); for (int i = 0; i < pluginCount; ++i) { const LxQt::PluginInfo &plugin = mPlugins.at(i); QString s = QString("%1 %2 %3 %4").arg(plugin.name(), plugin.comment(), plugin.value("Name").toString(), plugin.value("Comment").toString()); if (!s.contains(ui->searchEdit->text(), Qt::CaseInsensitive)) continue; QListWidgetItem* item = new QListWidgetItem(ui->pluginList); item->setText(QString("<b>%1</b><br>\n%2\n").arg(plugin.name(), plugin.comment())); item->setIcon(plugin.icon(fallIco)); item->setData(INDEX_ROLE, i); } if (pluginCount > 0) ui->pluginList->setCurrentRow(curr_item < pluginCount ? curr_item : pluginCount - 1); }
KInlineObject *InsertTextReferenceAction::createInlineObject() { const QList<KTextLocator*> textLocators = m_manager->textLocators(); if (textLocators.isEmpty()) { KMessageBox::information(m_canvas->canvasWidget(), i18n("Please create an index to reference first.")); return 0; } QWidget *widget = new QWidget(); QVBoxLayout *lay = new QVBoxLayout(widget); widget->setLayout(lay); lay->setMargin(0); QLabel *label = new QLabel(i18n("Select the index you want to reference"), widget); lay->addWidget(label); QStringList selectionList; foreach(KTextLocator* locator, textLocators) selectionList << locator->word() + '(' + QString::number(locator->pageNumber()) + ')'; QListWidget *list = new QListWidget(widget); lay->addWidget(list); list->addItems(selectionList); QPointer<KPageDialog> dialog = new KPageDialog(m_canvas->canvasWidget()); dialog->setCaption(i18n("%1 Options", i18n("Text Reference"))); // reuse the text passed in the constructor dialog->addPage(widget, QString()); KVariable *variable = 0; if (dialog->exec() == KPageDialog::Accepted && list->currentRow() >= 0) { KTextLocator *locator = textLocators[list->currentRow()]; Q_ASSERT(locator); variable = new KTextReference(locator->id()); } delete dialog; return variable; }
/** * Synchronize parameter b_selected in the values list * @param object A WidgetMapper **/ void ExtensionDialog::SyncSelection( QObject *object ) { assert( object != NULL ); struct extension_widget_t::extension_widget_value_t *p_value; bool lockedHere = false; if( !has_lock ) { vlc_mutex_lock( &p_dialog->lock ); has_lock = true; lockedHere = true; } WidgetMapper *mapping = static_cast< WidgetMapper* >( object ); extension_widget_t *p_widget = mapping->getWidget(); assert( p_widget->type == EXTENSION_WIDGET_DROPDOWN || p_widget->type == EXTENSION_WIDGET_LIST ); if( p_widget->type == EXTENSION_WIDGET_DROPDOWN ) { QComboBox *combo = static_cast< QComboBox* >( p_widget->p_sys_intf ); for( p_value = p_widget->p_values; p_value != NULL; p_value = p_value->p_next ) { // if( !qstrcmp( p_value->psz_text, qtu( combo->currentText() ) ) ) if( combo->itemData( combo->currentIndex(), Qt::UserRole ).toInt() == p_value->i_id ) { p_value->b_selected = true; } else { p_value->b_selected = false; } } free( p_widget->psz_text ); p_widget->psz_text = strdup( qtu( combo->currentText() ) ); } else if( p_widget->type == EXTENSION_WIDGET_LIST ) { QListWidget *list = static_cast<QListWidget*>( p_widget->p_sys_intf ); QList<QListWidgetItem *> selection = list->selectedItems(); for( p_value = p_widget->p_values; p_value != NULL; p_value = p_value->p_next ) { bool b_selected = false; foreach( const QListWidgetItem *item, selection ) { // if( !qstrcmp( qtu( item->text() ), p_value->psz_text ) ) if( item->data( Qt::UserRole ).toInt() == p_value->i_id ) { b_selected = true; break; } } p_value->b_selected = b_selected; } }
int main(int argc, char *argv[]) { QApplication a(argc, argv); a.setStyle("cleanlooks"); #if 0 if (!QSystemTrayIcon::isSystemTrayAvailable()) { QMessageBox::critical ( 0, QObject::tr("Systray"), QObject::tr("There is no system tray on this system.") ); return 1; } QApplication::setQuitOnLastWindowClosed(false); #endif #if 0 Allegrex::create_instructions_directory(); Allegrex::create_interpreter_directory(); Allegrex::create_disassembler_directory(); QPspe4all w; w.show(); #else if (true/*emulator.check_integrity()*/) { QPspe4all w; w.show(); psp::memw(0x00010000) = 0xDEADBEEF; psp::memw(0x04000000) = 0xDEADC0DE; psp::memw(0x08000000) = 0xE117C0DE; QStringList list; #define IDEF(n, m, s, x) list.append(QString("%1/%2 : %3").arg(uint(s), 8, 16, QChar('0')).arg(uint(m), 8, 16, QChar('0')).arg(Allegrex::decode_instruction(s)->opcode_name())); #include "emulator/allegrex/allegrex.def" #undef IDEF QListWidget l; l.setFont(QFont("Terminal")); l.insertItems(0, list); l.show(); return a.exec(); } #endif return a.exec(); return 1; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); QListWidget* list = new QListWidget(); list->show(); }
QString Configurator::getActiveSectionItem() { QListWidget* listWidget = qobject_cast<QListWidget*>( _sections->currentWidget() ); if( 0 != listWidget ) return listWidget->objectName() +"/"+ listWidget->item( listWidget->currentRow() )->data( Qt::UserRole ).toString(); return QString(); }
void PreferencesDialog::saveCommonList(QListWidget &from, QStringList &to) { to.clear(); for (auto row = 0, numRows = from.count(); row < numRows; ++row) to << from.item(row)->data(Qt::UserRole).toString(); }
void AddPluginDialog::emitPluginSelected() { QListWidget* pluginList = ui->pluginList; if (pluginList->currentItem() && pluginList->currentItem()->isSelected()) { LXQt::PluginInfo plugin = mPlugins.at(pluginList->currentItem()->data(INDEX_ROLE).toInt()); emit pluginSelected(plugin); } }
void PreferencesDialog::moveSelectedListWidgetItems(QListWidget &from, QListWidget &to) { for (auto const &item : from.selectedItems()) { auto actualItem = from.takeItem(from.row(item)); if (actualItem) to.addItem(actualItem); } }
void MainWindow::focusAssistant() { QListWidget* widget = qobject_cast<QListWidget*>(m_assistantToolBox->currentWidget()); if (widget) { widget->setFocus(); if (widget->selectedItems().count() == 0) { widget->setCurrentItem(widget->itemAt(0, 0)); } } }
void KActionSelectorPrivate::buttonAddClicked() { // move all selected items from available to selected listbox QList<QListWidgetItem *> list = availableListWidget->selectedItems(); foreach (QListWidgetItem* item, list) { availableListWidget->takeItem( availableListWidget->row( item ) ); selectedListWidget->insertItem( insertionIndex( selectedListWidget, selectedInsertionPolicy ), item ); selectedListWidget->setCurrentItem( item ); emit q->added( item ); }
void ListWidgetPrototype::setBackgroundColor(const QString &colorName) { QListWidget *widget = qscriptvalue_cast<QListWidget*>(thisObject()); if (widget) { QPalette palette = widget->palette(); QColor color(colorName); palette.setBrush(QPalette::Base, color); widget->setPalette(palette); } }
void LairTool::removeBuilding() { QListWidget* list = getCurrentBuildingList(); if (list == NULL) return; int idx = list->currentRow(); delete list->takeItem(idx); }
void PotentialPhishingDetailWidgetTest::shouldHaveDefaultValue() { PotentialPhishingDetailWidget dlg; QLabel *searchLabel = dlg.findChild<QLabel *>(QStringLiteral("label")); QVERIFY(searchLabel); QListWidget *listWidget = dlg.findChild<QListWidget *>(QStringLiteral("list_widget")); QVERIFY(listWidget); QCOMPARE(listWidget->count(), 0); }