r16027 by avox - dead key hack

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 28 21:07:21 CET 2010


Author: avox
Date: Sun Nov 28 20:07:21 2010
New Revision: 16027

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16027
Log:
dead key hack

Modified:
    branches/ScribusOIF/scribus/scribus.cpp
    branches/ScribusOIF/scribus/scribus.h
    branches/ScribusOIF/scribus/scribusview.cpp
    branches/ScribusOIF/scribus/scribusview.h
    branches/ScribusOIF/scribus/text/boxes.cpp

Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16027&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Sun Nov 28 20:07:21 2010
@@ -305,6 +305,7 @@
 	CurrStED = NULL;
 	setWindowTitle( tr("Scribus " VERSION));
 	setAttribute(Qt::WA_KeyCompression, false);
+	setAttribute(Qt::WA_InputMethodEnabled, true);
 	setWindowIcon(loadIcon("AppIcon.png"));
 	scrActionGroups.clear();
 	scrActions.clear();
@@ -1217,9 +1218,21 @@
 }
 
 
+void ScribusMainWindow::inputMethodEvent ( QInputMethodEvent * event )
+{
+	qDebug() << "IMEmw" << event->commitString() << event->preeditString() << "attributes:" << event->attributes().count();
+}
+
+QVariant ScribusMainWindow::inputMethodQuery ( Qt::InputMethodQuery query ) const
+{
+	qDebug() << "IMQmw" << query;
+	return QVariant();
+}
+
 //AV -> CanvasMode
 void ScribusMainWindow::keyPressEvent(QKeyEvent *k)
 {
+	qDebug() << "KEYPRESSmw" << k->text() << k->modifiers();
 	QList<QMdiSubWindow *> windows;
 	QMdiSubWindow* w = NULL;
 	int kk = k->key();
@@ -1498,6 +1511,7 @@
 
 void ScribusMainWindow::keyReleaseEvent(QKeyEvent *k)
 {
+	qDebug() << "KEYRELEASEmw" << k->text() << k->modifiers();
 	//Exit out of panning mode if Control is release while the right mouse button is pressed
 	if (HaveDoc)
 	{

Modified: branches/ScribusOIF/scribus/scribus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16027&path=/branches/ScribusOIF/scribus/scribus.h
==============================================================================
--- branches/ScribusOIF/scribus/scribus.h (original)
+++ branches/ScribusOIF/scribus/scribus.h Sun Nov 28 20:07:21 2010
@@ -154,6 +154,8 @@
 	void closeEvent(QCloseEvent *ce);
 	void keyPressEvent(QKeyEvent *k);
 	void keyReleaseEvent(QKeyEvent *k);
+	void inputMethodEvent ( QInputMethodEvent * event );
+	QVariant inputMethodQuery ( Qt::InputMethodQuery query ) const ;
 	void setTBvals(PageItem *currItem);
 	void ShowSubs();
 	void applyNewMaster(QString name);

Modified: branches/ScribusOIF/scribus/scribusview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16027&path=/branches/ScribusOIF/scribus/scribusview.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribusview.cpp (original)
+++ branches/ScribusOIF/scribus/scribusview.cpp Sun Nov 28 20:07:21 2010
@@ -168,6 +168,7 @@
 	p.setBrush(QPalette::Window, PrefsManager::instance()->appPrefs.displayPrefs.scratchColor);
 	setPalette(p);
 	setAttribute(Qt::WA_StaticContents);
+	setAttribute(Qt::WA_InputMethodEnabled, true);
 	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
 	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
 	setViewportMargins(m_vhRulerHW, m_vhRulerHW, 0, 0);
@@ -4174,6 +4175,22 @@
 	m_ScMW->keyReleaseEvent(k);
 }
 
+void ScribusView::inputMethodEvent ( QInputMethodEvent * event )
+{
+	qDebug() << "IME" << event->commitString() << event->preeditString() << "attributes:" << event->attributes().count();
+	for(int i = 0; i < event->commitString().length(); ++i)
+	{
+		QKeyEvent ev( QEvent::KeyPress, 0, Qt::NoModifier, event->commitString().mid(i,1));
+		keyPressEvent(&ev);
+	}
+}
+
+QVariant ScribusView::inputMethodQuery ( Qt::InputMethodQuery query ) const
+{
+	qDebug() << "IMQ" << query;
+	return QVariant();
+}
+
 void ScribusView::wheelEvent(QWheelEvent *w)
 {
 	//QScrollArea::contentsWheelEvent(w);

Modified: branches/ScribusOIF/scribus/scribusview.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16027&path=/branches/ScribusOIF/scribus/scribusview.h
==============================================================================
--- branches/ScribusOIF/scribus/scribusview.h (original)
+++ branches/ScribusOIF/scribus/scribusview.h Sun Nov 28 20:07:21 2010
@@ -329,7 +329,9 @@
 
 	void keyPressEvent(QKeyEvent *k);
 	void keyReleaseEvent(QKeyEvent *k);
-
+	void inputMethodEvent ( QInputMethodEvent * event );
+	QVariant inputMethodQuery ( Qt::InputMethodQuery query ) const ;
+	
 	inline void registerMousePress(QPoint p);
 	bool mousePressed();
 	void resetMousePressed();

Modified: branches/ScribusOIF/scribus/text/boxes.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16027&path=/branches/ScribusOIF/scribus/text/boxes.cpp
==============================================================================
--- branches/ScribusOIF/scribus/text/boxes.cpp (original)
+++ branches/ScribusOIF/scribus/text/boxes.cpp Sun Nov 28 20:07:21 2010
@@ -46,7 +46,18 @@
 {
 	p->save();
 	p->setPen(Qt::green);
-	p->drawLine(FPoint(x(), y() - m_ascent), FPoint(x()+width(), y() + m_descent));
+	FPoint tl(x(), y() - m_ascent);
+	FPoint tr(x()+width(), y() - m_ascent);
+	FPoint bl(x(), y() + m_descent);
+	FPoint br(x()+width(), y() + m_descent);
+	if (m_type == T_Line) {
+		p->drawLine(tl, tr);
+		p->drawLine(bl,br);
+	}
+	else {
+		p->drawLine(tl, bl);
+		p->drawLine(tr, br);
+	}
 	p->restore();
 	p->moveTo(x(),y());
 	for (int i=0; i < m_boxes.count(); ++i)




More information about the scribus-commit mailing list