wip: working carousel :D
This commit is contained in:
+9
-1
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* @Author: Uyanide pywang0608@foxmail.com
|
||||
* @Date: 2025-08-05 00:37:58
|
||||
* @LastEditTime: 2025-08-05 12:18:00
|
||||
* @LastEditTime: 2025-08-05 16:51:52
|
||||
* @Description:
|
||||
*/
|
||||
#include "mainwindow.h"
|
||||
@@ -30,6 +30,10 @@ void MainWindow::_setupUI() {
|
||||
connect(ui->cancelButton, &QPushButton::clicked, this, &MainWindow::onCancel);
|
||||
ui->confirmButton->setFocusPolicy(Qt::NoFocus);
|
||||
ui->cancelButton->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
for (const auto &image : m_config->getWallpapers()) {
|
||||
ui->carousel->appendImage(image);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::keyPressEvent(QKeyEvent *event) {
|
||||
@@ -37,6 +41,10 @@ void MainWindow::keyPressEvent(QKeyEvent *event) {
|
||||
onCancel();
|
||||
} else if (event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter) {
|
||||
onConfirm();
|
||||
} else if (event->key() == Qt::Key_Space || event->key() == Qt::Key_Tab || event->key() == Qt::Key_Right) {
|
||||
ui->carousel->focusNextImage();
|
||||
} else if (event->key() == Qt::Key_Left) {
|
||||
ui->carousel->focusPrevImage();
|
||||
} else {
|
||||
QMainWindow::keyPressEvent(event);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user