[rkward-cvs] SF.net SVN: rkward:[3144] trunk/rkward/rkward/windows

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Oct 25 11:53:09 UTC 2010


Revision: 3144
          http://rkward.svn.sourceforge.net/rkward/?rev=3144&view=rev
Author:   tfry
Date:     2010-10-25 11:53:09 +0000 (Mon, 25 Oct 2010)

Log Message:
-----------
Explicit assignment of color roles, and allow line-wrap in function-argument hints

Modified Paths:
--------------
    trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
    trunk/rkward/rkward/windows/rkcommandeditorwindow.h

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2010-10-25 09:22:26 UTC (rev 3143)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp	2010-10-25 11:53:09 UTC (rev 3144)
@@ -750,6 +750,8 @@
 
 //////////////////////// RKFunctionArgHinter //////////////////////////////
 
+#include <QToolTip>
+
 #include "../core/rfunctionobject.h"
 
 RKFunctionArgHinter::RKFunctionArgHinter (RKScriptContextProvider *provider, KTextEditor::View* view) {
@@ -764,14 +766,14 @@
 		obj->installEventFilter (this);
 	}
 
-	arghints_popup = new QFrame (0, Qt::ToolTip);
-	QVBoxLayout *layout = new QVBoxLayout (arghints_popup);
-	layout->setContentsMargins (2, 2, 2, 2);
-	arghints_popup->setFrameStyle (QFrame::Plain);
-	arghints_popup->setFrameShape (QFrame::Box);
+	arghints_popup = new QLabel (0, Qt::ToolTip);
+	arghints_popup->setForegroundRole (QPalette::ToolTipText);
+	arghints_popup->setBackgroundRole (QPalette::ToolTipBase);
+	arghints_popup->setMargin (2);
+	arghints_popup->setPalette (QToolTip::palette());
+	arghints_popup->setFrameStyle (QFrame::Box);
 	arghints_popup->setLineWidth (1);
-	arghints_popup_text = new QLabel (arghints_popup);
-	layout->addWidget (arghints_popup_text);
+	arghints_popup->setWordWrap (true);
 	arghints_popup->hide ();
 	active = false;
 
@@ -868,8 +870,8 @@
 	}
 
 	// initialize and show popup
-	arghints_popup_text->setText (effective_symbol + " (" + static_cast<RFunctionObject*> (object)->printArgs () + ')');
-	arghints_popup->resize (arghints_popup_text->sizeHint () + QSize (2, 2));
+	arghints_popup->setText (effective_symbol + " (" + static_cast<RFunctionObject*> (object)->printArgs () + ')');
+	arghints_popup->resize (arghints_popup->sizeHint () + QSize (2, 2));
 	active = true;
 	updater.start (50);
 	updateArgHintWindow ();
@@ -880,7 +882,7 @@
 
 	if (!active) return;
 
-	arghints_popup->move (view->mapToGlobal (view->cursorPositionCoordinates () + QPoint (0, arghints_popup->height ())));
+	arghints_popup->move (view->mapToGlobal (view->cursorPositionCoordinates () + QPoint (0, arghints_popup->fontMetrics ().lineSpacing () + arghints_popup->margin ()*2)));
 	if (view->hasFocus ()) arghints_popup->show ();
 	else arghints_popup->hide ();
 }

Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.h	2010-10-25 09:22:26 UTC (rev 3143)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.h	2010-10-25 11:53:09 UTC (rev 3144)
@@ -98,8 +98,7 @@
 	/** A timer to refresh the hint window periodically. This is a bit sorry, but it's really hard to find out, when the view has been moved, or gains/loses focus. While possible, this approach uses much less code. */
 	QTimer updater;
 	bool active;
-	QFrame *arghints_popup;
-	QLabel *arghints_popup_text;
+	QLabel *arghints_popup;
 };
 
 /** code completion model for RKCommandEditorWindow */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list