I'm developing BlackBerry 5.0 application with list organized data.
I'm using ObjectListField and manual drawing in overriden drawListRow. I'm afraid this is
wrong, because all positionig inside row si done manualy, and now I have
serious problem how to handle click on small icon inside row. There must be some better way,
maybe using other control or simple HorizontalFieldManager in VerticalFieldManager instead of ListField,
what is recommended and best practise?
In this case I would use a ListField and ListFieldCallback. You will still have to handle the drawing manually, but the ListField will handle the selection semantics. The selection will normally post a context menu for the ListField, but you can change that behaviour to invoke a default action if you want.
Related
I am using Qt 5.7 (C++) and want to add custom functionality like a reset option to a QSpinBox (as well as QDoubleSpinBox and maybe some other input widgets). This functionality should be accessible via the context menu. However I do not want to replace the default context menu. Instead I want to add my custom actions on top or below the already existing actions.
I found almost matching answers to this question:
https://forum.qt.io/topic/81946/add-item-to-top-of-standard-context-menu-at-right-click
How to add an entry to toolbar context menu in qt?
However, these do not help in my case since it relies on the Widget to have a method that creates and returns the standard context menu (like QLineEdit::createStandardContextMenu()). The spin boxes do not have such a method.
I also tried to go the cheap way and copy the code that creates the default options directly from source (https://github.com/qt/qtbase/blob/5.7/src/widgets/widgets/qabstractspinbox.cpp line 1249). This is also not really satisfactory since it uses private members of the underlying line edit.
Is there a (standard) way to reuse and augment the default context menu of a Q(Double)SpinBox or any QWidget in general? Or do I have to manually re-implement the default behavior?
https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/widgets/qabstractspinbox.cpp#n1315
Yeah it doesn't look like we have any easy "hook" for customizing it (and you can make a feature request if you like); OTOH it's not that much code to copy, since most of the menu entries are added by QLineEdit::createStandardContextMenu()
I'm writing a GUI using QT for embedded system with linux. This device has no mouse. Only display and specific keyboard with keys: up, down, return and 7 number keys.
The software will be used to set some parameters of device and read them (some charts also).
Example of how menu could look:
after OPTION 1 selected
After SUBOPTION 1 selected some table with data is loaded.
Sometimes after selecting option i need to load specific widget and sometimes just another set of options.
I think it is possible to implement custom labels and kind of list widget that aligns them.
I guess it is also possible to use Qt's MVC classes for it. They are highly customizable, but i never made custom views and delegates.
Maybe i just need to create QtListView with stringlist model and apply stylesheet to it so it gets look more like buttons. And based on selection in list load next widget.
Which way is better and why?
Is there any easier ways to accomplish this?
Any ideas would be appreciated.
I am making a new graphical menu interface for a project I am making. I don't want to use the menu system provided by windows APIs and want to make one from scratch.
My question is, what is the best method for setting up the structure?
I'm thinking I will need a menu item object, each of which will have to have their own item array list, etc...
Is it considered sloppy to have recursive coding like that? (Ie an object which contains objects of itself, which contains objects of itself, etc...)
I'm thinking I can give the item object a draw interface which checks itself to see if it has an item array that is not null. If it does, it executes the draw command all the way down, thereby giving me a menu with (for my purposes) unlimited submenu level
In my opinion your approach is fine. In nearly all UI frameworks, views contain views as subviews after all.
But the thing is that writing drawing code is too much work for small projects I think. I would consider using a UI framework such as QT and use its view mechanism as a starting point. You can write your own Menu class which will be a subclass of generic View class in the framework.
I'm thinking of porting my access application to Qt. I am interested to learn how to do continouos subforms, sub custom widgets for presenting/editing/inserting data from recordset in a verically scrollable non datagrid fashion. Meaning I could put button, label, combo, lineEdit... whatever, for every record.
I like QTableView and delegates. I just don't know if it could be modified to fully emulate access subform.
Sidequestion(maybe the same answer)... how do they DO those continuous forms in access under the hood.
thanks
... not real application data in that example recordset
Qt MVC is probably the best/easiest answer for your question ( http://qt-project.org/doc/qt-4.8/model-view-programming.html ), and with QTableView you should be able to achieve what you want.
Another solution could be: if you have a fix set of column items in every row you could simply design a QWidget with the contents of the row and paste your items (rows) into a QVerticalLayout.
Although I would sugget to try with MVC because that's the preferred way and in this case you could even port it to use QML UI if you want (while you can use the same data classes for the 'backend'). QML is definitely the best approach for (even slightly) animated UIs, and it's mature enough to use it already (it's part of Qt 4.8 and will be the 'star' of Qt 5).
I have made my own GUI API for games. One assumption that must be made is the user may want to use a derived version of a Widget I have made.
An example of how I dealt with this with ToolTips is, the user allocates a new ToolTip and sets a global one for the GUI. Ex: getGui().setToolTip(customToolTip);
The GUI then calls toolTip->show() when necessary. The problem with menus in general is that you can have many of them appearing at a given time.
I also would hate to have the user implement an interface:
PopUpFactory::createPopUp()
PopUpFactory::destroyPopup()
How is this usually dealt with? Who or how is the memory also managed for these?
There is always the option of limiting to something like 9 nested menus and have the user set an array of 9 PopUps but that seems messy.
Thanks