UI: add drop shadow to mainwindow labels
This commit is contained in:
parent
5d609cdace
commit
af8e61c124
1
main.cpp
1
main.cpp
|
@ -21,7 +21,6 @@ int main(int argc, char *argv[])
|
|||
if (translator.load(QLocale(), QLatin1String("pineapple-music"), QLatin1String("_"), QLatin1String(":/i18n"))) {
|
||||
a.installTranslator(&translator);
|
||||
}
|
||||
a.installTranslator(&translator);
|
||||
|
||||
// parse commandline arguments
|
||||
QCommandLineParser parser;
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QStringBuilder>
|
||||
#include <QSettings>
|
||||
#include <QGraphicsDropShadowEffect>
|
||||
|
||||
constexpr QSize miniSize(490, 160);
|
||||
constexpr QSize fullSize(490, 420);
|
||||
|
@ -61,6 +62,11 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
ui->actionOpen->setShortcut(QKeySequence::Open);
|
||||
addAction(ui->actionOpen);
|
||||
|
||||
ui->titleLabel->setGraphicsEffect(createLabelShadowEffect());
|
||||
ui->propLabel->setGraphicsEffect(createLabelShadowEffect());
|
||||
ui->nowTimeLabel->setGraphicsEffect(createLabelShadowEffect());
|
||||
ui->totalTimeLabel->setGraphicsEffect(createLabelShadowEffect());
|
||||
|
||||
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinimizeButtonHint);
|
||||
setAttribute(Qt::WA_TranslucentBackground, true);
|
||||
|
||||
|
@ -668,3 +674,12 @@ void MainWindow::on_actionHelp_triggered()
|
|||
infoBox.exec();
|
||||
}
|
||||
|
||||
QGraphicsDropShadowEffect *MainWindow::createLabelShadowEffect()
|
||||
{
|
||||
QGraphicsDropShadowEffect * effect = new QGraphicsDropShadowEffect(this);
|
||||
effect->setBlurRadius(3);
|
||||
effect->setColor(QColor(0, 0, 0, 180));
|
||||
effect->setOffset(1, 1);
|
||||
return effect;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ class QMediaDevices;
|
|||
class QMediaPlayer;
|
||||
class QAudioOutput;
|
||||
class QPropertyAnimation;
|
||||
class QGraphicsDropShadowEffect;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class FFTSpectrum;
|
||||
|
@ -83,6 +84,8 @@ signals:
|
|||
void playbackModeChanged(enum PlaybackMode mode);
|
||||
|
||||
private:
|
||||
QGraphicsDropShadowEffect * createLabelShadowEffect();
|
||||
|
||||
bool m_clickedOnWindow = false;
|
||||
bool m_playbackSliderPressed = false;
|
||||
QLinearGradient m_bgLinearGradient;
|
||||
|
|
Loading…
Reference in New Issue
Block a user