update for DWM QtWinExtras on PictureDialog

This commit is contained in:
Rafael 2016-11-01 18:39:25 +01:00
parent c7b0a8917e
commit 833bb90e4a
2 changed files with 36 additions and 10 deletions

View file

@ -30,6 +30,7 @@
#ifdef GTA5SYNC_WIN
#if QT_VERSION >= 0x050000
#include <QtWinExtras/QtWin>
#include <QWinEvent>
#endif
#endif
@ -100,8 +101,6 @@ void PictureDialog::addPreviousNextButtons()
// Windows Vista additions
#ifdef GTA5SYNC_WIN
#if QT_VERSION >= 0x050000
if (QtWin::isCompositionEnabled())
{
QPalette palette;
QToolBar *uiToolbar = new QToolBar("Picture Toolbar", this);
layout()->setMenuBar(uiToolbar);
@ -109,15 +108,40 @@ void PictureDialog::addPreviousNextButtons()
QAction *nextAction = uiToolbar->addAction("->", this, SLOT(nextPictureRequestedSlot()));
backAction->setToolTip("");
nextAction->setToolTip("");
ui->jsonFrame->setStyleSheet(QString("QFrame { background: %1; }").arg(palette.window().color().name()));
stylize();
#endif
#endif
}
QtWin::extendFrameIntoClientArea(this, 0, uiToolbar->height() - 2, 0, 0);
void PictureDialog::stylize()
{
if (QtWin::isCompositionEnabled())
{
//qDebug() << this->layout()->menuBar()->height();
QtWin::extendFrameIntoClientArea(this, 0, this->layout()->menuBar()->height() - 2, 0, 0);
setAttribute(Qt::WA_TranslucentBackground, true);
setAttribute(Qt::WA_NoSystemBackground, false);
setStyleSheet("PictureDialog { background: transparent; }");
ui->jsonFrame->setStyleSheet(QString("QFrame { background: %1; }").arg(palette.window().color().name()));
}
else
{
QtWin::resetExtendedFrame(this);
setAttribute(Qt::WA_TranslucentBackground, false);
}
}
bool PictureDialog::event(QEvent *event)
{
#ifdef GTA5SYNC_WIN
#if QT_VERSION >= 0x050000
if (event->type() == QWinEvent::CompositionChange || event->type() == QWinEvent::ColorizationChange)
{
stylize();
}
#endif
#endif
return QDialog::event(event);
}
void PictureDialog::nextPictureRequestedSlot()

View file

@ -63,6 +63,7 @@ private slots:
void exportCustomContextMenuRequestedPrivate(const QPoint &pos, bool fullscreen);
void nextPictureRequestedSlot();
void previousPictureRequestedSlot();
void stylize();
signals:
void nextPictureRequested();
@ -72,6 +73,7 @@ signals:
protected:
bool eventFilter(QObject *obj, QEvent *ev);
void mousePressEvent(QMouseEvent *ev);
bool event(QEvent *event);
private:
ProfileDatabase *profileDB;