void FormWindowBase::deleteWidgetList(const QWidgetList &widget_list) { switch (widget_list.size()) { case 0: break; case 1: { commandHistory()->beginMacro(tr("Delete '%1'").arg(widget_list.front()->objectName())); emit widgetRemoved(widget_list.front()); DeleteWidgetCommand *cmd = new DeleteWidgetCommand(this); cmd->init(widget_list.front()); commandHistory()->push(cmd); commandHistory()->endMacro(); } break; default: commandHistory()->beginMacro(tr("Delete")); foreach (QWidget *w, widget_list) { emit widgetRemoved(w); DeleteWidgetCommand *cmd = new DeleteWidgetCommand(this); cmd->init(w); commandHistory()->push(cmd); } commandHistory()->endMacro(); break; }
void QgsMessageBar::popItem( QgsMessageBarItem *item ) { Q_ASSERT( item ); if ( item != mCurrentItem && !mItems.contains( item ) ) return; if ( item == mCurrentItem ) { if ( mCurrentItem ) { QWidget *widget = dynamic_cast<QWidget*>( mCurrentItem ); mLayout->removeWidget( widget ); mCurrentItem->hide(); disconnect( mCurrentItem, SIGNAL( styleChanged( QString ) ), this, SLOT( setStyleSheet( QString ) ) ); delete mCurrentItem; mCurrentItem = 0; } if ( !mItems.isEmpty() ) { showItem( mItems.first() ); } else { hide(); } } else { mItems.removeOne( item ); } emit widgetRemoved( item ); }
void QgsMessageBar::popItem( QgsMessageBarItem *item ) { Q_ASSERT( item ); if ( item != mCurrentItem && !mItems.contains( item ) ) return; if ( item == mCurrentItem ) { if ( mCurrentItem ) { QWidget *widget = mCurrentItem; mLayout->removeWidget( widget ); mCurrentItem->hide(); disconnect( mCurrentItem, &QgsMessageBarItem::styleChanged, this, &QWidget::setStyleSheet ); mCurrentItem->deleteLater(); mCurrentItem = nullptr; } if ( !mItems.isEmpty() ) { showItem( mItems.at( 0 ) ); } else { hide(); } } else { mItems.removeOne( item ); } emit widgetRemoved( item ); }
void QgsMessageBar::popItem( QgsMessageBarItem *item ) { Q_ASSERT( item ); if ( item != mCurrentItem && !mList.contains( item ) ) return; if ( item == mCurrentItem ) { if ( mCurrentItem ) { mLayout->removeWidget( mCurrentItem->widget() ); mCurrentItem->widget()->hide(); mCurrentItem = 0; } if ( !mList.isEmpty() ) { pushItem( mList.first() ); } else { hide(); } } else { mList.removeOne( item ); } emit widgetRemoved( item->widget() ); }
void SimpleMessageStyle::onStyleWidgetAdded(IMessageStyle *AStyle, QWidget *AWidget) { if (AStyle!=this && FWidgetStatus.contains(AWidget)) { AWidget->removeEventFilter(this); FWidgetStatus.remove(AWidget); emit widgetRemoved(AWidget); } }
void TerminalListWidget::newTerminal() { TerminalWidget *termWidget = new TerminalWidget; termWidget->updateConnections(nameList); terminalList.append(termWidget); connect(termWidget,SIGNAL(widgetRemoved()),this,SLOT(terminalRemoved())); splitter->addWidget(termWidget); connect(termWidget,SIGNAL(terminalConnectionRequest(QString)),this,SLOT(terminalConnectionRequest(QString))); }
void AccountEditWidget::factoryUnregistered(AccountConfigurationWidgetFactory *factory) { if (AccountConfigurationWidgets.contains(factory)) { AccountConfigurationWidget *widget = AccountConfigurationWidgets.value(factory); if (!widget) return; if (widget->stateNotifier()) CompositeStateNotifier->removeConfigurationValueStateNotifier(widget->stateNotifier()); AccountConfigurationWidgets.remove(factory); emit widgetRemoved(widget); widget->deleteLater(); } }
void ConnectionListWidget::addConnection(ConnectionUnit *cUnit) { ConnectionWidget *cw = new ConnectionWidget(this,cUnit); connectionList.append(cw); QListWidgetItem *item = new QListWidgetItem; listWidget->addItem(item); listWidget->setItemWidget(item,cw); item->setSizeHint(cw->sizeHint()); connect(cw,SIGNAL(nameChange()),this,SLOT(nameChanged())); connect(cw,SIGNAL(widgetRemoved()),this,SLOT(connectionRemoved())); connect(cw,SIGNAL(sizeChange(QSize)),this,SLOT(sizeChanged(QSize))); updateList(); }
void ChatDataWindow::factoryUnregistered(ChatConfigurationWidgetFactory *factory) { if (ChatConfigurationWidgets.contains(factory)) { ChatConfigurationWidget *widget = ChatConfigurationWidgets.value(factory); ChatConfigurationWidgets.remove(factory); if (widget) { if (widget->stateNotifier()) ValueStateNotifier->removeConfigurationValueStateNotifier(widget->stateNotifier()); emit widgetRemoved(widget); widget->deleteLater(); } } }
void FormWindowBase::deleteWidgetList(const QWidgetList &widget_list) { // We need a macro here even for single widgets because the some components (for example, // the signal slot editor are connected to widgetRemoved() and add their // own commands (for example, to delete w's connections) const QString description = widget_list.size() == 1 ? tr("Delete '%1'").arg(widget_list.front()->objectName()) : tr("Delete"); commandHistory()->beginMacro(description); foreach (QWidget *w, widget_list) { emit widgetRemoved(w); DeleteWidgetCommand *cmd = new DeleteWidgetCommand(this); cmd->init(w); commandHistory()->push(cmd); }
void ConnectionListWidget::newConnection() { ConnectionUnit *connectionUnit = new ConnectionUnit; connectionUnit->setName(newConnectionName()); connections->append(connectionUnit); ConnectionWidget *connWidget = new ConnectionWidget(this, connectionUnit); connectionList.append(connWidget); QListWidgetItem *item = new QListWidgetItem; listWidget->addItem(item); listWidget->setItemWidget(item,connWidget); item->setSizeHint(connWidget->sizeHint()); connect(connWidget,SIGNAL(nameChange()),this,SLOT(nameChanged())); connect(connWidget,SIGNAL(widgetRemoved()),this,SLOT(connectionRemoved())); connect(connWidget,SIGNAL(sizeChange(QSize)),this,SLOT(sizeChanged(QSize))); updateList(); }
/*! \reimp */ QLayoutItem *QStackedLayout::takeAt(int index) { Q_D(QStackedLayout); if (index <0 || index >= d->list.size()) return 0; QLayoutItem *item = d->list.takeAt(index); if (index == d->index) { d->index = -1; if ( d->list.count() > 0 ) { int newIndex = (index == d->list.count()) ? index-1 : index; setCurrentIndex(newIndex); } else { emit currentChanged(-1); } } else if (index < d->index) { --d->index; } emit widgetRemoved(index); if (item->widget() && !qt_wasDeleted(item->widget())) item->widget()->hide(); return item; }
void ConnectionListWidget::addConnection(QString name, int connType, QString address, QString port) { ConnectionUnit *cUnit = new ConnectionUnit; cUnit->setName(name); cUnit->setType((connectionType) connType); cUnit->setAddress_Port(address); cUnit->setPort_Baud(port.toLong()); connections->append(cUnit); ConnectionWidget *connWidget = new ConnectionWidget(this,cUnit); connectionList.append(connWidget); QListWidgetItem *item = new QListWidgetItem; listWidget->addItem(item); listWidget->setItemWidget(item,connWidget); item->setSizeHint(connWidget->sizeHint()); connect(connWidget,SIGNAL(nameChange()),this,SLOT(nameChanged())); connect(connWidget,SIGNAL(widgetRemoved()),this,SLOT(connectionRemoved())); connect(connWidget,SIGNAL(sizeChange(QSize)),this,SLOT(sizeChanged(QSize))); updateList(); }
void SimpleMessageStyle::onStyleWidgetDestroyed(QObject *AObject) { FWidgetStatus.remove((QWidget *)AObject); emit widgetRemoved((QWidget *)AObject); }
/*! */ void HsContentService::emitWidgetRemoved(const QString &uri, const QVariantHash &preferences) { emit widgetRemoved(uri, preferences); }