Gregor Mückl wrote:
1. Can this be done with Qt Jambi at all without implementing an own menu bar?
Yes.
2. If so, could you roughly sketch how this would work?
I've attached a brief example to this mail. Since any widget in Qt Jambi
can be a child widget, there are different ways of doing this. One is
putting your 3D view inside a QMainWindow and adding this to your layout
(even though it's called 'window' there's no reason it can't be embedded
inside another widget/main window/etc.) Then you will get a child widget
with all the capabilities of the main window, including menubars, dock
widgets, statusbars and toolbars. Another way is to instantiate the
widget QMenuBar directly and adding this to your layout, in which case
you will have more control over how it looks.
In the example I have a top level widget with three children: a plain
button, a main window and a menu bar. The main window has a central
widget which is another button just to illustrate the nesting. Hopefully
this is somewhere in the region of what you were after?
-- Eskil
import com.trolltech.qt.gui.QApplication;
import com.trolltech.qt.gui.QMainWindow;
import com.trolltech.qt.gui.QMenuBar;
import com.trolltech.qt.gui.QPushButton;
import com.trolltech.qt.gui.QVBoxLayout;
import com.trolltech.qt.gui.QWidget;
public class MenuBarInWidget extends QWidget {
public MenuBarInWidget() {
QVBoxLayout layout = new QVBoxLayout(this);
layout.addWidget(new QPushButton("Plain widget #1"));
QMainWindow mainWindow = new QMainWindow();
mainWindow.setCentralWidget(new QPushButton("Plain widget #2"));
mainWindow.menuBar().addMenu("&File").addAction("E&xit").triggered.connect(this, "close()");
layout.addWidget(mainWindow);
QMenuBar menuBar = new QMenuBar();
menuBar.addMenu("Other &File").addAction("E&xit").triggered.connect(this, "close()");
layout.addWidget(menuBar);
}
public static void main(String args[]) {
QApplication.initialize(args);
MenuBarInWidget w = new MenuBarInWidget();
w.show();
QApplication.exec();
}
}
_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest