PlayList::PlayList(Player *player, QWidget *parent) : QWidget(parent), ui(new Ui::PlayList) { ui->setupUi(this); curIndex = 0; lengthFilter = 0; this->player = player; ui->playListTable->horizontalHeader()->setStretchLastSection(true);//自动设置最后一列宽度 this->setWindowFlags(Qt::WindowTitleHint | Qt::CustomizeWindowHint); this->setFixedSize(this->width(), this->height()); //“查找”文本框,绑定回车键到“查找”按钮 connect(ui->searchEdit, SIGNAL(returnPressed()), this, SLOT(on_searchButton_clicked())); readFromFile(QCoreApplication::applicationDirPath() + "/PlayList.sdpl"); //搜索功能部分的动画 //搜索条 finderAnimation = new QPropertyAnimation(ui->finderFlame, "geometry"); finderAnimation->setEasingCurve(QEasingCurve::OutCirc); finderAnimation->setDuration(600); finderAnimation->setStartValue(QRect(331, 330, 331, 31)); finderAnimation->setEndValue(QRect(0, 330, 331, 31)); //播放列表 playListAnimation = new QPropertyAnimation(ui->playListTable, "geometry"); playListAnimation->setDuration(600); playListAnimation->setEasingCurve(QEasingCurve::OutCirc); }
void SearchBar::startSearch(const QString &text) { ui->searchLineEdit->setText(text); on_searchButton_clicked(); }
void File::on_searchBox_returnPressed() { on_searchButton_clicked(true); }
void File::on_searchBox_textEdited(QString const& text) { m_searchText = text; on_searchButton_clicked(true); }
void MainWindow::on_searchText_returnPressed() { on_searchButton_clicked(); return; }
void SongSearch::keyPressEvent(QKeyEvent *event) { if(event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return) on_searchButton_clicked(); }