[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdevelop/parts/qeditor
From:       Amilcar do Carmo Lucas <amilcar () ida ! ing ! tu-bs ! de>
Date:       2003-05-02 13:02:20
[Download RAW message or body]

CVS commit by aclu: 

Patch by: "Jonas B. Jacobi" <jonas.jacobi  - web.de>
Gives the codecompletion listbox the samesize over all editorwindows


  M +4 -4      qeditorcodecompletion.cpp   1.11
  M +28 -1     qeditorcodecompletion.h   1.5


--- kdevelop/parts/qeditor/qeditorcodecompletion.cpp  #1.10:1.11
@@ -43,4 +43,6 @@
 
 #include <kdebug.h>
+//default size for codecompletionlistbox, value may not be ideal, change later
+QSize CCListBox::m_size = QSize(300,200);
 
 static QColor getColor( const QString &type )
@@ -155,5 +157,5 @@ QEditorCodeCompletion::QEditorCodeComple
     m_completionPopup->setLineWidth( 1 );
 
-    m_completionListBox = new QListBox( m_completionPopup );
+    m_completionListBox = new CCListBox( m_completionPopup );
     m_completionListBox->setFrameStyle( QFrame::NoFrame );
     m_completionListBox->installEventFilter( this );
@@ -333,7 +335,5 @@ void QEditorCodeCompletion::updateBox( b
         y += cursor->paragraph()->rect().y();
 
-        m_completionPopup->resize( m_completionListBox->sizeHint() +
-                                   QSize( m_completionListBox->verticalScrollBar()->width() + 4,
-                                          m_completionListBox->horizontalScrollBar()->height() + 4 ) );
+        m_completionPopup->resize( m_completionListBox->sizeHint()+ QSize(2,2))
 
         QPoint pt = curEditor->contentsToViewport( QPoint(x, y) );

--- kdevelop/parts/qeditor/qeditorcodecompletion.h  #1.4:1.5
@@ -56,4 +56,31 @@ public:
 };
 
+/**
+ *This class is used for providing a codecompletionbox with the same size in all editorwindows.
+ *Therefor the size is stored statically and provided over sizeHint().
+ *@short Codecompletion-Listbox
+ */
+class CCListBox : public QListBox{
+public:
+    CCListBox(QWidget* parent = 0, const char* name = 0, WFlags f = 0):QListBox(parent, name, f){
+        resize(m_size);
+        //resize the frame containing the listbox (bad "style" but i don't know a better way)
+        if (parent)
+                parent->resize(m_size +  QSize(2,2));
+    };
+
+    QSize sizeHint()  const {
+        return m_size;
+    };
+
+protected:
+   void resizeEvent(QResizeEvent* rev){
+        m_size = rev->size();
+        QListBox::resizeEvent(rev);
+    };
+
+private:
+    static QSize m_size;
+};
 
 class QEditorCodeCompletion : public QObject
@@ -89,5 +116,5 @@ private:
   QEditorView*       m_view;
   QVBox*          m_completionPopup;
-  QListBox*       m_completionListBox;
+  CCListBox*      m_completionListBox;
   QValueList<KTextEditor::CompletionEntry> m_complList;
   uint            m_lineCursor;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic