Author: sh-sh-sh
Date: Tue Jul 31 16:08:19 2007
New Revision: 39841
URL: http://svn.opensuse.org/viewcvs/yast?rev=39841&view=rev
Log:
ported to Qt4
Modified:
branches/tmp/sh/qt4-port/qt/src/YQRichText.cc
branches/tmp/sh/qt4-port/qt/src/YQRichText.h
Modified: branches/tmp/sh/qt4-port/qt/src/YQRichText.cc
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/qt4-port/qt/src/YQRichText.cc?rev=39841&r1=39840&r2=39841&view=diff
==============================================================================
--- branches/tmp/sh/qt4-port/qt/src/YQRichText.cc (original)
+++ branches/tmp/sh/qt4-port/qt/src/YQRichText.cc Tue Jul 31 16:08:19 2007
@@ -20,10 +20,11 @@
#define y2log_component "qt-ui"
#include
-#include "qregexp.h"
-//Added by qt3to4:
-#include
+#include
+#include
+#include
#include
+
#include "YEvent.h"
#include "utf8.h"
#include "YQUI.h"
@@ -33,31 +34,30 @@
YQRichText::YQRichText( QWidget * parent,
const YWidgetOpt & opt,
- const YCPString & text )
+ const YCPString & ycpText )
: Q3VBox( parent )
- , YRichText( opt, text )
+ , YRichText( opt, ycpText )
{
setWidgetRep( this );
setMargin( YQWidgetMargin );
- _textBrowser = new YQTextBrowser( this );
- _textBrowser->setMimeSourceFactory( 0 );
+ _textBrowser = new QTextBrowser( this );
_textBrowser->setFont( YQUI::ui()->currentFont() );
_textBrowser->installEventFilter( this );
+ _plainTextMode = opt.plainTextMode.value();
+ QString text = fromUTF8( ycpText->value() );
- if ( opt.plainTextMode.value() )
+ if ( _plainTextMode )
{
- _textBrowser->setTextFormat( Qt::PlainText );
- _textBrowser->setWordWrap( Q3TextEdit::NoWrap );
+ _textBrowser->setLineWrapMode( QTextEdit::NoWrap );
+ _textBrowser->setText( text );
}
else
{
- _textBrowser->setTextFormat( Qt::RichText );
+ _textBrowser->setHtml( text );
}
- setText( text );
-
// Set the text foreground color to black, regardless of its current
// settings - it might be changed if this widget resides in a
@@ -70,9 +70,12 @@
pal.setNormal( normalColors );
_textBrowser->setPalette( pal );
+
+#ifdef FIXME
// Set the text background to a light grey
_textBrowser->setPaper( QColor( 234, 234, 234 ) );
+#endif
// Very small default size if specified
@@ -115,11 +118,15 @@
QString text = fromUTF8( ytext->value() );
- if ( _textBrowser->textFormat() != Qt::PlainText )
+ if ( ! _plainTextMode )
text.replace( "&product;", YQUI::ui()->productName() );
+ if ( _plainTextMode )
+ _textBrowser->setText( text );
+ else
+ _textBrowser->setHtml( text );
+
YRichText::setText( ytext );
- _textBrowser->setText( text );
if ( autoScrollDown && _textBrowser->verticalScrollBar() )
_textBrowser->verticalScrollBar()->setValue( _textBrowser->verticalScrollBar()->maxValue() );
Modified: branches/tmp/sh/qt4-port/qt/src/YQRichText.h
URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/qt4-port/qt/src/YQRichText.h?rev=39841&r1=39840&r2=39841&view=diff
==============================================================================
--- branches/tmp/sh/qt4-port/qt/src/YQRichText.h (original)
+++ branches/tmp/sh/qt4-port/qt/src/YQRichText.h Tue Jul 31 16:08:19 2007
@@ -22,15 +22,14 @@
#define YQRichText_h
#include
-#include
-//Added by qt3to4:
-#include
#include
#include "YRichText.h"
class YQTextBrowser;
+class QTextBrowser;
+class QEvent;
class YQRichText : public Q3VBox, public YRichText
{
@@ -98,43 +97,11 @@
// Data members
//
- YQTextBrowser * _textBrowser;
+ QTextBrowser * _textBrowser;
+ bool _plainTextMode;
bool _shrinkable;
};
-/**
- * Helper class - needed to have the benefits of both QVBox as the base class
- * for YQRichText so uniform margins can be implemented (outside, not inside
- * the scroll window as QTextBrowser normally does it) and QTextBrowser's
- * featurs (enable hyperlinks) without removing the text each time the user
- * clicks.
- *
- * This class is required only to overwrite setSource().
- **/
-class YQTextBrowser: public Q3TextBrowser
-{
- Q_OBJECT
-
-
-public:
-
- /**
- * Constructor
- **/
- YQTextBrowser( QWidget * parent = 0 ):
- Q3TextBrowser( parent ) {}
-
-public slots:
-
- /**
- * Get the document pointed to by a hyperlink.
- *
- * Reimplemented from QTextBrowser to avoid having an empty text each time
- * the user clicks on a hyperlink.
- **/
- virtual void setSource( const QString & name ) {}
-};
-
#endif // YQRichText_h
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org