void MainWindow::on_del_clicked() { if(ui->listWidget->count()<=1||ui->listWidget->currentRow()<0||!firstStart) return; int removeIndex=ui->listWidget->currentRow(); if(removeIndex==currentSegIndex) return; for(int i=ui->listWidget->count()-1;i>removeIndex;i--) ui->listWidget->item(i)->setText(QString::number(i)); QListWidgetItem* item=ui->listWidget->takeItem(removeIndex); delete item; segTime.removeAt(removeIndex); updateSpinBoxTime(); on_listWidget_itemSelectionChanged(); }
void MainWindow::on_listWidget_itemPressed(QListWidgetItem *item) { on_listWidget_itemSelectionChanged(); }
void MainWindow::on_spinBox_3_editingFinished()//save h { segTime[ui->listWidget->currentRow()].h=ui->spinBox_3->value(); on_listWidget_itemSelectionChanged(); }
AbstractConfig::AbstractConfig(AbstractContent * content, QWidget * parent) : QDialog(parent) , m_content(content) , m_commonUi(new Ui::AbstractConfig()) , m_closeButton(0) , m_okButton(0) , m_frame(FrameFactory::defaultPanelFrame()) { // WIDGET setup QWidget * widget = new QWidget(this); // #if QT_VERSION < 0x040500 // widget->setAttribute(Qt::WA_NoSystemBackground, true); // #else // widget->setAttribute(Qt::WA_TranslucentBackground, true); // #endif m_commonUi->setupUi(widget); populateFrameList(); // select the frame quint32 frameClass = m_content->frameClass(); if (frameClass != Frame::NoFrame) { for (int i = 0; i < m_commonUi->listWidget->count(); ++i) { QListWidgetItem * item = m_commonUi->listWidget->item(i); if (item->data(Qt::UserRole).toUInt() == frameClass) { item->setSelected(true); break; } } } // read other properties m_commonUi->reflection->setChecked(m_content->mirrorEnabled()); connect(m_commonUi->front, SIGNAL(clicked()), m_content, SLOT(slotStackFront())); connect(m_commonUi->raise, SIGNAL(clicked()), m_content, SLOT(slotStackRaise())); connect(m_commonUi->lower, SIGNAL(clicked()), m_content, SLOT(slotStackLower())); connect(m_commonUi->back, SIGNAL(clicked()), m_content, SLOT(slotStackBack())); connect(m_commonUi->background, SIGNAL(clicked()), m_content, SIGNAL(backgroundMe())); connect(m_commonUi->save, SIGNAL(clicked()), m_content, SLOT(slotSaveAs())); connect(m_commonUi->del, SIGNAL(clicked()), m_content, SIGNAL(deleteItem()), Qt::QueuedConnection); // autoconnection doesn't work because we don't do ->setupUi(this), so here we connect manually connect(m_commonUi->applyLooks, SIGNAL(clicked()), this, SLOT(on_applyLooks_clicked())); connect(m_commonUi->newFrame, SIGNAL(clicked()), this, SLOT(on_newFrame_clicked())); connect(m_commonUi->listWidget, SIGNAL(itemSelectionChanged()), this, SLOT(on_listWidget_itemSelectionChanged())); connect(m_commonUi->reflection, SIGNAL(toggled(bool)), this, SLOT(on_reflection_toggled(bool))); // // ITEM setup // setWidget(widget); // static qreal s_propZBase = 99999; // setZValue(s_propZBase++); QBoxLayout *layout = new QVBoxLayout; layout->addWidget(widget); // layout->addWidget(rotateSlider); // layout->addLayout(controlLayout); m_okButton = new QPushButton(tr("Ok")); m_okButton->setDefault(true); connect(m_okButton, SIGNAL(clicked()), this, SLOT(slotOkClicked())); m_closeButton = new QPushButton(tr("Cancel")); connect(m_closeButton, SIGNAL(clicked()), this, SLOT(reject())); setWindowTitle("Item Settings"); QBoxLayout *controlLayout = new QHBoxLayout; controlLayout->addStretch(1); controlLayout->addWidget(m_closeButton); controlLayout->addWidget(m_okButton); layout->addLayout(controlLayout); setLayout(layout); /* #if QT_VERSION >= 0x040600 // fade in animation QPropertyAnimation * ani = new QPropertyAnimation(this, "opacity"); ani->setEasingCurve(QEasingCurve::OutCubic); ani->setDuration(400); ani->setStartValue(0.0); ani->setEndValue(1.0); ani->start(QPropertyAnimation::DeleteWhenStopped); #endif*/ }