Display scrollbar in helpwindow
authorDaniel Klaffenbach <danielklaffenbach@gmail.com>
Tue, 16 Nov 2010 23:47:09 +0000 (00:47 +0100)
committerDaniel Klaffenbach <danielklaffenbach@gmail.com>
Tue, 16 Nov 2010 23:47:09 +0000 (00:47 +0100)
For some reason a QTextBrowser formatted with a stylesheet does not
display scrollbars on Maemo 5 with Qt 4.6/Qt 4.7. To work around this
limitation the helpwindow was modified to consist of a QScrollArea
containing a QLabel - this also eliminates the need for stylesheets.

src/helpwindow.cpp
src/helpwindow.ui

index d6ab84a..79da304 100644 (file)
 #include <QLocale>
 #include <QTextStream>
 #include <QMessageBox>
-#include <QPalette>
-#include <QBrush>
-#include <QColor>
+
 
 HelpWindow::HelpWindow(QWidget *parent) :
     QWidget(parent),
     ui(new Ui::HelpWindow)
 {
-    //this is a stacked window on Maemo 5
-    #if defined(Q_WS_MAEMO_5)
-       //setAttribute(Qt::WA_Maemo5StackedWindow);
-    #endif
     ui->setupUi(this);
 
     setHelpText();
-
-    //format color of help text according to system color scheme
-    QPalette palette;
-    QBrush brush = palette.windowText();
-    QColor color = brush.color();
-    ui->textBrowser->setStyleSheet( "QTextEdit {background: transparent; color: " + color.name() + ";}" );
 }
 
 
index 3619ded..9516cc1 100644 (file)
   <property name="windowTitle">
    <string>Help</string>
   </property>
-  <layout class="QGridLayout" name="gridLayout">
+  <layout class="QGridLayout" name="gridLayout_2">
    <item row="0" column="0">
-    <widget class="QTextBrowser" name="textBrowser">
-     <property name="styleSheet">
-      <string notr="true"/>
-     </property>
+    <widget class="QScrollArea" name="scrollArea">
      <property name="frameShape">
       <enum>QFrame::NoFrame</enum>
      </property>
-     <property name="horizontalScrollBarPolicy">
-      <enum>Qt::ScrollBarAlwaysOff</enum>
+     <property name="frameShadow">
+      <enum>QFrame::Plain</enum>
+     </property>
+     <property name="widgetResizable">
+      <bool>true</bool>
      </property>
+     <widget class="QWidget" name="scrollAreaWidgetContents">
+      <property name="geometry">
+       <rect>
+        <x>0</x>
+        <y>0</y>
+        <width>522</width>
+        <height>407</height>
+       </rect>
+      </property>
+      <layout class="QGridLayout" name="gridLayout">
+       <item row="0" column="0">
+        <widget class="QLabel" name="textBrowser">
+         <property name="locale">
+          <locale language="English" country="UnitedStates"/>
+         </property>
+         <property name="text">
+          <string>Cannot open help file!</string>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
   </layout>