On Wednesday 27 March 2002 23:27, Anders Lund wrote: > On Wednesday 27 March 2002 09:08, wenning@ycn.com wrote: > > Hi > > > > > Well, I have partly solved that - now I can get > > > > the popup to work, placing the > > > > > toolbar in a qframe and resizing it in the > > > > resize event. Now I'm mostly > > > > > unhappy with the resize handle. > > > > You have to create a QDockArea and place the > > KToolbar into that. Than you can use > > KToolbar::enableMoving(false); > > > > I had that a long time ago in konqueror's sidebar. > > the file open dialog does the same > > > Thanks. So far, from the KToolbar code I see that if the toolbar has a main > wondow (which it currently does, namely the kate one) calling enableMoving > affects all toolbars (and btw painting of toolbars with moving disabled is > trerrible in kate mainwindow). > > I try using a qdockarea and not having a mainwindow. > Hi again, It turned out that a QDcokarea was not nice: Calling toolbar->setMovingEnabled( false ) in the constructor still had no effect. and suddenly the main toolbar(s) could be docked into the file selector. I figured out that something - probably qmainwindow::polish() sets all toolbar children of a main window to a global property when the window is initially shown. So, I came up with this class, which fixes the issue: /* This is a hack to allow to have the toolbar without a resize handle. As it seems QMainWindow(?) recursively sets all toolbars movable according to the global setting in it's polish() method, this class is there mainly to reset that, and to handle resizing. It is required to setTB() before the widget is shown, that is in the parent constructor, or add the toolbar in the constructor, but there is no access to it (which could easily be changed;) */ #include #include class TBContainer : public QFrame { Q_OBJECT public: TBContainer( QWidget *parent=0, KToolBar *toolbar=0 ) : QFrame( parent, "toolbar container hack" ), tb( toolbar ){}; void setTb( KToolBar *toolbar) { tb = toolbar; }; public slots: void polish() { if (tb) { setMinimumHeight( tb->sizeHint().height() ); tb->setMovingEnabled( false ); } }; protected: void resizeEvent( QResizeEvent *e ) { if( tb ) { tb->resize( e->size() ); } } private: KToolBar *tb; }; Carsten: thanks for responding, and I did look in kfiledialog.cpp, as that is the only window i could think of using a ktoolbar outside the main windows. I also use you nice silenceQToolbar trick;) -anders _______________________________________________ kwrite-devel mailing list kwrite-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/kwrite-devel