Ich habe gerade mit Qt und Jambi angefangen und bin jetzt auf ein Problem gestoßen.
Ich habe ein QGraphicsScene und ein QGraphicsView erstellt. Wenn ich jetzt jedoch die Höhe oder Breite des QGraphicsView will, bekomme ich immer 480 und 640, egal wie groß QGraphicsView ist.
Hier die relevanten Codeteile:
Code: Alles auswählen
QGraphicsScene scene = new QGraphicsScene(this);
scene.setItemIndexMethod(QGraphicsScene.ItemIndexMethod.NoIndex);
QGraphicsView view = new QGraphicsView(scene);
view.setRenderHint(QPainter.RenderHint.Antialiasing);
view.setBackgroundBrush(new QBrush(new QColor(QColor.white)));
view.setCacheMode(new QGraphicsView.CacheMode(QGraphicsView.CacheModeFlag.CacheBackground));
QGridLayout layout = new QGridLayout();
layout.addWidget(view,0,0);
setLayout(layout);
setWindowTitle("title");
resize(800,600);
view.setSceneRect(0,0,view.width(),view.height());
System.out.println(view.width()+" "+view.height());
Danke schonmal im Vorraus.