[Uml-devel] kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Fri Dec 3 19:24:01 UTC 2004
CVS commit by okellogg:
Suppress scrollbars on the editor. Promote view scroll to the editor.
M +22 -7 notewidget.cpp 1.30
M +4 -1 notewidget.h 1.17
--- kdesdk/umbrello/umbrello/notewidget.cpp #1.29:1.30
@@ -20,8 +20,9 @@
#include <qtextedit.h>
#include <qframe.h>
-//kde includes
+// kde includes
+#include <kdebug.h>
#include <kcursor.h>
#include <kcolordialog.h>
-//app includes
+// app includes
#include "dialogs/notedialog.h"
#include "umldoc.h"
@@ -30,4 +31,6 @@
#include "listpopupmenu.h"
+#define NOTEMARGIN 10
+
NoteWidget::NoteWidget(UMLView * view, Uml::IDType id) : UMLWidget(view, id) {
init();
@@ -35,6 +38,10 @@ NoteWidget::NoteWidget(UMLView * view, U
m_pEditor = new QTextEdit(view);
m_pEditor->setFrameStyle(QFrame::NoFrame | QFrame::Plain);
+ m_pEditor->setHScrollBarMode(QScrollView::AlwaysOff);
+ m_pEditor->setVScrollBarMode(QScrollView::AlwaysOff);
m_pEditor->setShown(true);
setEditorGeometry();
+ connect(m_pView, SIGNAL(contentsMoving(int, int)),
+ this, SLOT(slotViewScrolled(int, int)));
}
@@ -49,10 +56,15 @@ NoteWidget::~NoteWidget() {
}
-void NoteWidget::setEditorGeometry() {
- const QRect editorGeometry( UMLWidget::getX() + 10,
- UMLWidget::getY() + 10,
- UMLWidget::getWidth() - 20,
- UMLWidget::getHeight() - 20 );
+void NoteWidget::slotViewScrolled(int x, int y) {
+ setEditorGeometry(x, y);
+}
+
+void NoteWidget::setEditorGeometry(int dx /*=0*/, int dy /*=0*/) {
+ const QRect editorGeometry( UMLWidget::getX() - dx + 6,
+ UMLWidget::getY() - dy + 10,
+ UMLWidget::getWidth() - 16,
+ UMLWidget::getHeight() - 16);
m_pEditor->setGeometry( editorGeometry );
+ m_pEditor->setShown(true);
}
@@ -188,4 +200,5 @@ void NoteWidget::mouseDoubleClickEvent(
void NoteWidget::drawText(QPainter &, int, int) {
m_pEditor->setText( getDoc() );
+ m_pEditor->setShown(true);
}
@@ -205,2 +218,4 @@ bool NoteWidget::loadFromXMI( QDomElemen
+#include "notewidget.moc"
+
--- kdesdk/umbrello/umbrello/notewidget.h #1.16:1.17
@@ -36,4 +36,5 @@ class QTextEdit;
*/
class NoteWidget : public UMLWidget {
+ Q_OBJECT
public:
@@ -131,4 +133,5 @@ public:
public slots:
void slotMenuSelection(int sel);
+ void slotViewScrolled(int x, int y);
protected:
@@ -146,5 +149,5 @@ private:
void init();
- void setEditorGeometry();
+ void setEditorGeometry(int dx = 0, int dy = 0);
QTextEdit *m_pEditor;
};
More information about the umbrello-devel
mailing list