[elvystrac] r2226 - style & text background problem fixed

  • From: elvys@xxxxxxxxxxxxxxxxxxxxxx
  • To: elvystrac@xxxxxxxxxxxxx
  • Date: Wed, 7 Apr 2010 23:50:44 +0200

Author: JirkaH
Date: 2010-04-07 23:50:44 +0200 (Wed, 07 Apr 2010)
New Revision: 2226

Modified:
   trunk/client/elvys-client/src/main.cpp
   trunk/client/elvys-client/src/panel.cpp
   trunk/client/elvys-client/src/pdfdocument.cpp
   trunk/client/elvys-client/src/textdocument.cpp
Log:
style & text background problem fixed


Modified: trunk/client/elvys-client/src/main.cpp
===================================================================
--- trunk/client/elvys-client/src/main.cpp      2010-04-07 06:58:56 UTC (rev 
2225)
+++ trunk/client/elvys-client/src/main.cpp      2010-04-07 21:50:44 UTC (rev 
2226)
@@ -52,23 +52,15 @@
        QCoreApplication::setApplicationName(appname);
        qInstallMsgHandler( myMessageOutput );
 
+
        Elvys elvys;
 
        QObject::connect(&app, SIGNAL(aboutToQuit()), &elvys, 
SLOT(cleanUpBeforeExit()));
 
-       QString style;
-       QString fileName =  QCoreApplication::applicationDirPath() + 
"/data/style.css";
-       QFile file(fileName);
 
        qDebug() << "Starting...";              
-       qDebug() << "Setting style sheet";
-       if ( ! file.open(QFile::ReadOnly)) {
-               qWarning() << "Cannot open file:" << fileName;
-       } else {
-               style = file.readAll();
-       }
-       app.setStyleSheet(style);
 
+
 //     QTimer timer;
 
        
@@ -79,6 +71,17 @@
        //elvys.setGeometry(0,0,1920,1080);
        //elvys.show();
 
+       QString style;
+       QString fileName =  QCoreApplication::applicationDirPath() + 
"/data/style.css";
+       QFile file(fileName);
+       qDebug() << "Setting style sheet";
+       if ( ! file.open(QFile::ReadOnly)) {
+               qWarning() << "Cannot open file:" << fileName;
+       } else {
+               style = file.readAll();
+       }
+       app.setStyleSheet(style);       
+
        return app.exec();
 //     QObject::connect(&timer, SIGNAL(timeout()), saver, SLOT(render()));
 //     timer.start(10000);

Modified: trunk/client/elvys-client/src/panel.cpp
===================================================================
--- trunk/client/elvys-client/src/panel.cpp     2010-04-07 06:58:56 UTC (rev 
2225)
+++ trunk/client/elvys-client/src/panel.cpp     2010-04-07 21:50:44 UTC (rev 
2226)
@@ -478,9 +478,7 @@
 
 bool Panel::overLap(QRect r, QRect s, int limitPerc) {
        double limit = limitPerc/100.0;
-       QRect rect = r.intersected(s);
-       qDebug() << r << s;
-       qDebug() << rect.width() * rect.height()  << r.width() * r.height() * 
limit;
+       QRect rect = r.intersected(s);  
 
        if ( (rect.width() * rect.height()) > (r.width() * r.height()) * limit) 
{
                return true;

Modified: trunk/client/elvys-client/src/pdfdocument.cpp
===================================================================
--- trunk/client/elvys-client/src/pdfdocument.cpp       2010-04-07 06:58:56 UTC 
(rev 2225)
+++ trunk/client/elvys-client/src/pdfdocument.cpp       2010-04-07 21:50:44 UTC 
(rev 2226)
@@ -208,7 +208,9 @@
 }
 
 
-void PDFDocument::focusInEvent(QFocusEvent *) {
+void PDFDocument::focusInEvent(QFocusEvent * event) {
+       Q_UNUSED(event);
+
        if (pdfViewer) {
                pdfViewer->setFocus();
        }

Modified: trunk/client/elvys-client/src/textdocument.cpp
===================================================================
--- trunk/client/elvys-client/src/textdocument.cpp      2010-04-07 06:58:56 UTC 
(rev 2225)
+++ trunk/client/elvys-client/src/textdocument.cpp      2010-04-07 21:50:44 UTC 
(rev 2226)
@@ -1,6 +1,8 @@
 #include "textdocument.h"
 #include "QFrame"
 #include <QPalette>
+#include <QStyle>
+#include <QApplication>
 
 TextDocument::TextDocument(Document * doc) : Document(doc) {
        _zoomable = false;
@@ -107,10 +109,14 @@
                return; 
        }
        
+       this->setAutoFillBackground(true);
+       style()->unpolish(this);
        QPalette pal = palette();
        bgColor = _bgColor;             
        pal.setColor(backgroundRole(), _bgColor);
        QWidget::setPalette(pal);
+       style()->polish(this);
+
 }
 
 QString TextDocument::getFileName() {


Other related posts:

  • » [elvystrac] r2226 - style & text background problem fixed - elvys