What should okular background color be

Albert Freeman albertwdfreeman at gmail.com
Wed Aug 9 01:15:32 UTC 2017


I have added the ability for the background color in okular to be changed
via the settings, but currently what I have done is set the default
background color to the RGB value of QPalette::Dark since I don't think it
is a good idea to construct a QPalette in conf/okular.kcfg just to access
QPalette::Dark which is what is used for the background color currently in
okular .

Is this okay, what should the background color be?

diff --git a/conf/dlggeneralbase.ui b/conf/dlggeneralbase.ui
index cf4ebca0..fe373a71 100644
--- a/conf/dlggeneralbase.ui
+++ b/conf/dlggeneralbase.ui
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>558</width>
-    <height>575</height>
+    <height>632</height>
    </rect>
   </property>
   <layout class="QVBoxLayout">
@@ -120,7 +120,7 @@
            <item>
             <widget class="QRadioButton" name="radioFileName">
              <property name="text">
-              <string>Display file name only</string>
+              <string>Disp&lay file name only</string>
              </property>
              <property name="checked">
               <bool>true</bool>
@@ -130,7 +130,7 @@
            <item>
             <widget class="QRadioButton" name="radioFilePath">
              <property name="text">
-              <string>Display full file path</string>
+              <string>Display full file pa&th</string>
              </property>
              <property name="checked">
               <bool>false</bool>
@@ -141,6 +141,29 @@
          </widget>
         </item>
         <item>
+         <layout class="QGridLayout" name="gridLayout_2">
+          <property name="horizontalSpacing">
+           <number>6</number>
+          </property>
+          <property name="verticalSpacing">
+           <number>0</number>
+          </property>
+          <item row="1" column="0">
+           <widget class="QLabel" name="textLabel">
+            <property name="text">
+             <string>Background color:</string>
+            </property>
+            <property name="alignment">
+             <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="KColorButton" name="kcfg_BackgroundColor"/>
+          </item>
+         </layout>
+        </item>
+        <item>
          <layout class="QVBoxLayout" name="verticalLayout">
           <property name="leftMargin">
            <number>4</number>
@@ -319,7 +342,7 @@
       <item row="0" column="0">
        <widget class="QLabel" name="columnLabel">
         <property name="text">
-         <string>Overview &columns:</string>
+         <string>Overview co&lumns:</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -345,7 +368,7 @@
          <string>Defines how much of the current viewing area will
still be visible when pressing the Page Up/Down keys.</string>
         </property>
         <property name="text">
-         <string>&Page Up/Down overlap:</string>
+         <string>Page &Up/Down overlap:</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@@ -439,6 +462,13 @@ For files which were opened before the previous
zoom is applied.</string>
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KColorButton</class>
+   <extends>QPushButton</extends>
+   <header>kcolorbutton.h</header>
+  </customwidget>
+ </customwidgets>
  <includes>
   <include location="global">kiconloader.h</include>
  </includes>
diff --git a/conf/okular.kcfg b/conf/okular.kcfg
index 69ea8cf6..07113f87 100644
--- a/conf/okular.kcfg
+++ b/conf/okular.kcfg
@@ -290,6 +290,9 @@
   <entry key="ShowSourceLocationsGraphically" type="Bool" >
    <default>false</default>
   </entry>
+  <entry key="BackgroundColor" type="Color" >
+  <default code="true" >QColor(136, 142, 147)</default>
+  </entry>
  </group>
  <group name="Search" >
   <entry key="SearchCaseSensitive" type="Bool">
diff --git a/ui/pageview.cpp b/ui/pageview.cpp
index 3d935a2e..8c6ac3ca 100644
--- a/ui/pageview.cpp
+++ b/ui/pageview.cpp
@@ -3416,7 +3416,7 @@ QList< Okular::RegularAreaRect * >
PageView::textSelections( const QPoint& start

 void PageView::drawDocumentOnPainter( const QRect & contentsRect,
QPainter * p )
 {
-    QColor backColor = viewport()->palette().color( QPalette::Dark );
+    QColor backColor = Okular::Settings::backgroundColor();

     // when checking if an Item is contained in contentsRect, instead of
     // growing PageViewItems rects (for keeping outline into account), we
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20170809/d309f10e/attachment-0001.html>


More information about the Okular-devel mailing list