namespace lyx {
RGBColor set_backgroundcolor;
+bool is_backgroundcolor;
RGBColor set_fontcolor;
bool is_fontcolor;
RGBColor set_notefontcolor;
this, SLOT(deleteNoteFontColor()));
connect(colorModule->backgroundPB, SIGNAL(clicked()),
this, SLOT(changeBackgroundColor()));
- connect(colorModule->delbackgroundTB, SIGNAL(clicked()),
+ connect(colorModule->delBackgroundTB, SIGNAL(clicked()),
this, SLOT(deleteBackgroundColor()));
rgb2qcolor(set_backgroundcolor), asQWidget());
if (!newColor.isValid())
return;
- // set the button color
+ // set the button color and text
colorModule->backgroundPB->setStyleSheet(
colorButtonStyleSheet(newColor));
+ colorModule->backgroundPB->setText(toqstr("Change..."));
// save color
set_backgroundcolor = rgbFromHexName(fromqstr(newColor.name()));
+ is_backgroundcolor = true;
changed();
}
void GuiDocument::deleteBackgroundColor()
{
- // set the button color back to white
- colorModule->backgroundPB->setStyleSheet(
- colorButtonStyleSheet(QColor(Qt::white)));
- // save white as the set color
+ // set the button color back to default by setting an epmty StyleSheet
+ colorModule->backgroundPB->setStyleSheet(QLatin1String(""));
+ // change button text
+ colorModule->backgroundPB->setText(toqstr("Default..."));
+ // save default color (white)
set_backgroundcolor = rgbFromHexName("#ffffff");
+ is_backgroundcolor = false;
changed();
}
//color
bp_.backgroundcolor = set_backgroundcolor;
+ bp_.isbackgroundcolor = is_backgroundcolor;
bp_.fontcolor = set_fontcolor;
bp_.isfontcolor = is_fontcolor;
bp_.notefontcolor = set_notefontcolor;
colorButtonStyleSheet(rgb2qcolor(bp_.notefontcolor)));
set_notefontcolor = bp_.notefontcolor;
- colorModule->backgroundPB->setStyleSheet(
- colorButtonStyleSheet(rgb2qcolor(bp_.backgroundcolor)));
+ if (bp_.isbackgroundcolor) {
+ colorModule->backgroundPB->setStyleSheet(
+ colorButtonStyleSheet(rgb2qcolor(bp_.backgroundcolor)));
+ }
set_backgroundcolor = bp_.backgroundcolor;
+ is_backgroundcolor = bp_.isbackgroundcolor;
// numbering
int const min_toclevel = documentClass().min_toclevel();
<ui version="4.0" >
<class>ColorUi</class>
- <widget class="QWidget" name="ColorUi" >
- <property name="geometry" >
+ <widget class="QWidget" name="ColorUi">
+ <property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<height>275</height>
</rect>
</property>
- <property name="contextMenuPolicy" >
+ <property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
- <property name="windowTitle" >
+ <property name="windowTitle">
<string>ColorUi</string>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string/>
</property>
- <layout class="QGridLayout" >
- <property name="margin" >
+ <layout class="QGridLayout">
+ <property name="margin">
<number>11</number>
</property>
- <property name="spacing" >
+ <property name="spacing">
<number>6</number>
</property>
- <item row="0" column="0" >
- <widget class="QGroupBox" name="fontcolorGB" >
- <property name="title" >
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="fontcolorGB">
+ <property name="title">
<string>Font colors</string>
</property>
- <property name="flat" >
+ <property name="flat">
<bool>true</bool>
</property>
- <layout class="QGridLayout" >
- <property name="margin" >
+ <layout class="QGridLayout">
+ <property name="margin">
<number>11</number>
</property>
- <property name="spacing" >
+ <property name="spacing">
<number>6</number>
</property>
- <item row="0" column="0" >
- <widget class="QLabel" name="fontColorLA" >
- <property name="text" >
+ <item row="0" column="0">
+ <widget class="QLabel" name="fontColorLA">
+ <property name="text">
<string>Main text:</string>
</property>
- <property name="buddy" >
+ <property name="buddy">
<cstring>fontColorPB</cstring>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>11</number>
- </property>
- <property name="spacing" >
+ <item row="0" column="1">
+ <layout class="QHBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>11</number>
+ </property>
<item>
- <widget class="QPushButton" name="fontColorPB" >
- <property name="maximumSize" >
+ <widget class="QPushButton" name="fontColorPB">
+ <property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string>Click to change the color</string>
</property>
- <property name="text" >
+ <property name="text">
<string>Default...</string>
</property>
</widget>
</item>
<item>
- <widget class="QToolButton" name="delFontColorTB" >
- <property name="minimumSize" >
+ <widget class="QToolButton" name="delFontColorTB">
+ <property name="minimumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string>Revert the color to the default</string>
</property>
- <property name="text" >
+ <property name="text">
<string>R&eset</string>
</property>
- <property name="toolButtonStyle" >
+ <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
- <property name="arrowType" >
+ <property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</item>
</layout>
</item>
- <item row="1" column="0" >
- <widget class="QLabel" name="noteFontColorLA" >
- <property name="text" >
+ <item row="1" column="0">
+ <widget class="QLabel" name="noteFontColorLA">
+ <property name="text">
<string>Greyed-out notes:</string>
</property>
- <property name="buddy" >
+ <property name="buddy">
<cstring>fontColorPB</cstring>
</property>
</widget>
</item>
- <item row="1" column="1" >
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>11</number>
- </property>
- <property name="spacing" >
+ <item row="1" column="1">
+ <layout class="QHBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>11</number>
+ </property>
<item>
- <widget class="QPushButton" name="noteFontColorPB" >
- <property name="maximumSize" >
+ <widget class="QPushButton" name="noteFontColorPB">
+ <property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string>Click to change the color</string>
</property>
- <property name="text" >
+ <property name="text">
<string>&Change...</string>
</property>
</widget>
</item>
<item>
- <widget class="QToolButton" name="delNoteFontColorTB" >
- <property name="minimumSize" >
+ <widget class="QToolButton" name="delNoteFontColorTB">
+ <property name="minimumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string>Revert the color to the default</string>
</property>
- <property name="text" >
+ <property name="text">
<string>R&eset</string>
</property>
- <property name="toolButtonStyle" >
+ <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
- <property name="arrowType" >
+ <property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</layout>
</widget>
</item>
- <item row="1" column="0" >
- <widget class="QGroupBox" name="backgroundGB" >
- <property name="title" >
+ <item row="1" column="0">
+ <widget class="QGroupBox" name="backgroundGB">
+ <property name="title">
<string>Background colors</string>
</property>
- <property name="flat" >
+ <property name="flat">
<bool>true</bool>
</property>
- <layout class="QGridLayout" >
- <property name="margin" >
+ <layout class="QGridLayout">
+ <property name="margin">
<number>11</number>
</property>
- <property name="spacing" >
+ <property name="spacing">
<number>6</number>
</property>
- <item row="0" column="0" >
- <widget class="QLabel" name="backgroundColorLA" >
- <property name="text" >
+ <item row="0" column="0">
+ <widget class="QLabel" name="backgroundColorLA">
+ <property name="text">
<string>Background color:</string>
</property>
- <property name="buddy" >
+ <property name="buddy">
<cstring>backgroundPB</cstring>
</property>
</widget>
</item>
- <item row="0" column="1" >
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>11</number>
- </property>
- <property name="spacing" >
+ <item row="0" column="1">
+ <layout class="QHBoxLayout">
+ <property name="spacing">
<number>6</number>
</property>
+ <property name="margin">
+ <number>11</number>
+ </property>
<item>
- <widget class="QPushButton" name="backgroundPB" >
- <property name="maximumSize" >
+ <widget class="QPushButton" name="backgroundPB">
+ <property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string>Click to change the color</string>
</property>
- <property name="text" >
+ <property name="text">
<string>&Change...</string>
</property>
</widget>
</item>
<item>
- <widget class="QToolButton" name="delbackgroundTB" >
- <property name="minimumSize" >
+ <widget class="QToolButton" name="delBackgroundTB">
+ <property name="minimumSize">
<size>
<width>23</width>
<height>23</height>
</size>
</property>
- <property name="toolTip" >
+ <property name="toolTip">
<string>Revert the color to the default</string>
</property>
- <property name="text" >
+ <property name="text">
<string>R&eset</string>
</property>
- <property name="toolButtonStyle" >
+ <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum>
</property>
- <property name="arrowType" >
+ <property name="arrowType">
<enum>Qt::LeftArrow</enum>
</property>
</widget>
</item>
<item>
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</layout>
</widget>
</item>
- <item row="2" column="0" >
+ <item row="2" column="0">
<spacer>
- <property name="orientation" >
+ <property name="orientation">
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>126</height>
</item>
</layout>
</widget>
- <layoutdefault spacing="6" margin="11" />
+ <layoutdefault spacing="6" margin="11"/>
<includes>
- <include location="local" >qt_i18n.h</include>
+ <include location="local">qt_i18n.h</include>
</includes>
<resources/>
<connections/>