![]() |
How do I make a scrollable gui with QtCreator?
Ive looked through;
http://wiki.maemo.org/Qt4_Hildon_Leg...etic_scrolling http://doc.qt.nokia.com/qt-maemo-4.6...tml#setEnabled http://doc.qt.nokia.com/qt-maemo-4.6...-textedit.html I still cant get a scrollable gui working. Basically, im trying to make a QScrollArea and be able to, well, kinetic scrolling. I plan on have lots of text labels and images, I am wanting to be able to scroll down the GUI to be able to read them. Anyone got an example? |
Re: How do I make a scrollable gui with QtCreator?
If you're using QtDesigner, right click inside the QScrollArea and pick a layout, than you can start adding your labels.
If the scroll area is a lot bigger, than expand your main window to the bottom and make a QWidget where you place all your objects, than in the MainWindow constructor set this widget inside the scrollArea: ui->scrollArea->setWidget(ui->widget); |
Re: How do I make a scrollable gui with QtCreator?
Thanks, I dont know how I missed that.
|
Re: How do I make a scrollable gui with QtCreator?
Is reviving a 3yo thread better or worse than creating a new one? :)
Anyway, I have a QScrollArea that covers most of the screen. Inside it, I have a widget of type Preview, derived from QGLWidget. I also have zoom buttons. Zoom affects the horizontal size only, the vertical dimension is fixed. The problem is that zooming in more than two times segfaults the program. Here is the relevant bit where it segfaults: Code:
void Preview::paintGL () w=668, h=416, OK (starting point) w=1002, h=416, OK (zoom in x1) w=1503, h=416, OK (zoom in x2) w=2254, h=416, crash! What is going on? Can the device not handle painting areas of that size? (Code written, built and run entirely on the phone.) Given the experience, I am inclined to rewrite the code to eliminate QScrollArea altogether and instead do my own redrawing the preview with moving starting point. What options do I have to drag the picture left or right with the finger? I would really prefer not to try implementing my own version of kinetic scrolling if I can. |
Re: How do I make a scrollable gui with QtCreator?
Quote:
You may also find hints in the Qalendar source code. The author does a lot of his own drawing in there. Very clean code. |
Re: How do I make a scrollable gui with QtCreator?
I did a simple test using a QScrollArea and a plain QWidget, and was able to continue expanding the size of the widget without any problem:
http://t.imgbox.com/Pu1qY7vF.jpg Perhaps you could try substituting the QGLWidget for a QWidget to see if the problem is related to QGLWidget. It might also be worth showing the setup code for the QScrollArea and child widget (do you have 'widgetResizable' enabled and so on). |
Re: How do I make a scrollable gui with QtCreator?
Here are the initializing bits:
1) mainwindow.ui (relevant part only) Code:
<item> Code:
#include "stackedmainwindow.h" Code:
MainWindow::MainWindow (QWidget *parent) w=668, h=424 w=835, h=416 w=1043, h=416 w=1043, h=416 w=1304, h=416 w=1630, h=416 w=2038, h=416 w=2548, h=416, crash! So it does seem to be size related. |
Re: How do I make a scrollable gui with QtCreator?
Another item to test: you could try just placing the Preview widget directly into the UI without embedding it within a QScrollArea widget. I kind of get the feeling that if this is a memory overrun or a clipping error, it'd be more likely to happen closer to the widget with the actual image data. I kind of doubt that QScrollArea would be so sensitive to the physical size of the image...
BTW, on kinetic scrolling: it seems you can enable kinetic scrolling on most any Qt Maemo widget that can scroll. You can manipulate this feature (turning it on or off, retrieving various scrolling info, or messing around with it in general) by accessing the "kineticScroller" property of the widget. For example, this would switch on kinetic scrolling for a widget called "scrollArea": Code:
QAbstractKineticScroller *scroller = scrollArea->property("kineticScroller").value<QAbstractKineticScroller *>(); |
Re: How do I make a scrollable gui with QtCreator?
Quote:
|
Re: How do I make a scrollable gui with QtCreator?
Max texture size and max render buffer on SGX 530 is 2048x2048
|
All times are GMT. The time now is 13:14. |
vBulletin® Version 3.8.8