[Qgis-developer] Context help styling

Chris Crook ccrook at linz.govt.nz
Sun Apr 21 12:28:05 PDT 2013


Hi

I'm wanting to tidy up some context help, and can't quite figure out where some of the styling is coming from, and where would be a good place to put styling information if I wanted to.  It looks like it comes from the code

    QString myStyle = QgsApplication::reportStyleSheet();
    helpContents = "<head><style>" + myStyle + "</style></head><body>" + helpContents + "</body>";
    webView->setHtml( helpContents );

The reportStyleSheet() function returns CSS styling for h1 to h5 header levels, but not much else.  I replicated this into an external CSS file, and wrote a little python script to display the help text in a QWebView.

But it doesn't come out quite the same.  For example the spacing in a <pre> </pre> block is different.

So I'm wondering if there is some more styling coming from somewhere I've missed, and that I could maybe use?  And if I did want to have some styles for spans or paragraphs (eg for code), where should I put them

Thanks
Chris

eg
Python script

#!/usr/bin/python
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *

with open('context.css') as fcss:
    css=fcss.read()
with open('QgsDelimitedTextSourceSelect-en_US') as fhtml:
    content=fhtml.read()

html = '<head><style type="text/css">'+css+'</style></head><body>'+content
+'</body>'

app=QApplication([])
main = QWebView()
main.pageAction(QWebPage.Reload).triggered.connect(reload)
main.setHtml(html)
main.show()
app.exec_()


CSS from QgsApplication

p.glossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop: 0
stop: 0.1
stop: 0.5
stop: 0.9
stop: 1 );
color: white;
padding-left: 4px;
padding-top: 20px;
padding-bottom: 8px;
border: 1px solid #6c6c6c;
}
th.glossy{ background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop: 0
stop: 0.1
stop: 0.5
stop: 0.9
stop: 1 );
color: white;
border: 1px solid #6c6c6c;
}
.overview{ font: 1.82em; font-weight: bold;}
body{  background: white;
  color: black;
  font-family: arial,sans-serif;
}
h1{  background-color: #F6F6F6;
  color: #8FB171;
  font-size: x-large;
  font-weight: normal;
  font-family: luxi serif, georgia, times new roman, times, serif;
  background: none;
  padding: 0.75em 0 0;
  margin: 0;
  line-height: 3em;
}
h2{  background-color: #F6F6F6;
  color: #8FB171;
  font-size: medium;
  font-weight: normal;
  font-family: luxi serif, georgia, times new roman, times, serif;
  background: none;
  padding: 0.75em 0 0;
  margin: 0;
  line-height: 1.1em;
}
h3{  background-color: #F6F6F6;
  color: #729FCF;
  font-family: luxi serif, georgia, times new roman, times, serif;
  font-weight: bold;
  font-size: large;
  text-align: right;
  border-bottom: 5px solid #DCEB5C;
}
h4{  background-color: #F6F6F6;
  color: #729FCF;
  font-family: luxi serif, georgia, times new roman, times, serif;
  font-weight: bold;
  font-size: medium;
  text-align: right;
}
h5{    background-color: #F6F6F6;
   color: #729FCF;
   font-family: luxi serif, georgia, times new roman, times, serif;
   font-weight: bold;
   font-size: small;
   text-align: right;
}
a{  color: #729FCF;
  font-family: arial,sans-serif;
  font-size: small;
}
label{  background-color: #FFFFCC;
  border: 1px solid black;
  margin: 1px;
  padding: 0px 3px;
  font-size: small;
}






This message contains information, which is confidential and may be subject to legal privilege. If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz) and destroy the original message. LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ. Thank You.


More information about the Qgis-developer mailing list