本文整理汇总了C++中QToolButton::deleteLater方法的典型用法代码示例。如果您正苦于以下问题:C++ QToolButton::deleteLater方法的具体用法?C++ QToolButton::deleteLater怎么用?C++ QToolButton::deleteLater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QToolButton
的用法示例。
在下文中一共展示了QToolButton::deleteLater方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: actionEvent
void ActionListWidget::actionEvent(QActionEvent* event) {
if (event->type() == QEvent::ActionAdded) {
addToolButtonForAction(event->action(),
toolButtonForAction(event->before()));
return;
}
if (event->type() == QEvent::ActionRemoved) {
QToolButton* button = toolButtonForAction(event->action());
layout()->removeWidget(button);
button->deleteLater();
return;
}
}
示例2: actionDragPixmap
QPixmap ActionRepositoryMimeData::actionDragPixmap(const QAction *action)
{
// Try to find a suitable pixmap. Grab either widget or icon.
const QIcon icon = action->icon();
if (!icon.isNull())
return icon.pixmap(QSize(22, 22));
foreach (QWidget *w, action->associatedWidgets())
if (QToolButton *tb = qobject_cast<QToolButton *>(w))
return QPixmap::grabWidget(tb);
// Create a QToolButton
QToolButton *tb = new QToolButton;
tb->setText(action->text());
tb->setToolButtonStyle(Qt::ToolButtonTextOnly);
#ifdef Q_WS_WIN // Force alien off to make adjustSize() take the system minimumsize into account.
tb->createWinId();
#endif
tb->adjustSize();
const QPixmap rc = QPixmap::grabWidget(tb);
tb->deleteLater();
return rc;
}
示例3: QGroupBox
gNodeComponentWidget::gNodeComponentWidget(sJarvisNodeComponent* comp,QWidget *parent) :
QGroupBox(parent), m_component(comp),
ui(new Ui::gNodeComponentWidget)
{
ui->setupUi(this);
this->setTitle(m_component->getId());
QList<jarvisActions> actions = m_component->getActions();
for(int i = 0 ; i < actions.count() ; i++)
{
jarvisActions action = actions[i];
//qDebug() << QString::number(int(action));
QToolButton* b = new QToolButton(ui->actionsBox);
QGridLayout* l = (QGridLayout*)ui->actionsBox->layout();
if (action == A_DIMM){
b->deleteLater();
QSlider* w = new QSlider(this);
w->setMaximum(100);
w->setValue(50);
l->addWidget(w,l->count()/2,l->count()%2);
connect(w,SIGNAL(valueChanged(int)),m_component,SLOT(dimm(int)));
}else if(action == A_SET_COLOR){
connect(b,SIGNAL(clicked()),this,SLOT(selectComponentColor()));
b->setText(m_component->actionName((m_component->getActions()[i])));
l->addWidget(b,l->count()/2,l->count()%2);
}else if(action == A_SET_LEDS){
connect(b,SIGNAL(clicked()),this,SLOT(sendImage()));
b->setText(m_component->actionName((m_component->getActions()[i])));
l->addWidget(b,l->count()/2,l->count()%2);
}else if(action == A_DISPLAY){
connect(b,SIGNAL(clicked()),this,SLOT(sendImage()));
b->setText(m_component->actionName((m_component->getActions()[i])));
l->addWidget(b,l->count()/2,l->count()%2);
}else if(action == A_PLAYRTTTL){
connect(b,SIGNAL(clicked()),this,SLOT(openRtttlPlayer()));
b->setText(m_component->actionName((m_component->getActions()[i])));
l->addWidget(b,l->count()/2,l->count()%2);
}else{
QString slotName = m_component->slotName(m_component->getActions()[i]);
b->setText(m_component->actionName((m_component->getActions()[i])));
l->addWidget(b,l->count()/2,l->count()%2);
connect(b,SIGNAL(clicked()),m_component,slotName.toStdString().c_str());
}
}
QList<jarvisEvents> events = m_component->getCapableEvents();
for(int i = 0 ; i < events.count() ; i++)
{
gBlinkWidget* w = new gBlinkWidget(ui->eventsBox);
QLabel* label = new QLabel(ui->eventsBox);
QGridLayout* l = (QGridLayout*)ui->eventsBox->layout();
l->addWidget(label,i,0);
l->addWidget(w,i,1);
w->setMaximumHeight(50);
if(events[i] == E_RAW_READ)
{
connect(m_component,SIGNAL(rawRead()),w,SLOT(blink()));
connect(m_component,SIGNAL(rawRead(QStringList)),w,SLOT(displayRead(QStringList)));
label->setText(m_component->eventName((m_component->getCapableEvents()[i])));
}else if(events[i] == E_DATA_READ)
{
connect(m_component,SIGNAL(dataRead()),w,SLOT(blink()));
connect(m_component,SIGNAL(dataRead(QStringList)),w,SLOT(displayRead(QStringList)));
label->setText(m_component->eventName((m_component->getCapableEvents()[i])));
}else
{
QString signalName = m_component->signalName(m_component->getCapableEvents()[i]);
label->setText(m_component->eventName((m_component->getCapableEvents()[i])));
connect(m_component,signalName.toStdString().c_str(),w,SLOT(blink()));
}
//w->setMinimumSize(32,32);
//w->setMaximumSize(32,32);
}
}