mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-26 02:35: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->setMode(CSettingsFontComponent::DirectUpdate);
|
||||||
|
|
||||||
this->initValues(); // most likely default font at ctor call time
|
this->initValues(); // most likely default font at ctor call time
|
||||||
connect(ui->tb_SettingsGuiFontColor, &QToolButton::clicked, this, &CSettingsFontComponent::fontColorDialog);
|
connect(ui->tb_SettingsGuiFontColor, &QToolButton::clicked, this, &CSettingsFontComponent::fontColorDialog);
|
||||||
connect(ui->pb_Ok, &QPushButton::clicked, this, &CSettingsFontComponent::changeFont);
|
connect(ui->tb_SettingsGuiNoFontColor, &QToolButton::clicked, this, &CSettingsFontComponent::noColor);
|
||||||
connect(ui->pb_CancelOrReset, &QToolButton::pressed, this, &CSettingsFontComponent::resetFont);
|
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
|
// only after the complete startup style sheet font overrides are available
|
||||||
connect(sGui, &CGuiApplication::startUpCompleted, this, &CSettingsFontComponent::initValues);
|
connect(sGui, &CGuiApplication::startUpCompleted, this, &CSettingsFontComponent::initValues);
|
||||||
@@ -69,7 +70,7 @@ namespace BlackGui
|
|||||||
const QString fontSize = ui->cb_SettingsGuiFontSize->currentText().append("pt");
|
const QString fontSize = ui->cb_SettingsGuiFontSize->currentText().append("pt");
|
||||||
const QString fontFamily = ui->cb_SettingsGuiFont->currentFont().family();
|
const QString fontFamily = ui->cb_SettingsGuiFont->currentFont().family();
|
||||||
const QString fontStyleCombined = ui->cb_SettingsGuiFontStyle->currentText();
|
const QString fontStyleCombined = ui->cb_SettingsGuiFontStyle->currentText();
|
||||||
return QStringList ({ fontFamily, fontSize, fontStyleCombined });
|
return QStringList({ fontFamily, fontSize, fontStyleCombined });
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSettingsFontComponent::setWithColorSelection(bool withColor)
|
void CSettingsFontComponent::setWithColorSelection(bool withColor)
|
||||||
@@ -88,7 +89,8 @@ namespace BlackGui
|
|||||||
QString fontColor = m_selectedColor.name();
|
QString fontColor = m_selectedColor.name();
|
||||||
if (!m_selectedColor.isValid() || m_selectedColor.name().isEmpty())
|
if (!m_selectedColor.isValid() || m_selectedColor.name().isEmpty())
|
||||||
{
|
{
|
||||||
fontColor = sGui->getStyleSheetUtility().fontColor();
|
// fontColor = sGui->getStyleSheetUtility().fontColor();
|
||||||
|
fontColor.clear();
|
||||||
}
|
}
|
||||||
ui->le_SettingsGuiFontColor->setText(fontColor);
|
ui->le_SettingsGuiFontColor->setText(fontColor);
|
||||||
m_qss = CStyleSheetUtility::asStylesheet(fontFamily, fontSize, CStyleSheetUtility::fontStyle(fontStyleCombined), CStyleSheetUtility::fontWeight(fontStyleCombined), 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());
|
ui->le_SettingsGuiFontColor->setText(m_selectedColor.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSettingsFontComponent::noColor()
|
||||||
|
{
|
||||||
|
m_selectedColor = QColor(); // invalid color
|
||||||
|
ui->le_SettingsGuiFontColor->clear();
|
||||||
|
}
|
||||||
|
|
||||||
void CSettingsFontComponent::initValues()
|
void CSettingsFontComponent::initValues()
|
||||||
{
|
{
|
||||||
// Font
|
// Font
|
||||||
@@ -135,6 +143,7 @@ namespace BlackGui
|
|||||||
|
|
||||||
void CSettingsFontComponent::resetFont()
|
void CSettingsFontComponent::resetFont()
|
||||||
{
|
{
|
||||||
|
if (!sGui || sGui->isShuttingDown()) { return; }
|
||||||
this->initUiValues(m_cancelFont, m_cancelColor);
|
this->initUiValues(m_cancelFont, m_cancelColor);
|
||||||
if (m_mode == CSettingsFontComponent::DirectUpdate)
|
if (m_mode == CSettingsFontComponent::DirectUpdate)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ namespace BlackGui
|
|||||||
void changeFont();
|
void changeFont();
|
||||||
void resetFont();
|
void resetFont();
|
||||||
void fontColorDialog();
|
void fontColorDialog();
|
||||||
|
void noColor();
|
||||||
void initValues();
|
void initValues();
|
||||||
void initUiValues(const QFont &font, const QColor &color);
|
void initUiValues(const QFont &font, const QColor &color);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -26,27 +26,94 @@
|
|||||||
<property name="bottomMargin">
|
<property name="bottomMargin">
|
||||||
<number>3</number>
|
<number>3</number>
|
||||||
</property>
|
</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">
|
<widget class="QFontComboBox" name="cb_SettingsGuiFont">
|
||||||
<property name="sizeAdjustPolicy">
|
<property name="sizeAdjustPolicy">
|
||||||
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="1" column="1">
|
||||||
<widget class="QComboBox" name="cb_SettingsGuiFontSize">
|
<widget class="QComboBox" name="cb_SettingsGuiFontSize">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
@@ -111,6 +178,13 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="1" column="4">
|
||||||
<widget class="QToolButton" name="tb_SettingsGuiFontColor">
|
<widget class="QToolButton" name="tb_SettingsGuiFontColor">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -118,6 +192,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="1" column="3">
|
||||||
<widget class="QLineEdit" name="le_SettingsGuiFontColor">
|
<widget class="QLineEdit" name="le_SettingsGuiFontColor">
|
||||||
<property name="maxLength">
|
<property name="maxLength">
|
||||||
@@ -128,85 +209,11 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2">
|
<item row="1" column="5">
|
||||||
<widget class="QComboBox" name="cb_SettingsGuiFontStyle">
|
<widget class="QToolButton" name="tb_SettingsGuiNoFontColor">
|
||||||
<property name="maximumSize">
|
<property name="text">
|
||||||
<size>
|
<string>None</string>
|
||||||
<width>150</width>
|
|
||||||
<height>16777215</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
</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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
Reference in New Issue
Block a user