Skip to content

Commit

Permalink
修复首次启动窗口时焦点问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xinhecuican committed Jun 26, 2024
1 parent 15cbc5f commit a1b190b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Manager/WindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ void WindowManager::changeWindow(QString name, QVariant data1, QVariant data2, b
windowList[activeWindow].time = QDateTime::currentDateTime().currentSecsSinceEpoch();
windowList[activeWindow].window->onWindowSelect();
windowList[name].window->show();
windowList[name].window->activateWindow();
windowList[name].window->raise();
windowList[activeWindow].window->receiveData(data1, data2);
}
KeyManager::instance()->onWindowChangeEnd(name);
Expand Down
4 changes: 3 additions & 1 deletion Windows/scrollerwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,9 @@ ScrollerWindow::~ScrollerWindow() {

void ScrollerWindow::paintEvent(QPaintEvent* event){
QPainter painter(this);
if(scrollState != SCROLL_AUTO && scrollState != SCROLL_MANUAL && scrollState != SCROLL_END)
if(scrollState != SCROLL_AUTO && scrollState != SCROLL_MANUAL && scrollState != SCROLL_END) {
painter.fillRect(QRect(0, 0, screenGeometry.width(), screenGeometry.height()), QColor(0, 0, 0, 1));
}

QPen pen;
pen.setColor(QColor(255, 0, 0));
Expand All @@ -150,6 +151,7 @@ void ScrollerWindow::paintEvent(QPaintEvent* event){

void ScrollerWindow::mousePressEvent(QMouseEvent *event){
beginPoint = event->pos();
qDebug() << beginPoint << scrollState;
if((event->button() == Qt::LeftButton || event->button() == Qt::MidButton) &&
scrollState != SCROLL_AUTO && scrollState != SCROLL_MANUAL && scrollState != SCROLL_END){
// 手动设置滚动截屏区域
Expand Down

0 comments on commit a1b190b

Please sign in to comment.