mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-06 01:45:38 +08:00
Font style dialog without changing font color
This commit is contained in:
committed by
Mat Sutcliffe
parent
0b273bafc8
commit
22d67d31a4
@@ -29,9 +29,10 @@ namespace BlackGui
|
||||
this->setMode(CSettingsFontComponent::DirectUpdate);
|
||||
|
||||
this->initValues(); // most likely default font at ctor call time
|
||||
connect(ui->tb_SettingsGuiFontColor, &QToolButton::clicked, this, &CSettingsFontComponent::fontColorDialog);
|
||||
connect(ui->pb_Ok, &QPushButton::clicked, this, &CSettingsFontComponent::changeFont);
|
||||
connect(ui->pb_CancelOrReset, &QToolButton::pressed, this, &CSettingsFontComponent::resetFont);
|
||||
connect(ui->tb_SettingsGuiFontColor, &QToolButton::clicked, this, &CSettingsFontComponent::fontColorDialog);
|
||||
connect(ui->tb_SettingsGuiNoFontColor, &QToolButton::clicked, this, &CSettingsFontComponent::noColor);
|
||||
connect(ui->pb_Ok, &QPushButton::clicked, this, &CSettingsFontComponent::changeFont);
|
||||
connect(ui->pb_CancelOrReset, &QToolButton::clicked, this, &CSettingsFontComponent::resetFont);
|
||||
|
||||
// only after the complete startup style sheet font overrides are available
|
||||
connect(sGui, &CGuiApplication::startUpCompleted, this, &CSettingsFontComponent::initValues);
|
||||
@@ -69,7 +70,7 @@ namespace BlackGui
|
||||
const QString fontSize = ui->cb_SettingsGuiFontSize->currentText().append("pt");
|
||||
const QString fontFamily = ui->cb_SettingsGuiFont->currentFont().family();
|
||||
const QString fontStyleCombined = ui->cb_SettingsGuiFontStyle->currentText();
|
||||
return QStringList ({ fontFamily, fontSize, fontStyleCombined });
|
||||
return QStringList({ fontFamily, fontSize, fontStyleCombined });
|
||||
}
|
||||
|
||||
void CSettingsFontComponent::setWithColorSelection(bool withColor)
|
||||
@@ -88,7 +89,8 @@ namespace BlackGui
|
||||
QString fontColor = m_selectedColor.name();
|
||||
if (!m_selectedColor.isValid() || m_selectedColor.name().isEmpty())
|
||||
{
|
||||
fontColor = sGui->getStyleSheetUtility().fontColor();
|
||||
// fontColor = sGui->getStyleSheetUtility().fontColor();
|
||||
fontColor.clear();
|
||||
}
|
||||
ui->le_SettingsGuiFontColor->setText(fontColor);
|
||||
m_qss = CStyleSheetUtility::asStylesheet(fontFamily, fontSize, CStyleSheetUtility::fontStyle(fontStyleCombined), CStyleSheetUtility::fontWeight(fontStyleCombined), fontColor);
|
||||
@@ -115,6 +117,12 @@ namespace BlackGui
|
||||
ui->le_SettingsGuiFontColor->setText(m_selectedColor.name());
|
||||
}
|
||||
|
||||
void CSettingsFontComponent::noColor()
|
||||
{
|
||||
m_selectedColor = QColor(); // invalid color
|
||||
ui->le_SettingsGuiFontColor->clear();
|
||||
}
|
||||
|
||||
void CSettingsFontComponent::initValues()
|
||||
{
|
||||
// Font
|
||||
@@ -135,6 +143,7 @@ namespace BlackGui
|
||||
|
||||
void CSettingsFontComponent::resetFont()
|
||||
{
|
||||
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||
this->initUiValues(m_cancelFont, m_cancelColor);
|
||||
if (m_mode == CSettingsFontComponent::DirectUpdate)
|
||||
{
|
||||
|
||||
@@ -75,6 +75,7 @@ namespace BlackGui
|
||||
void changeFont();
|
||||
void resetFont();
|
||||
void fontColorDialog();
|
||||
void noColor();
|
||||
void initValues();
|
||||
void initUiValues(const QFont &font, const QColor &color);
|
||||
};
|
||||
|
||||
@@ -26,27 +26,94 @@
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item row="0" column="1" colspan="6">
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="cb_SettingsGuiFontStyle">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>bold</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>italic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>bold italic</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="7">
|
||||
<widget class="QWidget" name="wi_Buttons" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="vl_Buttons">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="hs_Buttons">
|
||||
<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="QPushButton" name="pb_Ok">
|
||||
<property name="text">
|
||||
<string>ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_CancelOrReset">
|
||||
<property name="text">
|
||||
<string>cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" colspan="7">
|
||||
<widget class="QFontComboBox" name="cb_SettingsGuiFont">
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFontSize">
|
||||
<property name="text">
|
||||
<string>Size/Style:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFont">
|
||||
<property name="text">
|
||||
<string>Font:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cb_SettingsGuiFontSize">
|
||||
<property name="minimumSize">
|
||||
@@ -111,6 +178,13 @@
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFontSize">
|
||||
<property name="text">
|
||||
<string>Size/Style:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="4">
|
||||
<widget class="QToolButton" name="tb_SettingsGuiFontColor">
|
||||
<property name="text">
|
||||
@@ -118,6 +192,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lbl_SettingsGuiFont">
|
||||
<property name="text">
|
||||
<string>Font:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="le_SettingsGuiFontColor">
|
||||
<property name="maxLength">
|
||||
@@ -128,85 +209,11 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QComboBox" name="cb_SettingsGuiFontStyle">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
<item row="1" column="5">
|
||||
<widget class="QToolButton" name="tb_SettingsGuiNoFontColor">
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>normal</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>bold</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>italic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>bold italic</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="6">
|
||||
<widget class="QWidget" name="wi_Buttons" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="vl_Buttons">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<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="QPushButton" name="pb_Ok">
|
||||
<property name="text">
|
||||
<string>ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pb_CancelOrReset">
|
||||
<property name="text">
|
||||
<string>cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
Reference in New Issue
Block a user