Use a different parent for dialogs
This allows customizing the tray menu/widget using style sheets without affecting the dialogs.
This commit is contained in:
parent
353f1e2463
commit
19816437ea
|
@ -18,6 +18,7 @@ TrayMenu::TrayMenu(TrayIcon *trayIcon, QWidget *parent)
|
|||
: QMenu(parent)
|
||||
, m_trayIcon(trayIcon)
|
||||
{
|
||||
setObjectName(QStringLiteral("QtGui::TrayMenu"));
|
||||
auto *const menuLayout = new QHBoxLayout;
|
||||
menuLayout->setContentsMargins(0, 0, 0, 0);
|
||||
menuLayout->setSpacing(0);
|
||||
|
|
|
@ -206,8 +206,11 @@ TrayWidget::~TrayWidget()
|
|||
|
||||
void TrayWidget::showSettingsDialog()
|
||||
{
|
||||
if (!m_dialogParent) {
|
||||
m_dialogParent = make_unique<QWidget>();
|
||||
}
|
||||
if (!s_settingsDlg) {
|
||||
s_settingsDlg = new SettingsDialog(&m_connection, this);
|
||||
s_settingsDlg = new SettingsDialog(&m_connection, m_dialogParent.get());
|
||||
connect(s_settingsDlg, &SettingsDialog::applied, &TrayWidget::applySettingsOnAllInstances);
|
||||
}
|
||||
centerWidget(s_settingsDlg);
|
||||
|
@ -216,8 +219,11 @@ void TrayWidget::showSettingsDialog()
|
|||
|
||||
void TrayWidget::showAboutDialog()
|
||||
{
|
||||
if (!m_dialogParent) {
|
||||
m_dialogParent = make_unique<QWidget>();
|
||||
}
|
||||
if (!s_aboutDlg) {
|
||||
s_aboutDlg = new AboutDialog(this, QString(),
|
||||
s_aboutDlg = new AboutDialog(m_dialogParent.get(), QString(),
|
||||
QStringLiteral(
|
||||
"<p>Developed by " APP_AUTHOR
|
||||
"<br>Fallback icons from KDE/Breeze project<br>Syncthing icons from <a href=\"https://syncthing.net\">Syncthing project</a><br>Using "
|
||||
|
|
|
@ -101,6 +101,7 @@ private slots:
|
|||
|
||||
private:
|
||||
TrayMenu *m_menu;
|
||||
std::unique_ptr<QWidget> m_dialogParent;
|
||||
std::unique_ptr<Ui::TrayWidget> m_ui;
|
||||
static SettingsDialog *s_settingsDlg;
|
||||
static QtUtilities::AboutDialog *s_aboutDlg;
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
QtGui--TrayMenu {
|
||||
border: none;
|
||||
background-color: #000;
|
||||
qproperty-windowOpacity: 0.8;
|
||||
}
|
||||
QtGui--TrayWidget {
|
||||
color: #fff;
|
||||
background-color: rgba(255,0,0,50%);
|
||||
qproperty-windowOpacity: 0.8;
|
||||
}
|
||||
QtGui--TrayWidget * {
|
||||
color: #fff;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
QtGui--TrayWidget QTreeView::branch {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
QtGui--TrayWidget > QFrame {
|
||||
border-bottom: 1px solid #555;
|
||||
border-radius: 0px;
|
||||
padding: 2px;
|
||||
}
|
Loading…
Reference in New Issue