Skip to content

Commit 17a2bf1

Browse files
committed
image resize bug fix
1 parent dfbc178 commit 17a2bf1

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/mainwindow.cpp

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ MainWindow::MainWindow(int screen, QWidget *parent) :
6666
mainWindowsList = (MainWindow**)malloc(sizeof(MainWindow*) * QApplication::desktop()->screenCount());
6767
mainWindowsList[m_Screen] = this;
6868
}
69-
setMainBackground(true);
69+
7070
qApp->installEventFilter(this);
7171
mirrored = 0;
7272
currentScreen = m_Screen;
@@ -144,7 +144,7 @@ MainWindow::MainWindow(int screen, QWidget *parent) :
144144
m_ClockForm->show();
145145

146146

147-
147+
setMainBackground(true);
148148

149149
// This hack ensures that the primary screen will have focus
150150
// if there are more screens (move the mouse cursor in the center
@@ -335,11 +335,11 @@ void MainWindow::setMainBackground(bool start)
335335
finalImage = resizeImage(rect, backgroundImage);
336336
// screenImage = &backgroundImage;
337337

338-
if(!formshidden && m_LoginForm != NULL ){
339-
QGraphicsOpacityEffect *blur = new QGraphicsOpacityEffect;
340-
blur->setOpacity(0.5);
338+
if((!formshidden) && m_LoginForm != NULL ){
339+
QGraphicsOpacityEffect *opacitr = new QGraphicsOpacityEffect;
340+
opacitr->setOpacity(0.5);
341341

342-
QImage result = applyEffectToImage(finalImage, blur, 0);
342+
QImage result = applyEffectToImage(finalImage, opacitr, 0);
343343

344344
QBrush brush(result);
345345
palette.setBrush(this->backgroundRole(), brush);
@@ -407,10 +407,10 @@ void MainWindow::setOtherBackgrounds(QImage *backgroundImage, bool start, bool f
407407
tmp_image = resizeImage(rect, *backgroundImage);
408408

409409
if(!formshidden && m_LoginForm != NULL ){
410-
QGraphicsOpacityEffect *blur = new QGraphicsOpacityEffect;
411-
blur->setOpacity(0.5);
410+
QGraphicsOpacityEffect *opacity = new QGraphicsOpacityEffect;
411+
opacity->setOpacity(0.5);
412412

413-
QImage result = applyEffectToImage(tmp_image, blur, 0);
413+
QImage result = applyEffectToImage(tmp_image, opacity, 0);
414414

415415
QBrush brush(result);
416416
palette.setBrush(this->backgroundRole(), brush);
@@ -674,7 +674,6 @@ bool MainWindow::eventFilter(QObject *obj, QEvent *event)
674674

675675

676676
void MainWindow::receiveKeyboardRequest(QPoint from, int width){
677-
showForms();
678677

679678
if(checkTouchScreen())
680679
return;
@@ -761,15 +760,15 @@ int MainWindow::checkTouchScreen(){
761760
}
762761

763762
void MainWindow::receiveKeyboardClose(){
764-
showForms();
763+
765764
screenKeyboard->close();
766765

767766
emit keyboardClosed();
768767

769768
}
770769

771770
void MainWindow::sendKeyPress(QString key){
772-
showForms();
771+
773772
emit sendKeytoChilds(key);
774773

775774
}
@@ -844,6 +843,10 @@ void MainWindow::showForms(void){
844843
return;
845844
}
846845

846+
847+
if(!formshidden)
848+
return;
849+
847850
if(m_LoginForm){
848851
m_LoginForm->showAll();
849852
// m_LoginForm->setFocus(Qt::OtherFocusReason);
@@ -944,7 +947,7 @@ void MainWindow::backgroundTimerCallback(void){
944947

945948
void MainWindow::keyPressEvent(QKeyEvent *event)
946949
{
947-
showForms();
950+
//showForms();
948951
QWidget::keyPressEvent(event);
949952
}
950953
void MainWindow::resetHideFormsTimer(void){

0 commit comments

Comments
 (0)