Ow, a diff file is very util :-)

2010/6/2 Leandro Santiago <[email protected]>:
> Hello, I'm looking at gb.qt4 code (I'm not a very good C++ programmer
> :-) ) and I saw that the gambas3 main window (MyMainWindow) has
> QWidget as parent class, but QMainWindow serves exactly to this.
>
> It's because gambas applications don't have full integration with
> other qt applications. For example, I use KDE with bespin theme. There
> is a plasmoid called xbar and it implements a global menu, like in OS
> X. All native qt4 applications can use this resource, but gambas apps
> can't.
>
> There is a method in QMainWindow called setMenuBar that set a menubar
> as native menubar. So I just changed MyMainWindow parent to
> QMenuWindow and added setMenuBar(menuBar) at MyMainWindow::configure()
> method. Simple applications (with menubar) I created work fine with
> globalmenu integration, but now gambas IDE is separated in a lot of
> windows, each one with a component (text editor, toolbar, widgets
> hierarch, etc), but uses globalmenu, at least :-)
>
> I think if gambas wants to be ported to other plataforms (like Mac and
> Windows), has a native and integred look is really important.
>
> What do the main developers think about this?
>
> ps: where can I find a small "guideline" to write gambas components
> like gb.qt, gb.gtk, etc?
>
> Sorry for my bad English.
>
diff src/CWindow.cpp src.old/CWindow.cpp
22a23,24
> #include <iostream>
> 
1493c1495,1496
< 	QWidget::QWidget(parent, embedded ? Qt::Widget : Qt::Window)
---
> 	QMainWindow::QMainWindow(parent, embedded ? Qt::Widget : Qt::Window)
>   //QWidget::QWidget(parent, embedded ? Qt::Widget : Qt::Window)
1512a1516
> 
2299,2302c2303,2310
< 		h = menuBar->sizeHint().height();
< 		menuBar->setGeometry(0, 0, this->width(), h);
< 		menuBar->show();
< 		THIS->container->setGeometry(0, h, this->width(), this->height() - h);
---
> 		//h = menuBar->sizeHint().height();
> 		//menuBar->setGeometry(0, 0, this->width(), h);
> 		//menuBar->show();
> 
>     std::cout << "Setei o menubar no método configure" << std::endl;
>     menuBar->setParent(this);
>     setMenuBar(menuBar);
> 		//THIS->container->setGeometry(0, h, this->width(), this->height() - h);
diff src/CWindow.h src.old/CWindow.h
149c149
< class MyMainWindow : public QWidget
---
> class MyMainWindow : public QMainWindow
------------------------------------------------------------------------------

_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to