better handling and display for systray checkbox buttons

This commit is contained in:
Frank Nießen 2015-10-06 21:12:59 +02:00
parent 319edca870
commit c93b12ff05
3 changed files with 74 additions and 17 deletions

View File

@ -73,7 +73,7 @@ SettingsWidget::SettingsWidget(QWidget* parent)
connect(m_generalUi->autoSaveAfterEveryChangeCheckBox, SIGNAL(toggled(bool)), connect(m_generalUi->autoSaveAfterEveryChangeCheckBox, SIGNAL(toggled(bool)),
this, SLOT(enableAutoSaveOnExit(bool))); this, SLOT(enableAutoSaveOnExit(bool)));
connect(m_generalUi->systrayShowCheckBox, SIGNAL(toggled(bool)), connect(m_generalUi->systrayShowCheckBox, SIGNAL(toggled(bool)),
m_generalUi->systrayMinimizeToTrayCheckBox, SLOT(setEnabled(bool))); this, SLOT(enableSystrayMinimizeToTray(bool)));
connect(m_generalUi->systrayMinimizeToTrayCheckBox, SIGNAL(toggled(bool)), connect(m_generalUi->systrayMinimizeToTrayCheckBox, SIGNAL(toggled(bool)),
m_generalUi->systrayMinimizeOnCloseCheckBox, SLOT(setEnabled(bool))); m_generalUi->systrayMinimizeOnCloseCheckBox, SLOT(setEnabled(bool)));
@ -201,3 +201,10 @@ void SettingsWidget::enableAutoSaveOnExit(bool checked)
{ {
m_generalUi->autoSaveOnExitCheckBox->setEnabled(!checked); m_generalUi->autoSaveOnExitCheckBox->setEnabled(!checked);
} }
void SettingsWidget::enableSystrayMinimizeToTray(bool checked)
{
m_generalUi->systrayMinimizeToTrayCheckBox->setEnabled(checked);
bool checked2 = m_generalUi->systrayMinimizeToTrayCheckBox->checkState();
m_generalUi->systrayMinimizeOnCloseCheckBox->setEnabled(checked && checked2);
}

View File

@ -51,6 +51,7 @@ private Q_SLOTS:
void saveSettings(); void saveSettings();
void reject(); void reject();
void enableAutoSaveOnExit(bool checked); void enableAutoSaveOnExit(bool checked);
void enableSystrayMinimizeToTray(bool checked);
private: private:
QWidget* const m_secWidget; QWidget* const m_secWidget;

View File

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>456</width> <width>684</width>
<height>346</height> <height>394</height>
</rect> </rect>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
@ -104,16 +104,63 @@
</widget> </widget>
</item> </item>
<item row="11" column="0"> <item row="11" column="0">
<layout class="QHBoxLayout" name="systrayLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="systrayMinimizeToTrayCheckBox"> <widget class="QCheckBox" name="systrayMinimizeToTrayCheckBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text"> <property name="text">
<string>Hide window to system tray when minimized</string> <string>Hide window to system tray when minimized</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</item>
<item row="12" column="0"> <item row="12" column="0">
<layout class="QHBoxLayout" name="systray2Layout">
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="systrayMinimizeOnCloseCheckBox"> <widget class="QCheckBox" name="systrayMinimizeOnCloseCheckBox">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
@ -124,6 +171,8 @@
</widget> </widget>
</item> </item>
</layout> </layout>
</item>
</layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>