Skip to content

Commit

Permalink
image resize bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
onurkepenek committed Mar 17, 2020
1 parent dfbc178 commit 17a2bf1
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ MainWindow::MainWindow(int screen, QWidget *parent) :
mainWindowsList = (MainWindow**)malloc(sizeof(MainWindow*) * QApplication::desktop()->screenCount());
mainWindowsList[m_Screen] = this;
}
setMainBackground(true);

qApp->installEventFilter(this);
mirrored = 0;
currentScreen = m_Screen;
Expand Down Expand Up @@ -144,7 +144,7 @@ MainWindow::MainWindow(int screen, QWidget *parent) :
m_ClockForm->show();



setMainBackground(true);

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

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

QImage result = applyEffectToImage(finalImage, blur, 0);
QImage result = applyEffectToImage(finalImage, opacitr, 0);

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

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

QImage result = applyEffectToImage(tmp_image, blur, 0);
QImage result = applyEffectToImage(tmp_image, opacity, 0);

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


void MainWindow::receiveKeyboardRequest(QPoint from, int width){
showForms();

if(checkTouchScreen())
return;
Expand Down Expand Up @@ -761,15 +760,15 @@ int MainWindow::checkTouchScreen(){
}

void MainWindow::receiveKeyboardClose(){
showForms();

screenKeyboard->close();

emit keyboardClosed();

}

void MainWindow::sendKeyPress(QString key){
showForms();

emit sendKeytoChilds(key);

}
Expand Down Expand Up @@ -844,6 +843,10 @@ void MainWindow::showForms(void){
return;
}


if(!formshidden)
return;

if(m_LoginForm){
m_LoginForm->showAll();
// m_LoginForm->setFocus(Qt::OtherFocusReason);
Expand Down Expand Up @@ -944,7 +947,7 @@ void MainWindow::backgroundTimerCallback(void){

void MainWindow::keyPressEvent(QKeyEvent *event)
{
showForms();
//showForms();
QWidget::keyPressEvent(event);
}
void MainWindow::resetHideFormsTimer(void){
Expand Down

0 comments on commit 17a2bf1

Please sign in to comment.